Kernel Functions for Drivers netinject(9F)
NAME
netinject - determine if a network interface name exists
for a network protocol
SYNOPSIS
#include
int netinject(const netdatat net, injectt style,
netinjectt *packet);
INTERFACE LEVEL
Solaris DI specific (Solaris DI).
PARAMETERS
net value returned from a successful call to
netprotocollookup(9F).
style method that determines how this packet is to be
injected into the network or kernel.
packet details about the packet to be injected.
DESCRIPTION
The netinject() 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 deter-
mined by style.
If NIQUEUEIN is specified, the packet is scheduled for
delivery up into the kernel, imitating its reception by a
network interface. In this mode, packet->niaddr is ignored
and packet->niphysical specifies the interface for which
the packet is made to appear as if it arrived on.
If NIQUEUEOUT 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->niaddr and packet-
>niphysical are both ignored.
Neither NIQUEUEIN or NIQUEUEOUT 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
netinject() returns once the setup has been completed, and
not after the packet has been processed. The packet
SunOS 5.11 Last change: 1 May 2008 1
Kernel Functions for Drivers netinject(9F)
processing is completed on a different thread and in a dif-
ferent context to that of the original packet. Thus, a
packet queued up using netinject() for either NIQUEUEIN
or NIQUEUEOUT is presented to the packet event again. A
packet received by a hook from NHPHYSICALIN and then
queued up with NIQUEUEIN is seen by the hook as another
NHPHYSICALIN packet. This also applies to both
NHPHYSICALOUT and NIQUEUEOUT packets.
If NIDIRECTOUT is specified, an attempt is made to send
the packet out to a network interface immediately. No pro-
cessing on the packet, aside from prepending any required
layer 2 information, is made. In this instance, packet-
>niaddr may be used to specify the next hop (for the pur-
pose of link layer address resolution) and packet-
>niphysical determines which interface the packet should be
sent out.
For all three packets, packet->nipacket must point to an
mblk structure with the packet to be delivered.
See netinjectt(9S) for more details on the structure
netinjectt.
RETURN VALUES
The netinject() 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 immedi-
ately.
CONTEXT
The netinject() function may be called from user, kernel,
or interrupt context.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
SunOS 5.11 Last change: 1 May 2008 2
Kernel Functions for Drivers netinject(9F)
ATRIBUTE TYPE ATRIBUTE VALUE
Availability SUNWcsu
Interface Stability Committed
SEE ALSO
netprotocollookup(9F), netinfo(9F), netinjectt(9S)
SunOS 5.11 Last change: 1 May 2008 3
|