in.c (133486) | in.c (133874) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1991, 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 * @(#)in.c 8.4 (Berkeley) 1/9/95 | 1/* 2 * Copyright (c) 1982, 1986, 1991, 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 * @(#)in.c 8.4 (Berkeley) 1/9/95 |
30 * $FreeBSD: head/sys/netinet/in.c 133486 2004-08-11 11:49:48Z andre $ | 30 * $FreeBSD: head/sys/netinet/in.c 133874 2004-08-16 18:32:07Z rwatson $ |
31 */ 32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/sockio.h> 36#include <sys/malloc.h> 37#include <sys/socket.h> 38#include <sys/kernel.h> --- 16 unchanged lines hidden (view full) --- 55static int in_lifaddr_ioctl(struct socket *, u_long, caddr_t, 56 struct ifnet *, struct thread *); 57 58static void in_socktrim(struct sockaddr_in *); 59static int in_ifinit(struct ifnet *, 60 struct in_ifaddr *, struct sockaddr_in *, int); 61 62static int subnetsarelocal = 0; | 31 */ 32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/sockio.h> 36#include <sys/malloc.h> 37#include <sys/socket.h> 38#include <sys/kernel.h> --- 16 unchanged lines hidden (view full) --- 55static int in_lifaddr_ioctl(struct socket *, u_long, caddr_t, 56 struct ifnet *, struct thread *); 57 58static void in_socktrim(struct sockaddr_in *); 59static int in_ifinit(struct ifnet *, 60 struct in_ifaddr *, struct sockaddr_in *, int); 61 62static int subnetsarelocal = 0; |
63SYSCTL_INT(_net_inet_ip, OID_AUTO, subnets_are_local, CTLFLAG_RW, | 63SYSCTL_INT(_net_inet_ip, OID_AUTO, subnets_are_local, CTLFLAG_RW, |
64 &subnetsarelocal, 0, "Treat all subnets as directly connected"); 65 66struct in_multihead in_multihead; /* XXX BSS initialization */ 67 68extern struct inpcbinfo ripcbinfo; 69extern struct inpcbinfo udbinfo; 70 71/* --- 67 unchanged lines hidden (view full) --- 139in_socktrim(ap) 140struct sockaddr_in *ap; 141{ 142 register char *cplim = (char *) &ap->sin_addr; 143 register char *cp = (char *) (&ap->sin_addr + 1); 144 145 ap->sin_len = 0; 146 while (--cp >= cplim) | 64 &subnetsarelocal, 0, "Treat all subnets as directly connected"); 65 66struct in_multihead in_multihead; /* XXX BSS initialization */ 67 68extern struct inpcbinfo ripcbinfo; 69extern struct inpcbinfo udbinfo; 70 71/* --- 67 unchanged lines hidden (view full) --- 139in_socktrim(ap) 140struct sockaddr_in *ap; 141{ 142 register char *cplim = (char *) &ap->sin_addr; 143 register char *cp = (char *) (&ap->sin_addr + 1); 144 145 ap->sin_len = 0; 146 while (--cp >= cplim) |
147 if (*cp) { | 147 if (*cp) { |
148 (ap)->sin_len = cp - (char *) (ap) + 1; 149 break; 150 } 151} 152 153static int 154in_mask2len(mask) 155 struct in_addr *mask; --- 622 unchanged lines hidden (view full) --- 778 779 780/* 781 * Return 1 if the address might be a local broadcast address. 782 */ 783int 784in_broadcast(in, ifp) 785 struct in_addr in; | 148 (ap)->sin_len = cp - (char *) (ap) + 1; 149 break; 150 } 151} 152 153static int 154in_mask2len(mask) 155 struct in_addr *mask; --- 622 unchanged lines hidden (view full) --- 778 779 780/* 781 * Return 1 if the address might be a local broadcast address. 782 */ 783int 784in_broadcast(in, ifp) 785 struct in_addr in; |
786 struct ifnet *ifp; | 786 struct ifnet *ifp; |
787{ 788 register struct ifaddr *ifa; 789 u_long t; 790 791 if (in.s_addr == INADDR_BROADCAST || 792 in.s_addr == INADDR_ANY) 793 return 1; 794 if ((ifp->if_flags & IFF_BROADCAST) == 0) --- 116 unchanged lines hidden --- | 787{ 788 register struct ifaddr *ifa; 789 u_long t; 790 791 if (in.s_addr == INADDR_BROADCAST || 792 in.s_addr == INADDR_ANY) 793 return 1; 794 if ((ifp->if_flags & IFF_BROADCAST) == 0) --- 116 unchanged lines hidden --- |