Kernel functions net_inject(9F) NAME net_inject - determine if a network interface name exists for a network protocol SYNOPSIS #include int net_inject(const net_data_t net, inject_t style, net_inject_t *packet); INTERFACE LEVEL Solaris DDI specific (Solaris DDI) PARAMETERS net value returned from a successful call to net_protocol_lookup. style how this packet is to be injected into the network/kernel. packet details about the packet to be injected. DESCRIPTION - describe queue in/out in more detail - what happens when next hop is not specified? more details for net_inject_t and behaviour of net_inject This function provides an interface to allow delivery of network layer (layer 3) packets either into the kernel or out onto the network. The method of delivery is determined by style. If NI_QUEUE_IN is specified, the packet is scheduled for delivery up into the kernel, imitating its reception by a network interface. In this mode, packet->ni_addr is ignored and packet->ni_pkysical specifies the interface for which the packet is made to appear as if it arrived on. If NI_QUEUE_OUT is specified, the packet is scheduled for delivery out of the kernel, as if it were being sent via a raw socket. In this mode, packet->ni_addr and packet- >ni_pkysical are both ignored. SunOS 5.10 Last change: 25 March 2008 1 Kernel functions net_inject(9F) Neither NI_QUEUE_IN or NI_QUEUE_OUT cause the packet to be immediately processed by the kernel, rather the packet is added to a list and a timeout scheduled, if there are none already pending, to delivery the packet. The call to net_inject() returns once the setup has been completed - not after the packet has been processed. The packet processing is completed on a different thread and in a different con- text to that of the original packet. Thus a packet queued up using net_inject() for either NI_QUEUE_IN or NI_QUEUE_OUT will be presented to the pavket event again. Thus a packet received by a hook from NH_PHYSICAL_IN and then queued up with NI_QUEUE_IN will be seen by the hook, again, as another NH_PHYSICAL_IN packet and likewise for NH_PHYSICAL_OUT and NI_QUEUE_OUT. If NI_DIRECT_OUT is specified, an attempt is made to send the packet out a network interface immediately. No process- ing on the packet, aside from prepending any required layer 2 information, is made. In this instance, packet->ni_addr may be used to specify the next hop (for the purpose of link layer address resolution) and packet->ni_physical determines which interface the packet should be sent out. For all three, packet->ni_packet must point to an mblk with the packet to be delivered. See net_inject_t(9s) for more details on the structure net_inject_t. RETURN VALUES This interface returns "-1" if it is not support by the net- work protocol, 0 if the packet is successfully queued or sent and 1 if the packet could not be queued up or sent out immediately. ATTRIBUTES See attributes(5) for descriptions of the following attri- butes: ____________________________________________________________ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | |_____________________________|_____________________________| | Interface Stability | Committed | |_____________________________|_____________________________| SEE ALSO netinfo(9f) SunOS 5.10 Last change: 25 March 2008 2