if_loop.c (271867) | if_loop.c (274175) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)if_loop.c 8.2 (Berkeley) 1/9/95 | 1/*- 2 * Copyright (c) 1982, 1986, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)if_loop.c 8.2 (Berkeley) 1/9/95 |
30 * $FreeBSD: head/sys/net/if_loop.c 271867 2014-09-19 10:39:58Z glebius $ | 30 * $FreeBSD: head/sys/net/if_loop.c 274175 2014-11-06 13:13:09Z melifaro $ |
31 */ 32 33/* 34 * Loopback interface driver for protocol testing and timing. 35 */ 36 37#include "opt_inet.h" 38#include "opt_inet6.h" --- 44 unchanged lines hidden (view full) --- 83#define LO_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP | CSUM_SCTP) 84#define LO_CSUM_FEATURES6 (CSUM_TCP_IPV6 | CSUM_UDP_IPV6 | CSUM_SCTP_IPV6) 85#define LO_CSUM_SET (CSUM_DATA_VALID | CSUM_DATA_VALID_IPV6 | \ 86 CSUM_PSEUDO_HDR | \ 87 CSUM_IP_CHECKED | CSUM_IP_VALID | \ 88 CSUM_SCTP_VALID) 89 90int loioctl(struct ifnet *, u_long, caddr_t); | 31 */ 32 33/* 34 * Loopback interface driver for protocol testing and timing. 35 */ 36 37#include "opt_inet.h" 38#include "opt_inet6.h" --- 44 unchanged lines hidden (view full) --- 83#define LO_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP | CSUM_SCTP) 84#define LO_CSUM_FEATURES6 (CSUM_TCP_IPV6 | CSUM_UDP_IPV6 | CSUM_SCTP_IPV6) 85#define LO_CSUM_SET (CSUM_DATA_VALID | CSUM_DATA_VALID_IPV6 | \ 86 CSUM_PSEUDO_HDR | \ 87 CSUM_IP_CHECKED | CSUM_IP_VALID | \ 88 CSUM_SCTP_VALID) 89 90int loioctl(struct ifnet *, u_long, caddr_t); |
91static void lortrequest(int, struct rtentry *, struct rt_addrinfo *); | |
92int looutput(struct ifnet *ifp, struct mbuf *m, 93 const struct sockaddr *dst, struct route *ro); 94static int lo_clone_create(struct if_clone *, int, caddr_t); 95static void lo_clone_destroy(struct ifnet *); 96 97VNET_DEFINE(struct ifnet *, loif); /* Used externally */ 98 99#ifdef VIMAGE --- 259 unchanged lines hidden (view full) --- 359 return (EAFNOSUPPORT); 360 } 361 if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); 362 if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len); 363 netisr_queue(isr, m); /* mbuf is free'd on failure. */ 364 return (0); 365} 366 | 91int looutput(struct ifnet *ifp, struct mbuf *m, 92 const struct sockaddr *dst, struct route *ro); 93static int lo_clone_create(struct if_clone *, int, caddr_t); 94static void lo_clone_destroy(struct ifnet *); 95 96VNET_DEFINE(struct ifnet *, loif); /* Used externally */ 97 98#ifdef VIMAGE --- 259 unchanged lines hidden (view full) --- 358 return (EAFNOSUPPORT); 359 } 360 if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); 361 if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len); 362 netisr_queue(isr, m); /* mbuf is free'd on failure. */ 363 return (0); 364} 365 |
367/* ARGSUSED */ 368static void 369lortrequest(int cmd, struct rtentry *rt, struct rt_addrinfo *info) 370{ 371 372 RT_LOCK_ASSERT(rt); 373 rt->rt_mtu = rt->rt_ifp->if_mtu; 374} 375 | |
376/* 377 * Process an ioctl request. 378 */ 379/* ARGSUSED */ 380int 381loioctl(struct ifnet *ifp, u_long cmd, caddr_t data) 382{ | 366/* 367 * Process an ioctl request. 368 */ 369/* ARGSUSED */ 370int 371loioctl(struct ifnet *ifp, u_long cmd, caddr_t data) 372{ |
383 struct ifaddr *ifa; | |
384 struct ifreq *ifr = (struct ifreq *)data; 385 int error = 0, mask; 386 387 switch (cmd) { 388 case SIOCSIFADDR: 389 ifp->if_flags |= IFF_UP; 390 ifp->if_drv_flags |= IFF_DRV_RUNNING; | 373 struct ifreq *ifr = (struct ifreq *)data; 374 int error = 0, mask; 375 376 switch (cmd) { 377 case SIOCSIFADDR: 378 ifp->if_flags |= IFF_UP; 379 ifp->if_drv_flags |= IFF_DRV_RUNNING; |
391 ifa = (struct ifaddr *)data; 392 ifa->ifa_rtrequest = lortrequest; | |
393 /* 394 * Everything else is done at a higher level. 395 */ 396 break; 397 398 case SIOCADDMULTI: 399 case SIOCDELMULTI: 400 if (ifr == 0) { --- 63 unchanged lines hidden --- | 380 /* 381 * Everything else is done at a higher level. 382 */ 383 break; 384 385 case SIOCADDMULTI: 386 case SIOCDELMULTI: 387 if (ifr == 0) { --- 63 unchanged lines hidden --- |