1net_inject(9F)           Kernel Functions for Drivers           net_inject(9F)
2
3
4

NAME

6       net_inject - determine if a network interface name exists for a network
7       protocol
8

SYNOPSIS

10       #include <sys/neti.h>
11
12       int net_inject(const net_data_t net, inject_t style,
13             net_inject_t *packet);
14
15

INTERFACE LEVEL

17       Solaris DDI specific (Solaris DDI).
18

PARAMETERS

20       net       value  returned  from  a  successful   call   to   net_proto‐
21                 col_lookup(9F).
22
23
24       style     method that determines how this packet is to be injected into
25                 the network or kernel.
26
27
28       packet    details about the packet to be injected.
29
30

DESCRIPTION

32       The net_inject() function provides an interface to  allow  delivery  of
33       network layer (layer 3) packets either into the kernel or onto the net‐
34       work. The method of delivery is determined by style.
35
36
37       If NI_QUEUE_IN is specified, the packet is scheduled  for  delivery  up
38       into  the  kernel,  imitating  its reception by a network interface. In
39       this mode, packet->ni_addr is ignored and  packet->ni_physical   speci‐
40       fies  the  interface  for  which  the packet is made to appear as if it
41       arrived on.
42
43
44       If NI_QUEUE_OUT is specified, the packet is scheduled for delivery  out
45       of  the kernel, as if it were being sent by a raw socket. In this mode,
46       packet->ni_addr and packet->ni_physical are both ignored.
47
48
49       Neither NI_QUEUE_IN or NI_QUEUE_OUT cause the packet to be  immediately
50       processed  by  the kernel. Instead, the packet is added to a list and a
51       timeout is scheduled (if there are none already pending) to deliver the
52       packet.  The  call to net_inject() returns once the setup has been com‐
53       pleted, and not after the packet has been processed.  The  packet  pro‐
54       cessing  is  completed on a different thread and in a different context
55       to that of  the  original  packet.  Thus,  a  packet  queued  up  using
56       net_inject() for either NI_QUEUE_IN or NI_QUEUE_OUT is presented to the
57       packet event again. A packet received by a hook from NH_PHYSICAL_IN and
58       then queued up with NI_QUEUE_IN is seen by the hook as another NH_PHYS‐
59       ICAL_IN  packet.  This  also  applies  to  both   NH_PHYSICAL_OUT   and
60       NI_QUEUE_OUT packets.
61
62
63       If  NI_DIRECT_OUT  is  specified, an attempt is made to send the packet
64       out to a network interface immediately. No processing  on  the  packet,
65       aside  from  prepending  any  required layer 2 information, is made. In
66       this instance, packet->ni_addr may be used to specify the next hop (for
67       the  purpose  of link layer address resolution) and packet->ni_physical
68       determines which interface the packet should be sent out.
69
70
71       For all three packets, packet->ni_packet must point to an  mblk  struc‐
72       ture with the packet to be delivered.
73
74
75       See net_inject_t(9S) for more details on the structure net_inject_t.
76

RETURN VALUES

78       The net_inject() function returns:
79
80       -1    The network protocol does not support this function.
81
82
83       0     The packet is successfully queued or sent.
84
85
86       1     The packet could not be queued up or sent out immediately.
87
88

CONTEXT

90       The  net_inject()  function may be called from user,  kernel, or inter‐
91       rupt context.
92

ATTRIBUTES

94       See attributes(5) for descriptions of the following attributes:
95
96
97
98
99       ┌─────────────────────────────┬─────────────────────────────┐
100       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
101       ├─────────────────────────────┼─────────────────────────────┤
102       │Availability                 │SUNWcsu                      │
103       ├─────────────────────────────┼─────────────────────────────┤
104       │Interface Stability          │Committed                    │
105       └─────────────────────────────┴─────────────────────────────┘
106

SEE ALSO

108       net_protocol_lookup(9F), netinfo(9F), net_inject_t(9S)
109
110
111
112SunOS 5.11                        1 May 2008                    net_inject(9F)
Impressum