raw_ip.c (194622) | raw_ip.c (194951) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1988, 1993 3 * The Regents of the University of California. 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: --- 17 unchanged lines hidden (view full) --- 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 * @(#)raw_ip.c 8.7 (Berkeley) 5/15/95 31 */ 32 33#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1982, 1986, 1988, 1993 3 * The Regents of the University of California. 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: --- 17 unchanged lines hidden (view full) --- 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 * @(#)raw_ip.c 8.7 (Berkeley) 5/15/95 31 */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/netinet/raw_ip.c 194622 2009-06-22 10:59:34Z rwatson $"); | 34__FBSDID("$FreeBSD: head/sys/netinet/raw_ip.c 194951 2009-06-25 11:52:33Z rwatson $"); |
35 36#include "opt_inet6.h" 37#include "opt_ipsec.h" 38 39#include <sys/param.h> 40#include <sys/jail.h> 41#include <sys/kernel.h> 42#include <sys/lock.h> --- 630 unchanged lines hidden (view full) --- 673 INIT_VNET_INET(curvnet); 674 struct in_ifaddr *ia; 675 struct ifnet *ifp; 676 int err; 677 int flags; 678 679 switch (cmd) { 680 case PRC_IFDOWN: | 35 36#include "opt_inet6.h" 37#include "opt_ipsec.h" 38 39#include <sys/param.h> 40#include <sys/jail.h> 41#include <sys/kernel.h> 42#include <sys/lock.h> --- 630 unchanged lines hidden (view full) --- 673 INIT_VNET_INET(curvnet); 674 struct in_ifaddr *ia; 675 struct ifnet *ifp; 676 int err; 677 int flags; 678 679 switch (cmd) { 680 case PRC_IFDOWN: |
681 IN_IFADDR_RLOCK(); |
|
681 TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { 682 if (ia->ia_ifa.ifa_addr == sa 683 && (ia->ia_flags & IFA_ROUTE)) { | 682 TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { 683 if (ia->ia_ifa.ifa_addr == sa 684 && (ia->ia_flags & IFA_ROUTE)) { |
685 ifa_ref(&ia->ia_ifa); 686 IN_IFADDR_RUNLOCK(); |
|
684 /* 685 * in_ifscrub kills the interface route. 686 */ 687 in_ifscrub(ia->ia_ifp, ia); 688 /* 689 * in_ifadown gets rid of all the rest of the 690 * routes. This is not quite the right thing 691 * to do, but at least if we are running a 692 * routing process they will come back. 693 */ 694 in_ifadown(&ia->ia_ifa, 0); | 687 /* 688 * in_ifscrub kills the interface route. 689 */ 690 in_ifscrub(ia->ia_ifp, ia); 691 /* 692 * in_ifadown gets rid of all the rest of the 693 * routes. This is not quite the right thing 694 * to do, but at least if we are running a 695 * routing process they will come back. 696 */ 697 in_ifadown(&ia->ia_ifa, 0); |
698 ifa_free(&ia->ia_ifa); |
|
695 break; 696 } 697 } | 699 break; 700 } 701 } |
702 if (ia == NULL) /* If ia matched, already unlocked. */ 703 IN_IFADDR_RUNLOCK(); |
|
698 break; 699 700 case PRC_IFUP: | 704 break; 705 706 case PRC_IFUP: |
707 IN_IFADDR_RLOCK(); |
|
701 TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { 702 if (ia->ia_ifa.ifa_addr == sa) 703 break; 704 } | 708 TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { 709 if (ia->ia_ifa.ifa_addr == sa) 710 break; 711 } |
705 if (ia == 0 || (ia->ia_flags & IFA_ROUTE)) | 712 if (ia == NULL || (ia->ia_flags & IFA_ROUTE)) { 713 IN_IFADDR_RUNLOCK(); |
706 return; | 714 return; |
715 } 716 ifa_ref(&ia->ia_ifa); 717 IN_IFADDR_RUNLOCK(); |
|
707 flags = RTF_UP; 708 ifp = ia->ia_ifa.ifa_ifp; 709 710 if ((ifp->if_flags & IFF_LOOPBACK) 711 || (ifp->if_flags & IFF_POINTOPOINT)) 712 flags |= RTF_HOST; 713 714 err = rtinit(&ia->ia_ifa, RTM_ADD, flags); 715 if (err == 0) 716 ia->ia_flags |= IFA_ROUTE; | 718 flags = RTF_UP; 719 ifp = ia->ia_ifa.ifa_ifp; 720 721 if ((ifp->if_flags & IFF_LOOPBACK) 722 || (ifp->if_flags & IFF_POINTOPOINT)) 723 flags |= RTF_HOST; 724 725 err = rtinit(&ia->ia_ifa, RTM_ADD, flags); 726 if (err == 0) 727 ia->ia_flags |= IFA_ROUTE; |
728 ifa_free(&ia->ia_ifa); |
|
717 break; 718 } 719} 720 721u_long rip_sendspace = 9216; 722u_long rip_recvspace = 9216; 723 724SYSCTL_ULONG(_net_inet_raw, OID_AUTO, maxdgram, CTLFLAG_RW, --- 349 unchanged lines hidden --- | 729 break; 730 } 731} 732 733u_long rip_sendspace = 9216; 734u_long rip_recvspace = 9216; 735 736SYSCTL_ULONG(_net_inet_raw, OID_AUTO, maxdgram, CTLFLAG_RW, --- 349 unchanged lines hidden --- |