diff options
author | ume <ume@FreeBSD.org> | 2001-06-11 12:39:29 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2001-06-11 12:39:29 +0000 |
commit | 832f8d224926758a9ae0b23a6b45353e44fbc87a (patch) | |
tree | a79fc7ad2b97862c4a404f352f0211ad93a7b5f1 /usr.sbin/rrenumd/rrenumd.c | |
parent | 2693854b01a52b0395a91322aa3edf926bddff38 (diff) | |
download | FreeBSD-src-832f8d224926758a9ae0b23a6b45353e44fbc87a.zip FreeBSD-src-832f8d224926758a9ae0b23a6b45353e44fbc87a.tar.gz |
Sync with recent KAME.
This work was based on kame-20010528-freebsd43-snap.tgz and some
critical problem after the snap was out were fixed.
There are many many changes since last KAME merge.
TODO:
- The definitions of SADB_* in sys/net/pfkeyv2.h are still different
from RFC2407/IANA assignment because of binary compatibility
issue. It should be fixed under 5-CURRENT.
- ip6po_m member of struct ip6_pktopts is no longer used. But, it
is still there because of binary compatibility issue. It should
be removed under 5-CURRENT.
Reviewed by: itojun
Obtained from: KAME
MFC after: 3 weeks
Diffstat (limited to 'usr.sbin/rrenumd/rrenumd.c')
-rw-r--r-- | usr.sbin/rrenumd/rrenumd.c | 64 |
1 files changed, 46 insertions, 18 deletions
diff --git a/usr.sbin/rrenumd/rrenumd.c b/usr.sbin/rrenumd/rrenumd.c index fa3257d..686a869 100644 --- a/usr.sbin/rrenumd/rrenumd.c +++ b/usr.sbin/rrenumd/rrenumd.c @@ -1,4 +1,4 @@ -/* $KAME$ */ +/* $KAME: rrenumd.c,v 1.20 2000/11/08 02:40:53 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -64,6 +64,8 @@ #define LL_ALLROUTERS "ff02::2" #define SL_ALLROUTERS "ff05::2" +#define RR_MCHLIM_DEFAULT 64 + #ifndef IN6_IS_SCOPE_LINKLOCAL #define IN6_IS_SCOPE_LINKLOCAL(a) \ ((IN6_IS_ADDR_LINKLOCAL(a)) || \ @@ -93,7 +95,30 @@ int with_v4dest, with_v6dest; struct in6_addr prefix; /* ADHOC */ int prefixlen = 64; /* ADHOC */ -extern int parse(FILE **fp); +extern int parse __P((FILE **)); + +static void show_usage __P((void)); +static void init_sin6 __P((struct sockaddr_in6 *, const char *)); +#if 0 +static void join_multi __P((const char *)); +#endif +static void init_globals __P((void)); +static void config __P((FILE **)); +#ifdef IPSEC_POLICY_IPSEC +static void sock6_open __P((struct flags *, char *)); +static void sock4_open __P((struct flags *, char *)); +#else +static void sock6_open __P((struct flags *)); +static void sock4_open __P((struct flags *)); +#endif +static void rrenum_output __P((struct payload_list *, struct dst_list *)); +static void rrenum_snd_eachdst __P((struct payload_list *)); +#if 0 +static void rrenum_snd_fullsequence __P((void)); +#endif +static void rrenum_input __P((int)); +int main __P((int, char *[])); + /* Print usage. Don't call this after daemonized. */ static void @@ -111,7 +136,7 @@ show_usage() exit(1); } -void +static void init_sin6(struct sockaddr_in6 *sin6, const char *addr_ascii) { memset(sin6, 0, sizeof(*sin6)); @@ -122,7 +147,7 @@ init_sin6(struct sockaddr_in6 *sin6, const char *addr_ascii) } #if 0 /* XXX: not necessary ?? */ -void +static void join_multi(const char *addrname) { struct ipv6_mreq mreq; @@ -151,7 +176,7 @@ join_multi(const char *addrname) } #endif -void +static void init_globals() { static struct iovec rcviov; @@ -193,7 +218,7 @@ init_globals() sndmhdr.msg_controllen = sndcmsglen; } -void +static void config(FILE **fpp) { struct payload_list *pl; @@ -236,7 +261,7 @@ config(FILE **fpp) } } -void +static void sock6_open(struct flags *flags #ifdef IPSEC_POLICY_IPSEC , char *policy @@ -297,7 +322,7 @@ sock6_open(struct flags *flags /* XXX should handle in/out bound policy. */ if (setsockopt(s6, IPPROTO_IPV6, IPV6_IPSEC_POLICY, buf, ipsec_get_policylen(buf)) < 0) - err(1, NULL); + err(1, "setsockopt(IPV6_IPSEC_POLICY)"); free(buf); } #else /* IPSEC_POLICY_IPSEC */ @@ -325,7 +350,7 @@ sock6_open(struct flags *flags return; } -void +static void sock4_open(struct flags *flags #ifdef IPSEC_POLICY_IPSEC , char *policy @@ -363,7 +388,7 @@ sock4_open(struct flags *flags /* XXX should handle in/out bound policy. */ if (setsockopt(s4, IPPROTO_IP, IP_IPSEC_POLICY, buf, ipsec_get_policylen(buf)) < 0) - err(1, NULL); + err(1, "setsockopt(IP_IPSEC_POLICY)"); free(buf); } #else /* IPSEC_POLICY_IPSEC */ @@ -391,7 +416,7 @@ sock4_open(struct flags *flags return; } -void +static void rrenum_output(struct payload_list *pl, struct dst_list *dl) { int i, msglen = 0; @@ -404,8 +429,8 @@ rrenum_output(struct payload_list *pl, struct dst_list *dl) sin6 = (struct sockaddr_in6 *)dl->dl_dst; if (sin6 != NULL && - IN6_IS_SCOPE_LINKLOCAL(&sin6->sin6_addr)) { - int hoplimit = 255; + IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) { + int hoplimit = RR_MCHLIM_DEFAULT; cm = CMSG_FIRSTHDR(&sndmhdr); /* specify the outgoing interface */ @@ -438,7 +463,7 @@ rrenum_output(struct payload_list *pl, struct dst_list *dl) strerror(errno)); } -void +static void rrenum_snd_eachdst(struct payload_list *pl) { struct dst_list *dl; @@ -448,7 +473,8 @@ rrenum_snd_eachdst(struct payload_list *pl) } } -void +#if 0 +static void rrenum_snd_fullsequence() { struct payload_list *pl; @@ -457,8 +483,9 @@ rrenum_snd_fullsequence() rrenum_snd_eachdst(pl); } } +#endif -void +static void rrenum_input(int s) { int i; @@ -603,9 +630,8 @@ main(int argc, char *argv[]) /* ADHOC: timeout each 30seconds */ memset(&timeout, 0, sizeof(timeout)); - timeout.tv_sec = 30; - /* init temporal payload_list and send_counter*/ + /* init temporary payload_list and send_counter*/ pl = pl_head; send_counter = retry + 1; while (1) { @@ -622,7 +648,9 @@ main(int argc, char *argv[]) exit(0); rrenum_snd_eachdst(pl); send_counter--; + timeout.tv_sec = 30; if (send_counter == 0) { + timeout.tv_sec = 0; pl = pl->pl_next; send_counter = retry + 1; } |