Deleted Added
full compact
rtsock.c (108124) rtsock.c (108172)
1/*
2 * Copyright (c) 1988, 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

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)rtsock.c 8.7 (Berkeley) 10/12/95
1/*
2 * Copyright (c) 1988, 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

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)rtsock.c 8.7 (Berkeley) 10/12/95
34 * $FreeBSD: head/sys/net/rtsock.c 108124 2002-12-20 11:21:07Z hsu $
34 * $FreeBSD: head/sys/net/rtsock.c 108172 2002-12-22 05:35:03Z hsu $
35 */
36
37
38#include <sys/param.h>
39#include <sys/domain.h>
40#include <sys/kernel.h>
41#include <sys/jail.h>
42#include <sys/malloc.h>

--- 366 unchanged lines hidden (view full) ---

409 rtm->rtm_rmx = rt->rt_rmx;
410 rtm->rtm_addrs = info.rti_addrs;
411 break;
412
413 case RTM_CHANGE:
414 /* new gateway could require new ifaddr, ifp;
415 flags may also be different; ifp may be specified
416 by ll sockaddr when protocol address is ambiguous */
35 */
36
37
38#include <sys/param.h>
39#include <sys/domain.h>
40#include <sys/kernel.h>
41#include <sys/jail.h>
42#include <sys/malloc.h>

--- 366 unchanged lines hidden (view full) ---

409 rtm->rtm_rmx = rt->rt_rmx;
410 rtm->rtm_addrs = info.rti_addrs;
411 break;
412
413 case RTM_CHANGE:
414 /* new gateway could require new ifaddr, ifp;
415 flags may also be different; ifp may be specified
416 by ll sockaddr when protocol address is ambiguous */
417#define equal(a1, a2) (bcmp((caddr_t)(a1), (caddr_t)(a2), (a1)->sa_len) == 0)
417/* compare two sockaddr structures */
418#define sa_equal(a1, a2) (bcmp((a1), (a2), (a1)->sa_len) == 0)
418 if ((rt->rt_flags & RTF_GATEWAY && gate != NULL) ||
419 ifpaddr != NULL ||
420 (ifaaddr != NULL &&
419 if ((rt->rt_flags & RTF_GATEWAY && gate != NULL) ||
420 ifpaddr != NULL ||
421 (ifaaddr != NULL &&
421 !equal(ifaaddr, rt->rt_ifa->ifa_addr))) {
422 !sa_equal(ifaaddr, rt->rt_ifa->ifa_addr))) {
422 if ((error = rt_getifa(&info)) != 0)
423 senderr(error);
424 }
425 if (gate != NULL &&
426 (error = rt_setgate(rt, rt_key(rt), gate)) != 0)
427 senderr(error);
428 if ((ifa = info.rti_ifa) != NULL) {
429 register struct ifaddr *oifa = rt->rt_ifa;

--- 511 unchanged lines hidden (view full) ---

941 register struct walkarg *w;
942{
943 register struct ifnet *ifp;
944 register struct ifaddr *ifa;
945 struct rt_addrinfo info;
946 int len, error = 0;
947
948 bzero((caddr_t)&info, sizeof(info));
423 if ((error = rt_getifa(&info)) != 0)
424 senderr(error);
425 }
426 if (gate != NULL &&
427 (error = rt_setgate(rt, rt_key(rt), gate)) != 0)
428 senderr(error);
429 if ((ifa = info.rti_ifa) != NULL) {
430 register struct ifaddr *oifa = rt->rt_ifa;

--- 511 unchanged lines hidden (view full) ---

942 register struct walkarg *w;
943{
944 register struct ifnet *ifp;
945 register struct ifaddr *ifa;
946 struct rt_addrinfo info;
947 int len, error = 0;
948
949 bzero((caddr_t)&info, sizeof(info));
950 /* IFNET_RLOCK(); */ /* could sleep XXX */
949 TAILQ_FOREACH(ifp, &ifnet, if_link) {
950 if (w->w_arg && w->w_arg != ifp->if_index)
951 continue;
952 ifa = TAILQ_FIRST(&ifp->if_addrhead);
953 ifpaddr = ifa->ifa_addr;
954 len = rt_msg2(RTM_IFINFO, &info, (caddr_t)0, w);
955 ifpaddr = 0;
956 if (w->w_req && w->w_tmem) {

--- 29 unchanged lines hidden (view full) ---

986 error = SYSCTL_OUT(w->w_req, w->w_tmem, len);
987 if (error)
988 goto done;
989 }
990 }
991 ifaaddr = netmask = brdaddr = 0;
992 }
993done:
951 TAILQ_FOREACH(ifp, &ifnet, if_link) {
952 if (w->w_arg && w->w_arg != ifp->if_index)
953 continue;
954 ifa = TAILQ_FIRST(&ifp->if_addrhead);
955 ifpaddr = ifa->ifa_addr;
956 len = rt_msg2(RTM_IFINFO, &info, (caddr_t)0, w);
957 ifpaddr = 0;
958 if (w->w_req && w->w_tmem) {

--- 29 unchanged lines hidden (view full) ---

988 error = SYSCTL_OUT(w->w_req, w->w_tmem, len);
989 if (error)
990 goto done;
991 }
992 }
993 ifaaddr = netmask = brdaddr = 0;
994 }
995done:
996 /* IFNET_RUNLOCK(); */ /* XXX */
994 return (error);
995}
996
997static int
998sysctl_rtsock(SYSCTL_HANDLER_ARGS)
999{
1000 int *name = (int *)arg1;
1001 u_int namelen = arg2;

--- 60 unchanged lines hidden ---
997 return (error);
998}
999
1000static int
1001sysctl_rtsock(SYSCTL_HANDLER_ARGS)
1002{
1003 int *name = (int *)arg1;
1004 u_int namelen = arg2;

--- 60 unchanged lines hidden ---