Sync with latest KAME.
Obtained from: KAME
This commit is contained in:
parent
4bf2ee2817
commit
66c44f6a43
@ -17,13 +17,9 @@ PROG= rrenumd
|
||||
SRCS= rrenumd.c parser.y lexer.l
|
||||
YFLAGS+= -d
|
||||
|
||||
CC= gcc
|
||||
|
||||
CFLAGS+= -DINET6 -DIPSEC -I${.OBJDIR}
|
||||
LDADD+= -lipsec -lcompat
|
||||
DPADD+= ${LIBIPSEC} ${LIBCOMPAT}
|
||||
LDADD+= -ll -ly
|
||||
DPADD+= ${LIBL} ${LIBY}
|
||||
LDADD+= -lipsec -lcompat -ll -ly
|
||||
DPADD+= ${LIBIPSEC} ${LIBCOMPAT} ${LIBL} ${LIBY}
|
||||
|
||||
MAN5= rrenumd.conf.5
|
||||
MAN8= rrenumd.8
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $KAME$ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
* All rights reserved.
|
||||
@ -37,11 +39,16 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#if defined(__FreeBSD__) && __FreeBSD__ >= 3
|
||||
#include <net/if_var.h>
|
||||
#endif /* __FreeBSD__ >= 3 */
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_var.h>
|
||||
#include <netinet/icmp6.h>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "y.tab.h"
|
||||
|
||||
int lineno = 1;
|
||||
@ -209,6 +216,15 @@ off {
|
||||
yylval.cs.len = yyleng;
|
||||
return NAME;
|
||||
}
|
||||
{ipv4addr} {
|
||||
memset(&yylval.addr4, 0, sizeof(struct in_addr));
|
||||
if (inet_pton(AF_INET, yytext,
|
||||
&yylval.addr4) == 1) {
|
||||
return IPV4ADDR;
|
||||
} else {
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
{ipv6addr} {
|
||||
memset(&yylval.addr6, 0, sizeof(struct in6_addr));
|
||||
if (inet_pton(AF_INET6, yytext,
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $KAME$ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
* All rights reserved.
|
||||
@ -36,7 +38,9 @@
|
||||
#include <sys/uio.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#if defined(__FreeBSD__) && __FreeBSD__ >= 3
|
||||
#include <net/if_var.h>
|
||||
#endif /* __FreeBSD__ >= 3 */
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_var.h>
|
||||
@ -103,7 +107,7 @@ static void pllist_enqueue __P((struct payload_list *pl_entry));
|
||||
%type <num> lifetime days hours minutes seconds
|
||||
%type <num> decstring
|
||||
%type <num> raf_onlink raf_auto raf_decrvalid raf_decrprefd flag
|
||||
%type <dl> dest_addrs dest_addr sin6
|
||||
%type <dl> dest_addrs dest_addr sin sin6
|
||||
%type <pl> rrenum_statement
|
||||
%type <cs> ifname
|
||||
%type <prefix> prefixval
|
||||
@ -158,7 +162,11 @@ dest_addrs:
|
||||
;
|
||||
|
||||
dest_addr :
|
||||
sin6
|
||||
sin
|
||||
{
|
||||
with_v4dest = 1;
|
||||
}
|
||||
| sin6
|
||||
{
|
||||
with_v6dest = 1;
|
||||
}
|
||||
@ -179,7 +187,7 @@ dest_addr :
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_flags = AI_CANONNAME;
|
||||
hints.ai_family = AF_INET6;
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_RAW;
|
||||
hints.ai_protocol = 0;
|
||||
error = getaddrinfo($1.cp, 0, &hints, &res);
|
||||
@ -200,6 +208,24 @@ dest_addr :
|
||||
}
|
||||
;
|
||||
|
||||
sin:
|
||||
IPV4ADDR
|
||||
{
|
||||
struct sockaddr_in *sin;
|
||||
|
||||
sin = (struct sockaddr_in *)malloc(sizeof(*sin));
|
||||
memset(sin, 0, sizeof(*sin));
|
||||
sin->sin_len = sizeof(*sin);
|
||||
sin->sin_family = AF_INET;
|
||||
sin->sin_addr = $1;
|
||||
|
||||
$$ = (struct dst_list *)
|
||||
malloc(sizeof(struct dst_list));
|
||||
memset($$, 0, sizeof(struct dst_list));
|
||||
$$->dl_dst = (struct sockaddr *)sin;
|
||||
}
|
||||
;
|
||||
|
||||
sin6:
|
||||
IPV6ADDR
|
||||
{
|
||||
@ -427,40 +453,44 @@ use_prefix_values:
|
||||
|
||||
rpu->rpu_vltime = $2;
|
||||
rpu->rpu_pltime = $3;
|
||||
if ($4 == NOSPEC)
|
||||
if ($4 == NOSPEC) {
|
||||
rpu->rpu_ramask &=
|
||||
~ICMP6_RR_PCOUSE_RAFLAGS_ONLINK;
|
||||
else {
|
||||
} else {
|
||||
rpu->rpu_ramask |=
|
||||
ICMP6_RR_PCOUSE_RAFLAGS_ONLINK;
|
||||
if ($4 == ON)
|
||||
if ($4 == ON) {
|
||||
rpu->rpu_raflags |=
|
||||
ICMP6_RR_PCOUSE_RAFLAGS_ONLINK;
|
||||
else
|
||||
} else {
|
||||
rpu->rpu_raflags &=
|
||||
~ICMP6_RR_PCOUSE_RAFLAGS_ONLINK;
|
||||
}
|
||||
if ($5 == NOSPEC)
|
||||
}
|
||||
if ($5 == NOSPEC) {
|
||||
rpu->rpu_ramask &=
|
||||
ICMP6_RR_PCOUSE_RAFLAGS_AUTO;
|
||||
else {
|
||||
} else {
|
||||
rpu->rpu_ramask |=
|
||||
ICMP6_RR_PCOUSE_RAFLAGS_AUTO;
|
||||
if ($5 == ON)
|
||||
if ($5 == ON) {
|
||||
rpu->rpu_raflags |=
|
||||
ICMP6_RR_PCOUSE_RAFLAGS_AUTO;
|
||||
else
|
||||
} else {
|
||||
rpu->rpu_raflags &=
|
||||
~ICMP6_RR_PCOUSE_RAFLAGS_AUTO;
|
||||
}
|
||||
}
|
||||
rpu->rpu_flags = 0;
|
||||
if ($6 == ON)
|
||||
if ($6 == ON) {
|
||||
rpu->rpu_flags |=
|
||||
ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME;
|
||||
if ($7 == ON)
|
||||
}
|
||||
if ($7 == ON) {
|
||||
rpu->rpu_flags |=
|
||||
ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME;
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
keeplen:
|
||||
|
@ -1,3 +1,5 @@
|
||||
.\" $KAME$
|
||||
.\"
|
||||
.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
@ -25,12 +27,11 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $Id: rrenumd.8,v 1.1.1.1 1999/08/08 23:31:38 itojun Exp $
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd Sep 7, 1998
|
||||
.Dt RRENUMD 8
|
||||
.Os KAME
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm rrenumd
|
||||
.Nd router renumbering daemon
|
||||
@ -39,7 +40,6 @@
|
||||
.Oo
|
||||
.Fl c Ar conf_file | Fl s
|
||||
.Oc
|
||||
.Op Fl P Ar policy
|
||||
.Op Fl df
|
||||
.Sh DESCRIPTION
|
||||
.Nm Rrenumd
|
||||
@ -72,13 +72,6 @@ Do not become daemon.
|
||||
.It Fl s
|
||||
Script mode.
|
||||
Configuration information is obtained from standard input.
|
||||
.It Fl P Ar policy
|
||||
.Ar policy
|
||||
specifies IPsec policy for the rrenumd session.
|
||||
For details please refer to
|
||||
.Xr ipsec 4
|
||||
and
|
||||
.Xr ipsec_set_policy 3 .
|
||||
.It Fl c Ar conf_file
|
||||
Specify a configuration file where configuration information is kept.
|
||||
.Sh RETURN VALUES
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $KAME$ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
* All rights reserved.
|
||||
@ -44,11 +46,14 @@
|
||||
#include <netinet/ip6.h>
|
||||
#include <netinet/icmp6.h>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#ifdef IPSEC
|
||||
#include <netinet6/ipsec.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@ -71,6 +76,9 @@ struct flags {
|
||||
#ifdef IPSEC
|
||||
#ifdef IPSEC_POLICY_IPSEC
|
||||
u_long policy : 1;
|
||||
#else /* IPSEC_POLICY_IPSEC */
|
||||
u_long auth : 1;
|
||||
u_long encrypt : 1;
|
||||
#endif /* IPSEC_POLICY_IPSEC */
|
||||
#endif /*IPSEC*/
|
||||
};
|
||||
@ -80,8 +88,8 @@ struct msghdr rcvmhdr;
|
||||
struct sockaddr_in6 from;
|
||||
struct sockaddr_in6 sin6_ll_allrouters;
|
||||
|
||||
int s6;
|
||||
int with_v6dest;
|
||||
int s4, s6;
|
||||
int with_v4dest, with_v6dest;
|
||||
struct in6_addr prefix; /* ADHOC */
|
||||
int prefixlen = 64; /* ADHOC */
|
||||
|
||||
@ -95,6 +103,8 @@ show_usage()
|
||||
#ifdef IPSEC
|
||||
#ifdef IPSEC_POLICY_IPSEC
|
||||
"] [-P policy"
|
||||
#else /* IPSEC_POLICY_IPSEC */
|
||||
"AE"
|
||||
#endif /* IPSEC_POLICY_IPSEC */
|
||||
#endif /* IPSEC */
|
||||
"]\n");
|
||||
@ -111,15 +121,44 @@ init_sin6(struct sockaddr_in6 *sin6, const char *addr_ascii)
|
||||
; /* XXX do something */
|
||||
}
|
||||
|
||||
#if 0 /* XXX: not necessary ?? */
|
||||
void
|
||||
join_multi(const char *addrname)
|
||||
{
|
||||
struct ipv6_mreq mreq;
|
||||
|
||||
if (inet_pton(AF_INET6, addrname, &mreq.ipv6mr_multiaddr.s6_addr)
|
||||
!= 1) {
|
||||
syslog(LOG_ERR, "<%s> inet_pton failed(library bug?)",
|
||||
__FUNCTION__);
|
||||
exit(1);
|
||||
}
|
||||
/* ADHOC: currently join only one */
|
||||
{
|
||||
if ((mreq.ipv6mr_interface = if_nametoindex(ifname)) == 0) {
|
||||
syslog(LOG_ERR, "<%s> ifname %s should be invalid: %s",
|
||||
__FUNCTION__, ifname, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
if (setsockopt(s, IPPROTO_IPV6, IPV6_JOIN_GROUP,
|
||||
&mreq,
|
||||
sizeof(mreq)) < 0) {
|
||||
syslog(LOG_ERR, "<%s> IPV6_JOIN_GROUP on %s: %s",
|
||||
__FUNCTION__, ifname, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
init_globals()
|
||||
{
|
||||
static struct iovec rcviov;
|
||||
static u_char rprdata[4500]; /* maximal MTU of connected links */
|
||||
static u_char rcvcmsgbuf[CMSG_SPACE(sizeof(struct in6_pktinfo)) +
|
||||
CMSG_SPACE(sizeof(int))];
|
||||
static u_char sndcmsgbuf[CMSG_SPACE(sizeof(struct in6_pktinfo)) +
|
||||
CMSG_SPACE(sizeof(int))];
|
||||
static u_char *rcvcmsgbuf = NULL;
|
||||
static u_char *sndcmsgbuf = NULL;
|
||||
int sndcmsglen, rcvcmsglen;
|
||||
|
||||
/* init ll_allrouters */
|
||||
init_sin6(&sin6_ll_allrouters, LL_ALLROUTERS);
|
||||
@ -130,14 +169,28 @@ init_globals()
|
||||
rcvmhdr.msg_namelen = sizeof(struct sockaddr_in6);
|
||||
rcvmhdr.msg_iov = &rcviov;
|
||||
rcvmhdr.msg_iovlen = 1;
|
||||
rcvcmsglen = CMSG_SPACE(sizeof(struct in6_pktinfo)) +
|
||||
CMSG_SPACE(sizeof(int));
|
||||
if (rcvcmsgbuf == NULL &&
|
||||
(rcvcmsgbuf = (u_char *)malloc(rcvcmsglen)) == NULL) {
|
||||
syslog(LOG_ERR, "<%s>: malloc failed", __FUNCTION__);
|
||||
exit(1);
|
||||
}
|
||||
rcvmhdr.msg_control = (caddr_t)rcvcmsgbuf;
|
||||
rcvmhdr.msg_controllen = sizeof(rcvcmsgbuf);
|
||||
rcvmhdr.msg_controllen = rcvcmsglen;
|
||||
|
||||
/* initialize msghdr for sending packets */
|
||||
sndmhdr.msg_namelen = sizeof(struct sockaddr_in6);
|
||||
sndmhdr.msg_iovlen = 1;
|
||||
sndcmsglen = CMSG_SPACE(sizeof(struct in6_pktinfo)) +
|
||||
CMSG_SPACE(sizeof(int));
|
||||
if (sndcmsgbuf == NULL &&
|
||||
(sndcmsgbuf = (u_char *)malloc(sndcmsglen)) == NULL) {
|
||||
syslog(LOG_ERR, "<%s>: malloc failed", __FUNCTION__);
|
||||
exit(1);
|
||||
}
|
||||
sndmhdr.msg_control = (caddr_t)sndcmsgbuf;
|
||||
sndmhdr.msg_controllen = sizeof(sndcmsgbuf);
|
||||
sndmhdr.msg_controllen = sndcmsglen;
|
||||
}
|
||||
|
||||
void
|
||||
@ -191,7 +244,12 @@ sock6_open(struct flags *flags
|
||||
)
|
||||
{
|
||||
struct icmp6_filter filt;
|
||||
int on, optval;
|
||||
int on;
|
||||
#ifdef IPSEC
|
||||
#ifndef IPSEC_POLICY_IPSEC
|
||||
int optval;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (with_v6dest == 0)
|
||||
return;
|
||||
@ -202,7 +260,13 @@ sock6_open(struct flags *flags
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* join all routers multicast addresses, not necessary? */
|
||||
/*
|
||||
* join all routers multicast addresses.
|
||||
*/
|
||||
#if 0 /* XXX: not necessary ?? */
|
||||
join_multi(LL_ALLROUTERS);
|
||||
join_multi(SL_ALLROUTERS);
|
||||
#endif
|
||||
|
||||
/* set icmpv6 filter */
|
||||
ICMP6_FILTER_SETBLOCKALL(&filt);
|
||||
@ -236,6 +300,91 @@ sock6_open(struct flags *flags
|
||||
err(1, NULL);
|
||||
free(buf);
|
||||
}
|
||||
#else /* IPSEC_POLICY_IPSEC */
|
||||
if (flags->auth) {
|
||||
optval = IPSEC_LEVEL_REQUIRE;
|
||||
if (setsockopt(s6, IPPROTO_IPV6, IPV6_AUTH_TRANS_LEVEL,
|
||||
&optval, sizeof(optval)) == -1) {
|
||||
syslog(LOG_ERR, "<%s> IPV6_AUTH_TRANS_LEVEL: %s",
|
||||
__FUNCTION__, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if (flags->encrypt) {
|
||||
optval = IPSEC_LEVEL_REQUIRE;
|
||||
if (setsockopt(s6, IPPROTO_IPV6, IPV6_ESP_TRANS_LEVEL,
|
||||
&optval, sizeof(optval)) == -1) {
|
||||
syslog(LOG_ERR, "<%s> IPV6_ESP_TRANS_LEVEL: %s",
|
||||
__FUNCTION__, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
#endif /* IPSEC_POLICY_IPSEC */
|
||||
#endif /* IPSEC */
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
sock4_open(struct flags *flags
|
||||
#ifdef IPSEC_POLICY_IPSEC
|
||||
, char *policy
|
||||
#endif /* IPSEC_POLICY_IPSEC */
|
||||
)
|
||||
{
|
||||
#ifdef IPSEC
|
||||
#ifndef IPSEC_POLICY_IPSEC
|
||||
int optval;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (with_v4dest == 0)
|
||||
return;
|
||||
if ((s4 = socket(AF_INET, SOCK_RAW, IPPROTO_ICMPV6)) < 0) {
|
||||
syslog(LOG_ERR, "<%s> socket(v4): %s", __FUNCTION__,
|
||||
strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#if 0 /* XXX: not necessary ?? */
|
||||
/*
|
||||
* join all routers multicast addresses.
|
||||
*/
|
||||
some_join_function();
|
||||
#endif
|
||||
|
||||
#ifdef IPSEC
|
||||
#ifdef IPSEC_POLICY_IPSEC
|
||||
if (flags->policy) {
|
||||
char *buf;
|
||||
buf = ipsec_set_policy(policy, strlen(policy));
|
||||
if (buf == NULL)
|
||||
errx(1, ipsec_strerror());
|
||||
/* XXX should handle in/out bound policy. */
|
||||
if (setsockopt(s4, IPPROTO_IP, IP_IPSEC_POLICY,
|
||||
buf, ipsec_get_policylen(buf)) < 0)
|
||||
err(1, NULL);
|
||||
free(buf);
|
||||
}
|
||||
#else /* IPSEC_POLICY_IPSEC */
|
||||
if (flags->auth) {
|
||||
optval = IPSEC_LEVEL_REQUIRE;
|
||||
if (setsockopt(s4, IPPROTO_IP, IP_AUTH_TRANS_LEVEL,
|
||||
&optval, sizeof(optval)) == -1) {
|
||||
syslog(LOG_ERR, "<%s> IP_AUTH_TRANS_LEVEL: %s",
|
||||
__FUNCTION__, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if (flags->encrypt) {
|
||||
optval = IPSEC_LEVEL_REQUIRE;
|
||||
if (setsockopt(s4, IPPROTO_IP, IP_ESP_TRANS_LEVEL,
|
||||
&optval, sizeof(optval)) == -1) {
|
||||
syslog(LOG_ERR, "<%s> IP_ESP_TRANS_LEVEL: %s",
|
||||
__FUNCTION__, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
#endif /* IPSEC_POLICY_IPSEC */
|
||||
#endif /* IPSEC */
|
||||
|
||||
@ -248,7 +397,6 @@ rrenum_output(struct payload_list *pl, struct dst_list *dl)
|
||||
int i, msglen = 0;
|
||||
struct cmsghdr *cm;
|
||||
struct in6_pktinfo *pi;
|
||||
struct icmp6_router_renum *rr;
|
||||
struct sockaddr_in6 *sin6 = NULL;
|
||||
|
||||
sndmhdr.msg_name = (caddr_t)dl->dl_dst;
|
||||
@ -267,7 +415,7 @@ rrenum_output(struct payload_list *pl, struct dst_list *dl)
|
||||
pi = (struct in6_pktinfo *)CMSG_DATA(cm);
|
||||
memset(&pi->ipi6_addr, 0, sizeof(pi->ipi6_addr)); /*XXX*/
|
||||
pi->ipi6_ifindex = sin6->sin6_scope_id;
|
||||
msglen += CMSG_SPACE(sizeof(struct in6_pktinfo));
|
||||
msglen += CMSG_LEN(sizeof(struct in6_pktinfo));
|
||||
|
||||
/* specify the hop limit of the packet if dest is link local */
|
||||
/* not defined by router-renum-05.txt, but maybe its OK */
|
||||
@ -276,14 +424,14 @@ rrenum_output(struct payload_list *pl, struct dst_list *dl)
|
||||
cm->cmsg_type = IPV6_HOPLIMIT;
|
||||
cm->cmsg_len = CMSG_LEN(sizeof(int));
|
||||
memcpy(CMSG_DATA(cm), &hoplimit, sizeof(int));
|
||||
msglen += CMSG_SPACE(sizeof(int));
|
||||
msglen += CMSG_LEN(sizeof(int));
|
||||
}
|
||||
sndmhdr.msg_controllen = msglen;
|
||||
if (sndmhdr.msg_controllen == 0)
|
||||
sndmhdr.msg_control = 0;
|
||||
|
||||
sndmhdr.msg_iov = &pl->pl_sndiov;
|
||||
i = sendmsg(s6, &sndmhdr, 0);
|
||||
i = sendmsg(dl->dl_dst->sa_family == AF_INET ? s4 : s6, &sndmhdr, 0);
|
||||
|
||||
if (i < 0 || i != sndmhdr.msg_iov->iov_len)
|
||||
syslog(LOG_ERR, "<%s> sendmsg: %s", __FUNCTION__,
|
||||
@ -322,11 +470,18 @@ rrenum_input(int s)
|
||||
strerror(errno));
|
||||
return;
|
||||
}
|
||||
if (s == s4)
|
||||
i -= sizeof(struct ip);
|
||||
if (i < sizeof(struct icmp6_router_renum)) {
|
||||
syslog(LOG_ERR, "<%s> packet size(%d) is too short",
|
||||
__FUNCTION__, i);
|
||||
return;
|
||||
}
|
||||
if (s == s4) {
|
||||
struct ip *ip = (struct ip *)rcvmhdr.msg_iov->iov_base;
|
||||
|
||||
rr = (struct icmp6_router_renum *)(ip + 1);
|
||||
} else /* s == s6 */
|
||||
rr = (struct icmp6_router_renum *)rcvmhdr.msg_iov->iov_base;
|
||||
|
||||
switch(rr->rr_code) {
|
||||
@ -337,7 +492,7 @@ rrenum_input(int s)
|
||||
/* TODO: receiving result message */
|
||||
break;
|
||||
default:
|
||||
syslog(LOG_ERR, "<%s> received unknown code %d"
|
||||
syslog(LOG_ERR, "<%s> received unknown code %d",
|
||||
__FUNCTION__, rr->rr_code);
|
||||
break;
|
||||
}
|
||||
@ -346,7 +501,6 @@ rrenum_input(int s)
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char *cfile = NULL;
|
||||
FILE *fp = stdin;
|
||||
fd_set fdset;
|
||||
struct timeval timeout;
|
||||
@ -358,13 +512,15 @@ main(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
memset(&flags, 0, sizeof(flags));
|
||||
openlog(*argv, LOG_PID, LOG_DAEMON);
|
||||
openlog("rrenumd", LOG_PID, LOG_DAEMON);
|
||||
|
||||
/* get options */
|
||||
while ((ch = getopt(argc, argv, "c:sdf"
|
||||
#ifdef IPSEC
|
||||
#ifdef IPSEC_POLICY_IPSEC
|
||||
"P:"
|
||||
"P"
|
||||
#else /* IPSEC_POLICY_IPSEC */
|
||||
"AE"
|
||||
#endif /* IPSEC_POLICY_IPSEC */
|
||||
#endif /* IPSEC */
|
||||
)) != -1){
|
||||
@ -392,6 +548,13 @@ main(int argc, char *argv[])
|
||||
flags.policy = 1;
|
||||
policy = strdup(optarg);
|
||||
break;
|
||||
#else /* IPSEC_POLICY_IPSEC */
|
||||
case 'A':
|
||||
flags.auth = 1;
|
||||
break;
|
||||
case 'E':
|
||||
flags.encrypt = 1;
|
||||
break;
|
||||
#endif /* IPSEC_POLICY_IPSEC */
|
||||
#endif /*IPSEC*/
|
||||
default:
|
||||
@ -415,6 +578,11 @@ main(int argc, char *argv[])
|
||||
sock6_open(&flags
|
||||
#ifdef IPSEC_POLICY_IPSEC
|
||||
, policy
|
||||
#endif /* IPSEC_POLICY_IPSEC */
|
||||
);
|
||||
sock4_open(&flags
|
||||
#ifdef IPSEC_POLICY_IPSEC
|
||||
, policy
|
||||
#endif /* IPSEC_POLICY_IPSEC */
|
||||
);
|
||||
|
||||
@ -427,6 +595,11 @@ main(int argc, char *argv[])
|
||||
if (s6 > maxfd)
|
||||
maxfd = s6;
|
||||
}
|
||||
if (with_v4dest) {
|
||||
FD_SET(s4, &fdset);
|
||||
if (s4 > maxfd)
|
||||
maxfd = s4;
|
||||
}
|
||||
|
||||
/* ADHOC: timeout each 30seconds */
|
||||
memset(&timeout, 0, sizeof(timeout));
|
||||
@ -454,6 +627,8 @@ main(int argc, char *argv[])
|
||||
send_counter = retry + 1;
|
||||
}
|
||||
}
|
||||
if (FD_ISSET(s4, &select_fd))
|
||||
rrenum_input(s4);
|
||||
if (FD_ISSET(s6, &select_fd))
|
||||
rrenum_input(s6);
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
.\" $KAME$
|
||||
.\"
|
||||
.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
@ -25,7 +27,6 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $Id: rrenumd.conf.5,v 1.1.1.1 1999/08/08 23:31:39 itojun Exp $
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd Nov 5, 1998
|
||||
@ -61,8 +62,8 @@ square brackets (`[' and `]') are used to show optional
|
||||
keywords and parameters.
|
||||
The vertical bar (`|') is used to indicate
|
||||
between a choice of optional parameters.
|
||||
Curly braces (`{' and
|
||||
`}') are used to group keywords and parameters when necessary.
|
||||
Parentheses (`(' and
|
||||
`)') are used to group keywords and parameters when necessary.
|
||||
.\"
|
||||
.Sh Interface specification
|
||||
There are some statements that may or have to specify interface.
|
||||
@ -83,8 +84,7 @@ then debugging is enabled,
|
||||
If
|
||||
.Ic off
|
||||
is specified,
|
||||
then debugging is disabled.
|
||||
It is disabled by default.
|
||||
then debugging is disabled. It is disabled by default.
|
||||
.\"
|
||||
.It Ic dest Ar dest-list Op Ar retrycmd ;
|
||||
Specifies destinations to which router renumbering messages should be
|
||||
@ -164,7 +164,7 @@ copied to the starting part of prefixes to be added on
|
||||
.Cm add|change|setglobal
|
||||
command, as decimal bit number.
|
||||
.It Cm keeplen Ar keeplen-val
|
||||
Specify the medium part of
|
||||
Specify the midium part of
|
||||
.Ar use-prefix-val
|
||||
just next to the starting part specified by
|
||||
.Ar use-prefix-len
|
||||
@ -181,8 +181,7 @@ Valid value for
|
||||
.Ar time
|
||||
is decimal seconds number or special format as "d00h00m00s00",
|
||||
where 00 can take any decimal number, and "d" means days, "h" means hours,
|
||||
"m" means minutes, "s" means seconds.
|
||||
And alternatively, special keyword
|
||||
"m" means minutes, "s" means seconds. And alternatively, special keyword
|
||||
"infinity" can be also be specified.
|
||||
.It Cm pltime Ar pltime-val
|
||||
Assign an
|
||||
@ -194,48 +193,38 @@ is same as for
|
||||
.Ar vltime-val .
|
||||
.It Cm raf_onlink Cm on|off
|
||||
Let the prefix to be added to have on-link or off-link nature
|
||||
for the assigned interface.
|
||||
If
|
||||
for the assigned interface. If
|
||||
.Cm on
|
||||
is specified, the prefix have on-link nature.
|
||||
(e.g. the prefix
|
||||
is specified, the prefix have on-link nature. (e.g. the prefix
|
||||
belong to the link) If
|
||||
.Cm off
|
||||
is specified, the prefix have off-link nature.
|
||||
(e.g. the
|
||||
is specified, the prefix have off-link nature. (e.g. the
|
||||
prefix does not belong to the link)
|
||||
.It Cm raf_auto Cm on|off
|
||||
Enable or disable the autonomous address auto configuration
|
||||
for the prefix to be added.
|
||||
If
|
||||
for the prefix to be added. If
|
||||
.Cm on
|
||||
is specified, autonomous address auto configuration is
|
||||
enabled.
|
||||
If
|
||||
enabled. If
|
||||
.Cm off
|
||||
is specified, it is disabled.
|
||||
.It Cm rrf_decrprefd Cm on|off
|
||||
Enable or disable the decrementation of the pltime.
|
||||
If
|
||||
Enable or disable the decrementation of the pltime. If
|
||||
.Cm on
|
||||
is specified, decrementation of the pltime is enabled.
|
||||
If
|
||||
is specified, decrementation of the pltime is enabled. If
|
||||
.Cm off
|
||||
is specified, decrementation of the pltime is disabled.
|
||||
.It Cm rrf_decrvalid Cm on|off
|
||||
Enable or disable the decrementation of the vltime.
|
||||
If
|
||||
Enable or disable the decrementation of the vltime. If
|
||||
.Cm on
|
||||
is specified, decrementation of the vltime is enabled.
|
||||
If
|
||||
is specified, decrementation of the vltime is enabled. If
|
||||
.Cm off
|
||||
is specified, decrementation of the vltime is disabled.
|
||||
.El
|
||||
.\"
|
||||
.It seqnum Ar seqnum-val { Ar rrenum-cmd } ;
|
||||
Specifies contents of sending router renumbering message with some
|
||||
specific seqnum.
|
||||
Multiple of this statement can be specified if they
|
||||
specific seqnum. Multiple of this statement can be specified if they
|
||||
have different
|
||||
.Ar seqnum-val
|
||||
each other.
|
||||
@ -246,11 +235,10 @@ has just same syntax with above add|change|setglobal statement.
|
||||
.Sh EXAMPLE
|
||||
For each configuration file example shown below, we suppose
|
||||
every IPv6 subnet has its own prefix beginning with
|
||||
fec0:0:0::/48 and with its own subnet number.
|
||||
(in this case,
|
||||
fec0:0:0::/48 and with its own subnet number. (in this case,
|
||||
subnet number is 7th and 8th octet value of the prefix)
|
||||
.Pp
|
||||
If you want to assign prefixes beginning with fec0:1:1::/48
|
||||
If you want to assigne prefixes beginning with fec0:1:1::/48
|
||||
to each subnet, then following configuration will be enough,
|
||||
if each of your routers supports IPv6 multicast forwarding.
|
||||
The subnet number of the existing fec0:0:0::/48 prefix and the
|
||||
@ -278,11 +266,10 @@ add match-prefix fec0:0:0:: /48 use-prefix fec0:1:1:: /48 keeplen 16;
|
||||
If you are going to do renumbering, then following procedure will be natural.
|
||||
.Bl -enum -offset indent
|
||||
.It
|
||||
Assign new prefix.
|
||||
Assigne new prefix.
|
||||
.It
|
||||
Set old prefix lifetimes to some appropriate transition
|
||||
period.
|
||||
In the followng example we use 1 week for valid
|
||||
period. In the followng example we use 1 week for valid
|
||||
lifetime, and 0 for preferred lifetime.
|
||||
Also, enable old prefix lifetime expiration.
|
||||
(By default, it is static and does not expire)
|
||||
@ -334,7 +321,7 @@ command is almost same with
|
||||
command except that it deletes all pre-defined IPv6 global address.
|
||||
|
||||
.Sh SEE ALSO
|
||||
.Xr rrenumd 8 ,
|
||||
.Xr rrenumd 8
|
||||
.Xr prefix 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $KAME$ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1998 WIDE Project.
|
||||
* All rights reserved.
|
||||
@ -43,7 +45,8 @@ extern struct dst_list *dl_head;
|
||||
struct payload_list {
|
||||
struct payload_list * pl_next;
|
||||
struct iovec pl_sndiov;
|
||||
struct icmp6_router_renum pl_irr;
|
||||
struct icmp6_router_renum
|
||||
pl_irr;
|
||||
struct rr_pco_match pl_rpm;
|
||||
/* currently, support only 1 rr_pco_use field per packet */
|
||||
struct rr_pco_use pl_rpu;
|
||||
|
Loading…
x
Reference in New Issue
Block a user