route6d: RIPng daemon (similar to route6d)
rip6query: RIPng query (similar to ripquery) NOTE: we usually do not run route6d on end nodes at startup (rtsol should do the trick). So I figured that route6d can be in /usr/sbin, not in /sbin (routed is in /sbin). Correct me if I'm wrong.
This commit is contained in:
parent
c282889c17
commit
bfa86f1cc9
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.114 1999/07/02 09:28:16 itojun Exp $
|
||||
# $NetBSD: Makefile,v 1.115 1999/07/02 11:47:12 itojun Exp $
|
||||
# from: @(#)Makefile 5.20 (Berkeley) 6/12/93
|
||||
|
||||
# XXX Temporary for NO_SENDMAIL and BUILD_POSTFIX
|
||||
@ -22,7 +22,7 @@ SUBDIR= ac accton amd apm apmd arp bad144 bind bootp catman \
|
||||
zdump zic
|
||||
|
||||
# IPv6
|
||||
SUBDIR+=gifconfig ifmcstat ndp rtadvd traceroute6
|
||||
SUBDIR+=gifconfig ifmcstat ndp rip6query route6d rtadvd traceroute6
|
||||
|
||||
.if !defined(NO_SENDMAIL)
|
||||
SUBDIR+= sendmail
|
||||
|
8
usr.sbin/rip6query/Makefile
Normal file
8
usr.sbin/rip6query/Makefile
Normal file
@ -0,0 +1,8 @@
|
||||
# $NetBSD: Makefile,v 1.1 1999/07/02 11:47:12 itojun Exp $
|
||||
|
||||
PROG= rip6query
|
||||
NOMAN= yes
|
||||
|
||||
CPPFLAGS+= -DINET6 -I${.CURDIR}/../route6d
|
||||
|
||||
.include <bsd.prog.mk>
|
146
usr.sbin/rip6query/rip6query.c
Normal file
146
usr.sbin/rip6query/rip6query.c
Normal file
@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.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 <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include "route6d.h"
|
||||
|
||||
int s;
|
||||
extern int errno;
|
||||
struct sockaddr_in6 sin6;
|
||||
struct rip6 *ripbuf;
|
||||
|
||||
#define RIPSIZE(n) (sizeof(struct rip6) + (n-1) * sizeof(struct netinfo6))
|
||||
|
||||
int main __P((int, char **));
|
||||
void fatal __P((char *));
|
||||
const char *inet6_n2a __P((struct in6_addr *));
|
||||
|
||||
int main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
struct netinfo6 *np;
|
||||
struct sockaddr_in6 fsock;
|
||||
struct hostent *hp;
|
||||
char *hostname;
|
||||
int i, n, len, flen;
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "Usage: %s address\n", *argv);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
|
||||
fatal("socket");
|
||||
|
||||
hp = (struct hostent *)gethostbyname2(argv[1], AF_INET6);
|
||||
if (hp == NULL) {
|
||||
if (inet_pton(AF_INET6, argv[1], (u_int32_t *)&sin6.sin6_addr)
|
||||
!= 1) {
|
||||
fprintf(stderr, "%s: unknown host %s\n",
|
||||
argv[0], argv[1]);
|
||||
exit(-1);
|
||||
}
|
||||
} else {
|
||||
bcopy(hp->h_addr, (caddr_t)&sin6.sin6_addr, hp->h_length);
|
||||
hostname = strdup(hp->h_name);
|
||||
}
|
||||
|
||||
sin6.sin6_len = sizeof(struct sockaddr_in6);
|
||||
sin6.sin6_family = AF_INET6;
|
||||
sin6.sin6_port = htons(RIP6_PORT);
|
||||
|
||||
if ((ripbuf = (struct rip6 *)malloc(BUFSIZ)) == NULL)
|
||||
fatal("malloc");
|
||||
ripbuf->rip6_cmd = RIP6_REQUEST;
|
||||
ripbuf->rip6_vers = RIP6_VERSION;
|
||||
ripbuf->rip6_res1[0] = 0;
|
||||
ripbuf->rip6_res1[1] = 0;
|
||||
np = ripbuf->rip6_nets;
|
||||
bzero(&np->rip6_dest, sizeof(struct in6_addr));
|
||||
np->rip6_tag = 0;
|
||||
np->rip6_plen = 0;
|
||||
np->rip6_metric = HOPCNT_INFINITY6;
|
||||
if (sendto(s, ripbuf, RIPSIZE(1), 0,
|
||||
(struct sockaddr *)&sin6, sizeof(struct sockaddr_in6)) < 0)
|
||||
fatal("send");
|
||||
do {
|
||||
flen = sizeof(struct sockaddr_in6);
|
||||
if ((len = recvfrom(s, ripbuf, BUFSIZ, 0,
|
||||
(struct sockaddr *)&fsock, &flen)) < 0)
|
||||
fatal("recvfrom");
|
||||
printf("Response from %s len %d\n",
|
||||
inet6_n2a(&fsock.sin6_addr), len);
|
||||
n = (len - sizeof(struct rip6) + sizeof(struct netinfo6)) /
|
||||
sizeof(struct netinfo6);
|
||||
np = ripbuf->rip6_nets;
|
||||
for (i = 0; i < n; i++, np++) {
|
||||
printf("\t%s/%d [%d]", inet6_n2a(&np->rip6_dest),
|
||||
np->rip6_plen, np->rip6_metric);
|
||||
if (np->rip6_tag)
|
||||
printf(" tag=0x%x", ntohs(np->rip6_tag));
|
||||
printf("\n");
|
||||
}
|
||||
} while (len == RIPSIZE(24));
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void fatal(p)
|
||||
char *p;
|
||||
{
|
||||
fprintf(stderr, "%s: %s", p, strerror(errno));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
const char *inet6_n2a(p)
|
||||
struct in6_addr *p;
|
||||
{
|
||||
static char buf[BUFSIZ];
|
||||
|
||||
return inet_ntop(AF_INET6, (u_int32_t *)p, buf, sizeof(buf));
|
||||
}
|
8
usr.sbin/route6d/Makefile
Normal file
8
usr.sbin/route6d/Makefile
Normal file
@ -0,0 +1,8 @@
|
||||
# $NetBSD: Makefile,v 1.1 1999/07/02 11:47:12 itojun Exp $
|
||||
|
||||
PROG= route6d
|
||||
MAN= route6d.8
|
||||
|
||||
CPPFLAGS+= -Dss_len=__ss_len -Dss_family=__ss_family -DADVAPI -DINET6
|
||||
|
||||
.include <bsd.prog.mk>
|
231
usr.sbin/route6d/route6d.8
Normal file
231
usr.sbin/route6d/route6d.8
Normal file
@ -0,0 +1,231 @@
|
||||
.\" Copyright (c) 1996 WIDE Project. All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modifications, are permitted provided that the above copyright notice
|
||||
.\" and this paragraph are duplicated in all such forms and that any
|
||||
.\" documentation, advertising materials, and other materials related to
|
||||
.\" such distribution and use acknowledge that the software was developed
|
||||
.\" by the WIDE Project, Japan. The name of the Project may not be used to
|
||||
.\" endorse or promote products derived from this software without
|
||||
.\" specific prior written permission. THIS SOFTWARE IS PROVIDED ``AS IS''
|
||||
.\" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
|
||||
.\" LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
.\" A PARTICULAR PURPOSE.
|
||||
.Dd January 31, 1997
|
||||
.Dt ROUTE6D 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm route6d
|
||||
.Nd RIP6 Routing Daemon
|
||||
.Sh SYNOPSIS
|
||||
.Nm route6d
|
||||
.Op Fl adDhlqsS
|
||||
.Op Fl R Ar routelog
|
||||
.Op Fl A Ar prefix/preflen,if1[,if2...]
|
||||
.Op Fl L Ar prefix/preflen,if1[,if2...]
|
||||
.Op Fl N Ar if1[,if2...]
|
||||
.Op Fl O Ar prefix/preflen,if1[,if2...]
|
||||
.Op Fl T Ar if1[,if2...]
|
||||
.Op Fl t Ar tag
|
||||
.\"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
is a routing daemon which supports RIP over IPv6.
|
||||
.Pp
|
||||
Options are:
|
||||
.Bl -tag -width indent
|
||||
.\"
|
||||
.It Fl a
|
||||
Enables aging of the statically defined routes.
|
||||
With this option, any
|
||||
statically defined routes will be removed unless corresponding updates
|
||||
arrive as if the routes are received at the startup of
|
||||
.Nm route6d .
|
||||
.\"
|
||||
.It Fl R Ar routelog
|
||||
This option makes the
|
||||
.Nm
|
||||
to log the route change (add/delete) to the file
|
||||
.Ar routelog .
|
||||
.\"
|
||||
.It Fl A Ar prefix/preflen,if1[,if2...]
|
||||
This option is used for aggregating routes.
|
||||
.Ar prefix/preflen
|
||||
specifies the prefix and the prefix length of the
|
||||
aggregated route.
|
||||
When advertising routes,
|
||||
.Nm
|
||||
filters specific routes covered by the aggregate,
|
||||
and advertises the aggregated route
|
||||
.Ar prefix/preflen ,
|
||||
to the interfaces specified in the comma-separated interface list,
|
||||
.Ar if1[,if2...] .
|
||||
.Nm
|
||||
creates a static route to
|
||||
.Ar prefix/preflen
|
||||
with
|
||||
.Dv RTF_REJECT
|
||||
flag, into the kernel routing table.
|
||||
.\"
|
||||
.It Fl d
|
||||
Enables output of debugging message.
|
||||
This option also instructs
|
||||
.Nm
|
||||
to run in foreground mode
|
||||
.Pq does not become daemon .
|
||||
.\"
|
||||
.It Fl D
|
||||
Enables extensive output of debugging message.
|
||||
This option also instructs
|
||||
.Nm
|
||||
to run in foreground mode
|
||||
.Pq does not become daemon .
|
||||
.\"
|
||||
.It Fl h
|
||||
Disables the split horizon processing.
|
||||
.\"
|
||||
.It Fl l
|
||||
By default,
|
||||
.Nm
|
||||
will not exchange site local routes for safety reasons.
|
||||
This is because semantics of site local address space is rather vague,
|
||||
and there is no good way to define site local boundary.
|
||||
With
|
||||
.Fl l
|
||||
option,
|
||||
.Nm
|
||||
will exchange site local routes as well.
|
||||
It must not be used on site boundary routers,
|
||||
since
|
||||
.Fl l
|
||||
option assumes that all interfaces are in the same site.
|
||||
.\"
|
||||
.It Fl L Ar prefix/preflen,if1[,if2...]
|
||||
Filter incoming routes from interfaces
|
||||
.Ar if1,[if2...] .
|
||||
.Nm
|
||||
will accept incoming routes that are in
|
||||
.Ar prefix/preflen .
|
||||
If multiple
|
||||
.Fl L
|
||||
options are specified, any routes that match one of the options is accepted.
|
||||
.Li ::/0
|
||||
is treated specially as default route, not
|
||||
.Do
|
||||
any route that has longer prefix length than, or equal to 0
|
||||
.Dc .
|
||||
If you would like to accept any route, specify no
|
||||
.Fl L
|
||||
option.
|
||||
For example, with
|
||||
.Do
|
||||
.Fl L
|
||||
.Li 3ffe::/16,if1
|
||||
.Fl L
|
||||
.Li ::/0,if1
|
||||
.Dc
|
||||
.Nm
|
||||
will accept default route and routes in 6bone test address, but no others.
|
||||
.\"
|
||||
.It Fl N Ar if1[,if2...]
|
||||
Do not listen to, or advertise, route from/to interfaces specified by
|
||||
.Ar if1,[if2...] .
|
||||
.\"
|
||||
.It Fl O Ar prefix/preflen,if1[,if2...]
|
||||
Restrict route advertisement toward interfaces specified by
|
||||
.Ar if1,[if2...] .
|
||||
With this option
|
||||
.Nm
|
||||
will only advertise routes that is in
|
||||
.Ar prefix/preflen .
|
||||
.\"
|
||||
.It Fl q
|
||||
Makes
|
||||
.Nm
|
||||
in listen-only mode.
|
||||
No advertisement is sent.
|
||||
.\"
|
||||
.It Fl s
|
||||
Makes
|
||||
.Nm
|
||||
to advertise the statically defined routes which exist in the kernel routing
|
||||
table when
|
||||
.Nm
|
||||
invoked.
|
||||
Announcements obey the regular split horizon rule.
|
||||
.\"
|
||||
.It Fl S
|
||||
This option is the same as
|
||||
.Fl s
|
||||
option except that no split horizon rule does apply.
|
||||
.\"
|
||||
.It Fl T Ar if1[,if2...]
|
||||
Advertise only default route, toward
|
||||
.Ar if1,[if2...] .
|
||||
.\"
|
||||
.It Fl t Ar tag
|
||||
Attach route tag
|
||||
.Ar tag
|
||||
to originated route entries.
|
||||
.Ar tag
|
||||
can be decimal, octal prefixed by
|
||||
.Li 0 ,
|
||||
or hexadecimal prefixed by
|
||||
.Li 0x .
|
||||
.\"
|
||||
.El
|
||||
.Pp
|
||||
Upon receipt of signal
|
||||
.Dv SIGINT
|
||||
or
|
||||
.Dv SIGUSR1 ,
|
||||
.Nm
|
||||
will dump the current internal state into
|
||||
.Pa /var/tmp/route6d_dump .
|
||||
.\"
|
||||
.Sh FILES
|
||||
.Bl -tag -width /var/tmp/route6d_dump -compact
|
||||
.It Pa /var/tmp/route6d_dump
|
||||
dumps internal state on
|
||||
.Dv SIGINT
|
||||
or
|
||||
.Dv SIGUSR1
|
||||
.El
|
||||
.\"
|
||||
.Sh SEE ALSO
|
||||
.Rs
|
||||
.%A G. Malkin
|
||||
.%A R. Minnear
|
||||
.%T RIPng for IPv6
|
||||
.%R RFC2080
|
||||
.%D January 1997
|
||||
.Re
|
||||
.\"
|
||||
.Sh NOTE
|
||||
.Nm Route6d
|
||||
uses IPv6 advanced API,
|
||||
defined in RFC2292,
|
||||
for communicating with peers using link-local addresses.
|
||||
.Pp
|
||||
Internally
|
||||
.Nm
|
||||
embeds interface identifier into bit 32 to 63 of link-local addresses
|
||||
.Po
|
||||
.Li fe80::xx
|
||||
and
|
||||
.Li ff02::xx
|
||||
.Pc
|
||||
so they will be visible on internal state dump file
|
||||
.Pq Pa /var/tmp/route6d_dump .
|
||||
.Pp
|
||||
Routing table manipulation differs from IPv6 implementation to implementation.
|
||||
Currently
|
||||
.Nm
|
||||
obeys WIDE Hydrangea/KAME IPv6 kernel,
|
||||
and will not be able to run on other platforms.
|
||||
.Pp
|
||||
Current
|
||||
.Nm
|
||||
does not reduce the rate of the triggered updates when consecutive updates
|
||||
arrive.
|
2822
usr.sbin/route6d/route6d.c
Normal file
2822
usr.sbin/route6d/route6d.c
Normal file
File diff suppressed because it is too large
Load Diff
89
usr.sbin/route6d/route6d.h
Normal file
89
usr.sbin/route6d/route6d.h
Normal file
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* $Header: /cvsroot/src/usr.sbin/route6d/route6d.h,v 1.1 1999/07/02 11:47:12 itojun Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* not yet in use
|
||||
#define ROUTE6D_CONF "/usr/local/v6/etc/route6d.conf"
|
||||
*/
|
||||
|
||||
#define ROUTE6D_DUMP "/var/tmp/route6d_dump"
|
||||
#define ROUTE6D_PID "/var/run/route6d.pid"
|
||||
|
||||
#define RIP6_VERSION 1
|
||||
|
||||
#define RIP6_REQUEST 1
|
||||
#define RIP6_RESPONSE 2
|
||||
|
||||
struct netinfo6 {
|
||||
struct in6_addr rip6_dest;
|
||||
u_short rip6_tag;
|
||||
u_char rip6_plen;
|
||||
u_char rip6_metric;
|
||||
};
|
||||
|
||||
struct rip6 {
|
||||
u_char rip6_cmd;
|
||||
u_char rip6_vers;
|
||||
u_char rip6_res1[2];
|
||||
union {
|
||||
struct netinfo6 ru6_nets[1];
|
||||
char ru6_tracefile[1];
|
||||
} rip6un;
|
||||
#define rip6_nets rip6un.ru6_nets
|
||||
#define rip6_tracefile rip6un.ru6_tracefile
|
||||
};
|
||||
|
||||
#define HOPCNT_INFINITY6 16
|
||||
#define NEXTHOP_METRIC 0xff
|
||||
#define RIP6_MAXMTU 1500
|
||||
|
||||
#define IFMINMTU 576
|
||||
|
||||
#ifndef DEBUG
|
||||
#define SUPPLY_INTERVAL6 30
|
||||
#define RIP_LIFETIME 180
|
||||
#define RIP_HOLDDOWN 120
|
||||
#define RIP_TRIG_INT6_MAX 5
|
||||
#define RIP_TRIG_INT6_MIN 1
|
||||
#else
|
||||
/* only for debugging; can not wait for 30sec to appear a bug */
|
||||
#define SUPPLY_INTERVAL6 10
|
||||
#define RIP_LIFETIME 60
|
||||
#define RIP_HOLDDOWN 40
|
||||
#define RIP_TRIG_INT6_MAX 5
|
||||
#define RIP_TRIG_INT6_MIN 1
|
||||
#endif
|
||||
|
||||
#define RIP6_PORT 521
|
||||
#define RIP6_DEST "ff02::9"
|
||||
|
||||
#define LOOPBACK_IF "lo0"
|
Loading…
Reference in New Issue
Block a user