fix LP64 issue in routing socket manipulation.
make behavior of -A safer. (sync with kame)
This commit is contained in:
parent
8f4fec9c36
commit
7ec2457fd9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=64631
@ -1,5 +1,5 @@
|
||||
/* $FreeBSD$ */
|
||||
/* $KAME: route6d.c,v 1.30 2000/06/04 06:48:03 itojun Exp $ */
|
||||
/* $KAME: route6d.c,v 1.35 2000/08/13 00:39:44 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char _rcsid[] = "$KAME: route6d.c,v 1.30 2000/06/04 06:48:03 itojun Exp $";
|
||||
static char _rcsid[] = "$KAME: route6d.c,v 1.35 2000/08/13 00:39:44 itojun Exp $";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
@ -2251,7 +2251,7 @@ rt_entry(rtm, again)
|
||||
if ((rtm->rtm_addrs & RTA_DST) == 0)
|
||||
return; /* ignore routes without destination address */
|
||||
sin6_dst = (struct sockaddr_in6 *)rtmp;
|
||||
rtmp += sin6_dst->sin6_len;
|
||||
rtmp += ROUNDUP(sin6_dst->sin6_len);
|
||||
if (rtm->rtm_addrs & RTA_GATEWAY) {
|
||||
sin6_gw = (struct sockaddr_in6 *)rtmp;
|
||||
rtmp += ROUNDUP(sin6_gw->sin6_len);
|
||||
@ -2724,7 +2724,9 @@ filterconfig()
|
||||
struct iff ftmp, *iff_obj;
|
||||
struct ifc *ifcp;
|
||||
struct riprt *rrt;
|
||||
#if 0
|
||||
struct in6_addr gw;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < nfilter; i++) {
|
||||
ap = filter[i];
|
||||
@ -2783,6 +2785,24 @@ filterconfig()
|
||||
rrt->rrt_rflags = RRTF_AGGREGATE;
|
||||
rrt->rrt_t = 0;
|
||||
rrt->rrt_index = loopifindex;
|
||||
#if 0
|
||||
if (getroute(&rrt->rrt_info, &gw)) {
|
||||
#if 0
|
||||
/*
|
||||
* When the address has already been registered in the
|
||||
* kernel routing table, it should be removed
|
||||
*/
|
||||
delroute(&rrt->rrt_info, &gw);
|
||||
#else
|
||||
/* it is more safe behavior */
|
||||
errno = EINVAL;
|
||||
fatal("%s/%u already in routing table, "
|
||||
"cannot aggregate",
|
||||
inet6_n2p(&rrt->rrt_info.rip6_dest),
|
||||
rrt->rrt_info.rip6_plen);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
/* Put the route to the list */
|
||||
rrt->rrt_next = riprt;
|
||||
riprt = rrt;
|
||||
@ -2792,13 +2812,6 @@ filterconfig()
|
||||
/* Add this route to the kernel */
|
||||
if (nflag) /* do not modify kernel routing table */
|
||||
continue;
|
||||
if (getroute(&rrt->rrt_info, &gw)) {
|
||||
/*
|
||||
* When the address has already been registered in the
|
||||
* kernel routing table, it should be removed
|
||||
*/
|
||||
delroute(&rrt->rrt_info, &gw);
|
||||
}
|
||||
addroute(rrt, &in6addr_loopback, loopifcp);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user