Router Discovery from Sun Microsystems

This commit is contained in:
Paul Traina 1994-09-30 21:16:09 +00:00
parent bafea7d8a3
commit 109f505bfb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/cvs2svn/branches/SUN/; revision=3248
4 changed files with 1813 additions and 0 deletions

27
sbin/rdisc/DISCLAIMER Normal file
View File

@ -0,0 +1,27 @@
/*
* Rdisc (this program) was developed by Sun Microsystems, Inc. and is
* provided for unrestricted use provided that this legend is included on
* all tape media and as a part of the software program in whole or part.
* Users may copy or modify Rdisc without charge, and they may freely
* distribute it.
*
* RDISC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Rdisc is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY RDISC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/

191
sbin/rdisc/rdisc.8 Normal file
View File

@ -0,0 +1,191 @@
.\" @(#)in.rdisc.8c 1.4 91/10/21 SMI
'\"macro stdmacro
.\"
.\" Rdisc (this program) was developed by Sun Microsystems, Inc. and is
.\" provided for unrestricted use provided that this legend is included on
.\" all tape media and as a part of the software program in whole or part.
.\" Users may copy or modify Rdisc without charge, and they may freely
.\" distribute it.
.\"
.\" RDISC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
.\" WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
.\"
.\" Rdisc is provided with no support and without any obligation on the
.\" part of Sun Microsystems, Inc. to assist in its use, correction,
.\" modification or enhancement.
.\"
.\" SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
.\" INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY RDISC
.\" OR ANY PART THEREOF.
.\"
.\" In no event will Sun Microsystems, Inc. be liable for any lost revenue
.\" or profits or other special, indirect and consequential damages, even if
.\" Sun has been advised of the possibility of such damages.
.\"
.\" Sun Microsystems, Inc.
.\" 2550 Garcia Avenue
.\" Mountain View, California 94043
.\"
.nr X
.TH in.rdisc 8C "2 Oct 1991"
.SH NAME
in.rdisc \- network router discovery daemon
.SH SYNOPSIS
.B in.rdisc
[
.B \-sfa
]
.LP
.B in.rdisc
.B \-r
[
.BI \-p " preference"
] [
.BI \-T " interval"
]
.SH DESCRIPTION
.IX "in.rdisc" "" "\fLin.rdisc\fP \(em ICMP router discovery daemon"
.IX "Internet" "ICMP router discovery daemon" "" "ICMP router discovery daemon \(em \fLin.rdisc\fP"
.IX "Internet Control Message Protocol" "See ICMP"
.IX "ICMP" "router discovery daemon" "" "router discovery daemon \(em \fLin.rdisc\fP"
.LP
\f4in.rdisc\f1
implements the
.SM ICMP
router discover protocol.
The first form of the command is used on hosts and the
second form is used on routers.
On a host \f4in.rdisc\f1 is invoked at
boot time to populate the network routing tables with default routes.
On a router it is also invoked at boot time in order to start
advertising the router to all the hosts.
.SS "Host (First Form)"
.PP
On a host \f4in.rdisc\f1
listens on the \f4ALL_HOSTS\f1 (224.0.0.1) multicast address
for \f4ROUTER_ADVERTISE\f1 messages from routers. The received
messages are handled by first ignoring
those listed router addresses with which the host does not share a network.
Among the remaining addresses the ones with the highest preference are selected
as default routers and a default route is entered in the kernel routing
table for each one of them.
.LP
Optionally, \f4in.rdisc\f1 can avoid waiting for routers to announce
themselves by sending out a few \f4ROUTER_SOLICITATION\f1 messages
to the \f4ALL_ROUTERS\f1 (224.0.0.2) multicast address when it is started.
.LP
A timer is associated with each router address and the address will
no longer be considered for inclusion in the the routing tables if the
timer expires before a new
.I advertise
message is received from the router.
The address will also be excluded from consideration if the host receives an
.I advertise
message with the preference being maximally negative.
.SS "Router (Second Form)"
.PP
When
\f4in.rdisc\f1
is started on a router, it uses the
\f4SIOCGIFCONF\f1
.BR ioctl (2)
to find the interfaces configured into the system and it starts
listening on the \f4ALL_ROUTERS\f1 multicast address on all the interfaces
that support multicast.
It sends out
.I advertise
messages to the \f4ALL_HOSTS\f1 multicast address advertising all its
.BM IP
addresses.
A few initial
.I advertise
messages are sent out during the first 30 seconds and after that it will
transmit
.I advertise
messages approximately every 600 seconds.
.LP
When \f4in.rdisc\f1
receives a
.I solicitation
message it sends an
.I advertise
message to the host that sent the
.I solicitation
message.
.LP
When
.B in.rdisc
is terminated by a signal it sends out an
.I advertise
message with the preference being maximally negative.
.br
.ne 1i
.SH OPTIONS
.TP 15
.B \-a
Accept all routers independently of the preference they have in their
.I advertise
messages.
Normally
.B in.rdisc
only accepts (and enters in the kernel routing tables)
the router or routers with the highest preference.
.TP
.B \-f
Run
.B in.rdisc
forever even if no routers are found.
Normally
.B in.rdisc
gives up if it has not received any
.I advertise
message after after soliciting three times,
in which case it exits with a non-zero exit code.
If
.B \-f
is not specified in the first form then
.B \-s
must be specified.
.TP
.BI \-p " preference"
Set the preference transmitted in the
.I solicitation
messages.
The default is zero.
.TP
.B \-r
Act as a router as opposed to a host.
.TP
.B \-s
Send three
.I solicitation
messages initially to quickly discover the routers
when the system is booted.
When
.B \-s
is specified
.B in.rdisc
exits with a non-zero exit code if it can not find any routers.
This can be overridden with the
.B \-f
option.
.TP
.BI \-T " interval"
Set the interval between transmitting the
.I advertise
messages.
The default time is 600 seconds.
.SH "SEE ALSO"
.BR in.routed (8C)
.BR ioctl (2),
.BR icmp (7),
.BR inet (7)
.LP
Deering, S.E.,ed
.RI `` "ICMP Router Discovery Messages" ,''
.SM RFC
1256, Network Information Center,
.SM SRI
International, Menlo Park, Calif.,
September 1991.

1576
sbin/rdisc/rdisc.c Normal file

File diff suppressed because it is too large Load Diff

19
sbin/rdisc/rdisc.h Normal file
View File

@ -0,0 +1,19 @@
/* From net/if.h */
#define IFF_MULTICAST 0x800 /* supports multicast */
/* From netinet/in.h */
#define INADDR_ALLHOSTS_GROUP (u_long)0xe0000001 /* 224.0.0.1 */
#define IP_MULTICAST_IF 0x10 /* set/get IP multicast interface */
#define IP_ADD_MEMBERSHIP 0x13 /* add an IP group membership */
#define IP_MULTICAST_TTL 0x11 /* set/get IP multicast timetolive */
/*
* Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
*/
struct ip_mreq {
struct in_addr imr_multiaddr; /* IP multicast address of group */
struct in_addr imr_interface; /* local IP address of interface */
};