NET_INJECT(9F) Kernel Functions for Drivers NET_INJECT(9F)
net_inject - determine if a network interface name exists for a network
#include <sys/neti.h> int net_inject
(const net_data_t net
, inject_t style
illumos DDI specific (illumos DDI).
value returned from a successful call to net_protocol_lookup(9F)
method that determines how this packet is to be injected into
the network or kernel. packet
details about the packet to be injected.
function provides an interface to allow delivery of
network layer (layer 3) packets either into the kernel or onto the
network. The method of delivery is determined by style.
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_physical
interface for which the packet is made to appear as if it arrived on.
is specified, the packet is scheduled for delivery out of
the kernel, as if it were being sent by a raw socket. In this mode, packet->ni_addr
are both ignored.
cause the packet to be immediately
processed by the kernel. Instead, the packet is added to a list and a
timeout is scheduled (if there are none already pending) to deliver the
packet. The call to net_inject()
returns once the setup has been
completed, and not after the packet has been processed. The packet
processing is completed on a different thread and in a different context
to that of the original packet. Thus, a packet queued up using net_inject()
for either NI_QUEUE_IN
is presented to the
packet event again. A packet received by a hook from NH_PHYSICAL_IN
then queued up with NI_QUEUE_IN
is seen by the hook as another NH_PHYSICAL_IN
packet. This also applies to both NH_PHYSICAL_OUT
is specified, an attempt is made to send the packet out
to a network interface immediately. No processing on the packet, aside
from prepending any required layer 2 information, is made. In this
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 packets, packet->ni_packet
must point to an mblk
with the packet to be delivered.
for more details on the structure net_inject_t
function returns: -1
The network protocol does not support this function. 0
The packet is successfully queued or sent. 1
The packet could not be queued up or sent out immediately.
function may be called from user, kernel, or interrupt
for descriptions of the following attributes:
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|Interface Stability | Committed |
SEE ALSO net_protocol_lookup(9F)
May 1, 2008 NET_INJECT(9F)