2 .\" Copyright (C) 2008, Sun Microsystems, Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH NET_INJECT 9F "May 1, 2008"
8 net_inject \- determine if a network interface name exists for a network
15 \fBint\fR \fBnet_inject\fR(\fBconst\fR \fBnet_data_t\fR \fInet\fR, \fBinject_t\fR \fIstyle\fR,
16 \fBnet_inject_t\fR *\fIpacket\fR);
22 Solaris DDI specific (Solaris DDI).
30 value returned from a successful call to \fBnet_protocol_lookup\fR(9F).
39 method that determines how this packet is to be injected into the network or
49 details about the packet to be injected.
55 The \fBnet_inject()\fR function provides an interface to allow delivery of
56 network layer (layer 3) packets either into the kernel or onto the network. The
57 method of delivery is determined by style.
60 If \fBNI_QUEUE_IN\fR is specified, the packet is scheduled for delivery up into
61 the kernel, imitating its reception by a network interface. In this mode,
62 \fBpacket->ni_addr\fR is ignored and \fB packet->ni_physical\fR specifies the
63 interface for which the packet is made to appear as if it arrived on.
66 If \fBNI_QUEUE_OUT\fR is specified, the packet is scheduled for delivery out of
67 the kernel, as if it were being sent by a raw socket. In this mode,
68 \fBpacket->ni_addr\fR and \fBpacket->ni_physical\fR are both ignored.
71 Neither \fBNI_QUEUE_IN\fR or \fBNI_QUEUE_OUT\fR cause the packet to be
72 immediately processed by the kernel. Instead, the packet is added to a list and
73 a timeout is scheduled (if there are none already pending) to deliver the
74 packet. The call to \fBnet_inject()\fR returns once the setup has been
75 completed, and not after the packet has been processed. The packet processing
76 is completed on a different thread and in a different context to that of the
77 original packet. Thus, a packet queued up using \fBnet_inject()\fR for either
78 \fBNI_QUEUE_IN\fR or \fBNI_QUEUE_OUT\fR is presented to the packet event again.
79 A packet received by a hook from \fBNH_PHYSICAL_IN\fR and then queued up with
80 \fBNI_QUEUE_IN\fR is seen by the hook as another \fBNH_PHYSICAL_IN\fR packet.
81 This also applies to both \fBNH_PHYSICAL_OUT\fR and \fBNI_QUEUE_OUT\fR packets.
84 If \fBNI_DIRECT_OUT\fR is specified, an attempt is made to send the packet out
85 to a network interface immediately. No processing on the packet, aside from
86 prepending any required layer 2 information, is made. In this instance,
87 \fBpacket->ni_addr\fR may be used to specify the next hop (for the purpose of
88 link layer address resolution) and \fBpacket->ni_physical\fR determines which
89 interface the packet should be sent out.
92 For all three packets, \fBpacket->ni_packet\fR must point to an \fBmblk\fR
93 structure with the packet to be delivered.
96 See \fBnet_inject_t\fR(9S) for more details on the structure
101 The \fBnet_inject()\fR function returns:
108 The network protocol does not support this function.
117 The packet is successfully queued or sent.
126 The packet could not be queued up or sent out immediately.
132 The \fBnet_inject()\fR function may be called from user, kernel, or interrupt
137 See \fBattributes\fR(5) for descriptions of the following attributes:
145 ATTRIBUTE TYPE ATTRIBUTE VALUE
147 Interface Stability Committed
153 \fBnet_protocol_lookup\fR(9F), \fBnetinfo\fR(9F), \fBnet_inject_t\fR(9S)