1/*-
2 *
3 * Copyright (c) 1999-2001, Vitaly V Belekhov
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
--- 11 unchanged lines hidden (view full) ---
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $FreeBSD: head/sys/netgraph/ng_eiface.c 222255 2011-05-24 14:10:33Z zec $
29 */
30
31#include <sys/param.h>
32#include <sys/systm.h>
33#include <sys/errno.h>
34#include <sys/kernel.h>
35#include <sys/malloc.h>
36#include <sys/mbuf.h>
--- 90 unchanged lines hidden (view full) ---
127/*
128 * Process an ioctl for the virtual interface
129 */
130static int
131ng_eiface_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
132{
133 const priv_p priv = (priv_p)ifp->if_softc;
134 struct ifreq *const ifr = (struct ifreq *)data;
135 int s, error = 0;
136
137#ifdef DEBUG
138 ng_eiface_print_ioctl(ifp, command, data);
139#endif
140 s = splimp();
141 switch (command) {
142
143 /* These two are mostly handled at a higher layer */
144 case SIOCSIFADDR:
145 error = ether_ioctl(ifp, command, data);
146 break;
147 case SIOCGIFADDR:
148 break;
--- 39 unchanged lines hidden (view full) ---
188 case SIOCSIFPHYS:
189 error = EOPNOTSUPP;
190 break;
191
192 default:
193 error = EINVAL;
194 break;
195 }
196 splx(s);
197 return (error);
198}
199
200static void
201ng_eiface_init(void *xsc)
202{
203 priv_p sc = xsc;
204 struct ifnet *ifp = sc->ifp;
205 int s;
206
207 s = splimp();
208
209 ifp->if_drv_flags |= IFF_DRV_RUNNING;
210 ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
211
212 splx(s);
213}
214
215/*
216 * We simply relay the packet to the "ether" hook, if it is connected.
217 * We have been through the netgraph locking and are guaranteed to
218 * be the only code running in this node at this time.
219 */
220static void
--- 466 unchanged lines hidden ---
2 *
3 * Copyright (c) 1999-2001, Vitaly V Belekhov
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
--- 11 unchanged lines hidden (view full) ---
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $FreeBSD: head/sys/netgraph/ng_eiface.c 222255 2011-05-24 14:10:33Z zec $
29 */
30
31#include <sys/param.h>
32#include <sys/systm.h>
33#include <sys/errno.h>
34#include <sys/kernel.h>
35#include <sys/malloc.h>
36#include <sys/mbuf.h>
--- 90 unchanged lines hidden (view full) ---
127/*
128 * Process an ioctl for the virtual interface
129 */
130static int
131ng_eiface_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
132{
133 const priv_p priv = (priv_p)ifp->if_softc;
134 struct ifreq *const ifr = (struct ifreq *)data;
135 int s, error = 0;
136
137#ifdef DEBUG
138 ng_eiface_print_ioctl(ifp, command, data);
139#endif
140 s = splimp();
141 switch (command) {
142
143 /* These two are mostly handled at a higher layer */
144 case SIOCSIFADDR:
145 error = ether_ioctl(ifp, command, data);
146 break;
147 case SIOCGIFADDR:
148 break;
--- 39 unchanged lines hidden (view full) ---
188 case SIOCSIFPHYS:
189 error = EOPNOTSUPP;
190 break;
191
192 default:
193 error = EINVAL;
194 break;
195 }
196 splx(s);
197 return (error);
198}
199
200static void
201ng_eiface_init(void *xsc)
202{
203 priv_p sc = xsc;
204 struct ifnet *ifp = sc->ifp;
205 int s;
206
207 s = splimp();
208
209 ifp->if_drv_flags |= IFF_DRV_RUNNING;
210 ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
211
212 splx(s);
213}
214
215/*
216 * We simply relay the packet to the "ether" hook, if it is connected.
217 * We have been through the netgraph locking and are guaranteed to
218 * be the only code running in this node at this time.
219 */
220static void
--- 466 unchanged lines hidden ---