raw_ip.c (221131) | raw_ip.c (222143) |
---|---|
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 221131 2011-04-27 19:32:27Z bz $"); | 34__FBSDID("$FreeBSD: head/sys/netinet/raw_ip.c 222143 2011-05-20 19:12:20Z qingli $"); |
35 36#include "opt_inet.h" 37#include "opt_inet6.h" 38#include "opt_ipsec.h" 39 40#include <sys/param.h> 41#include <sys/jail.h> 42#include <sys/kernel.h> --- 16 unchanged lines hidden (view full) --- 59#include <net/if.h> 60#include <net/route.h> 61#include <net/vnet.h> 62 63#include <netinet/in.h> 64#include <netinet/in_systm.h> 65#include <netinet/in_pcb.h> 66#include <netinet/in_var.h> | 35 36#include "opt_inet.h" 37#include "opt_inet6.h" 38#include "opt_ipsec.h" 39 40#include <sys/param.h> 41#include <sys/jail.h> 42#include <sys/kernel.h> --- 16 unchanged lines hidden (view full) --- 59#include <net/if.h> 60#include <net/route.h> 61#include <net/vnet.h> 62 63#include <netinet/in.h> 64#include <netinet/in_systm.h> 65#include <netinet/in_pcb.h> 66#include <netinet/in_var.h> |
67#include <netinet/if_ether.h> |
|
67#include <netinet/ip.h> 68#include <netinet/ip_var.h> 69#include <netinet/ip_mroute.h> 70 71#ifdef IPSEC 72#include <netipsec/ipsec.h> 73#endif /*IPSEC*/ 74 --- 641 unchanged lines hidden (view full) --- 716 TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { 717 if (ia->ia_ifa.ifa_addr == sa 718 && (ia->ia_flags & IFA_ROUTE)) { 719 ifa_ref(&ia->ia_ifa); 720 IN_IFADDR_RUNLOCK(); 721 /* 722 * in_ifscrub kills the interface route. 723 */ | 68#include <netinet/ip.h> 69#include <netinet/ip_var.h> 70#include <netinet/ip_mroute.h> 71 72#ifdef IPSEC 73#include <netipsec/ipsec.h> 74#endif /*IPSEC*/ 75 --- 641 unchanged lines hidden (view full) --- 717 TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { 718 if (ia->ia_ifa.ifa_addr == sa 719 && (ia->ia_flags & IFA_ROUTE)) { 720 ifa_ref(&ia->ia_ifa); 721 IN_IFADDR_RUNLOCK(); 722 /* 723 * in_ifscrub kills the interface route. 724 */ |
724 in_ifscrub(ia->ia_ifp, ia); | 725 in_ifscrub(ia->ia_ifp, ia, 0); |
725 /* 726 * in_ifadown gets rid of all the rest of the 727 * routes. This is not quite the right thing 728 * to do, but at least if we are running a 729 * routing process they will come back. 730 */ 731 in_ifadown(&ia->ia_ifa, 0); 732 ifa_free(&ia->ia_ifa); --- 18 unchanged lines hidden (view full) --- 751 IN_IFADDR_RUNLOCK(); 752 flags = RTF_UP; 753 ifp = ia->ia_ifa.ifa_ifp; 754 755 if ((ifp->if_flags & IFF_LOOPBACK) 756 || (ifp->if_flags & IFF_POINTOPOINT)) 757 flags |= RTF_HOST; 758 | 726 /* 727 * in_ifadown gets rid of all the rest of the 728 * routes. This is not quite the right thing 729 * to do, but at least if we are running a 730 * routing process they will come back. 731 */ 732 in_ifadown(&ia->ia_ifa, 0); 733 ifa_free(&ia->ia_ifa); --- 18 unchanged lines hidden (view full) --- 752 IN_IFADDR_RUNLOCK(); 753 flags = RTF_UP; 754 ifp = ia->ia_ifa.ifa_ifp; 755 756 if ((ifp->if_flags & IFF_LOOPBACK) 757 || (ifp->if_flags & IFF_POINTOPOINT)) 758 flags |= RTF_HOST; 759 |
760 err = ifa_del_loopback_route((struct ifaddr *)ia, sa); 761 if (err == 0) 762 ia->ia_flags &= ~IFA_RTSELF; 763 |
|
759 err = rtinit(&ia->ia_ifa, RTM_ADD, flags); 760 if (err == 0) 761 ia->ia_flags |= IFA_ROUTE; | 764 err = rtinit(&ia->ia_ifa, RTM_ADD, flags); 765 if (err == 0) 766 ia->ia_flags |= IFA_ROUTE; |
767 |
|
762 err = ifa_add_loopback_route((struct ifaddr *)ia, sa); 763 if (err == 0) 764 ia->ia_flags |= IFA_RTSELF; | 768 err = ifa_add_loopback_route((struct ifaddr *)ia, sa); 769 if (err == 0) 770 ia->ia_flags |= IFA_RTSELF; |
771 |
|
765 ifa_free(&ia->ia_ifa); 766 break; 767 } 768} 769 770static int 771rip_attach(struct socket *so, int proto, struct thread *td) 772{ --- 345 unchanged lines hidden --- | 772 ifa_free(&ia->ia_ifa); 773 break; 774 } 775} 776 777static int 778rip_attach(struct socket *so, int proto, struct thread *td) 779{ --- 345 unchanged lines hidden --- |