Latest routed from Vern Schryver. This is supposed to fix
Andrey's rtquery problem. Submitted by: Vernon J. Schryver <vjs@mica.denver.sgi.com>
This commit is contained in:
parent
71965874ee
commit
337e72d0e5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/SGI/dist_v_2_21/; revision=20606 svn path=/vendor/SGI/vjs_961217/; revision=20608; tag=vendor/SGI/vjs_961217
@ -36,7 +36,7 @@
|
||||
*/
|
||||
|
||||
#ifndef __NetBSD__
|
||||
#ident "$Revision: 1.19 $"
|
||||
#ident "$Revision: 1.21 $"
|
||||
#endif
|
||||
|
||||
/* Definitions for RIPv2 routing process.
|
||||
@ -77,6 +77,7 @@
|
||||
#include <stdarg.h>
|
||||
#include <syslog.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/ioctl.h>
|
||||
@ -95,10 +96,6 @@
|
||||
#define RIPVERSION RIPv2
|
||||
#include <protocols/routed.h>
|
||||
|
||||
#ifdef sgi
|
||||
#define USE_PASSIFNAME
|
||||
#endif
|
||||
|
||||
|
||||
/* Type of an IP address.
|
||||
* Some systems do not like to pass structures, so do not use in_addr.
|
||||
|
@ -36,7 +36,7 @@ static char sccsid[] = "@(#)if.c 8.1 (Berkeley) 6/5/93";
|
||||
#elif defined(__NetBSD__)
|
||||
static char rcsid[] = "$NetBSD$";
|
||||
#endif
|
||||
#ident "$Revision: 1.21 $"
|
||||
#ident "$Revision: 1.22 $"
|
||||
|
||||
#include "defs.h"
|
||||
#include "pathnames.h"
|
||||
@ -60,7 +60,7 @@ struct interface *remote_if; /* remote interfaces */
|
||||
|
||||
/* hash for physical interface names.
|
||||
* Assume there are never more 100 or 200 real interfaces, and that
|
||||
* aliases put on the end of the hash chains.
|
||||
* aliases are put on the end of the hash chains.
|
||||
*/
|
||||
#define NHASH_LEN 97
|
||||
struct interface *nhash[NHASH_LEN];
|
||||
@ -71,11 +71,14 @@ int foundloopback; /* valid flag for loopaddr */
|
||||
naddr loopaddr; /* our address on loopback */
|
||||
|
||||
struct timeval ifinit_timer;
|
||||
static struct timeval last_ifinit;
|
||||
|
||||
int have_ripv1_out; /* have a RIPv1 interface */
|
||||
int have_ripv1_in;
|
||||
|
||||
|
||||
/* Link a new interface into the lists and hash tables.
|
||||
*/
|
||||
void
|
||||
if_link(struct interface *ifp)
|
||||
{
|
||||
@ -117,6 +120,7 @@ if_link(struct interface *ifp)
|
||||
i += *p;
|
||||
hifp = &nhash[i % NHASH_LEN];
|
||||
if (ifp->int_state & IS_ALIAS) {
|
||||
/* put aliases on the end of the hash chain */
|
||||
while (*hifp != 0)
|
||||
hifp = &(*hifp)->int_nhash;
|
||||
}
|
||||
@ -176,19 +180,32 @@ ifwithname(char *name, /* "ec0" or whatever */
|
||||
int i;
|
||||
char *p;
|
||||
|
||||
for (i = 0, p = name; *p != '\0'; p++)
|
||||
i += *p;
|
||||
for (ifp = nhash[i % NHASH_LEN]; ifp != 0; ifp = ifp->int_nhash) {
|
||||
/* If the network address is not specified,
|
||||
* ignore any alias interfaces. Otherwise, look
|
||||
* for the interface with the target name and address.
|
||||
for (;;) {
|
||||
for (i = 0, p = name; *p != '\0'; p++)
|
||||
i += *p;
|
||||
ifp = nhash[i % NHASH_LEN];
|
||||
|
||||
while (ifp != 0) {
|
||||
/* If the network address is not specified,
|
||||
* ignore any alias interfaces. Otherwise, look
|
||||
* for the interface with the target name and address.
|
||||
*/
|
||||
if (!strcmp(ifp->int_name, name)
|
||||
&& ((addr == 0 && !(ifp->int_state & IS_ALIAS))
|
||||
|| (ifp->int_addr == addr)))
|
||||
return ifp;
|
||||
ifp = ifp->int_nhash;
|
||||
}
|
||||
|
||||
|
||||
/* If there is no known interface, maybe there is a
|
||||
* new interface. So just once look for new interfaces.
|
||||
*/
|
||||
if (!strcmp(ifp->int_name, name)
|
||||
&& ((addr == 0 && !(ifp->int_state & IS_ALIAS))
|
||||
|| (ifp->int_addr == addr)))
|
||||
return ifp;
|
||||
if (last_ifinit.tv_sec == now.tv_sec
|
||||
&& last_ifinit.tv_usec == now.tv_usec)
|
||||
return 0;
|
||||
ifinit();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -214,7 +231,6 @@ struct interface *
|
||||
iflookup(naddr addr)
|
||||
{
|
||||
struct interface *ifp, *maybe;
|
||||
static struct timeval retried;
|
||||
|
||||
maybe = 0;
|
||||
for (;;) {
|
||||
@ -239,15 +255,14 @@ iflookup(naddr addr)
|
||||
}
|
||||
|
||||
if (maybe != 0
|
||||
|| (retried.tv_sec == now.tv_sec
|
||||
&& retried.tv_usec == now.tv_usec))
|
||||
|| (last_ifinit.tv_sec == now.tv_sec
|
||||
&& last_ifinit.tv_usec == now.tv_usec))
|
||||
return maybe;
|
||||
|
||||
/* If there is no known interface, maybe there is a
|
||||
* new interface. So just once look for new interfaces.
|
||||
*/
|
||||
ifinit();
|
||||
retried = now;
|
||||
}
|
||||
}
|
||||
|
||||
@ -654,6 +669,7 @@ ifinit(void)
|
||||
#endif
|
||||
|
||||
|
||||
last_ifinit = now;
|
||||
ifinit_timer.tv_sec = now.tv_sec + (supplier
|
||||
? CHECK_ACT_INTERVAL
|
||||
: CHECK_QUIET_INTERVAL);
|
||||
|
@ -36,7 +36,7 @@ static char sccsid[] = "@(#)input.c 8.1 (Berkeley) 6/5/93";
|
||||
#elif defined(__NetBSD__)
|
||||
static char rcsid[] = "$NetBSD$";
|
||||
#endif
|
||||
#ident "$Revision: 1.19 $"
|
||||
#ident "$Revision: 1.20 $"
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
@ -103,26 +103,20 @@ read_rip(int sock,
|
||||
if (aifp == 0) {
|
||||
aifp = ifwithname(inbuf.ifname, 0);
|
||||
if (aifp == 0) {
|
||||
/* maybe it is a new interface */
|
||||
ifinit();
|
||||
aifp = ifwithname(inbuf.ifname, 0);
|
||||
if (aifp == 0) {
|
||||
msglim(&bad_name, from.sin_addr.s_addr,
|
||||
"impossible interface name"
|
||||
" %.*s", IFNAMSIZ,
|
||||
inbuf.ifname);
|
||||
}
|
||||
}
|
||||
|
||||
/* If it came via the wrong interface, do not
|
||||
* trust it.
|
||||
*/
|
||||
if (((aifp->int_if_flags & IFF_POINTOPOINT)
|
||||
&& aifp->int_dstaddr != from.sin_addr.s_addr)
|
||||
|| (!(aifp->int_if_flags & IFF_POINTOPOINT)
|
||||
&& !on_net(from.sin_addr.s_addr,
|
||||
aifp->int_net, aifp->int_mask)))
|
||||
msglim(&bad_name, from.sin_addr.s_addr,
|
||||
"impossible interface name %.*s",
|
||||
IFNAMSIZ, inbuf.ifname);
|
||||
} else if (((aifp->int_if_flags & IFF_POINTOPOINT)
|
||||
&& aifp->int_dstaddr!=from.sin_addr.s_addr)
|
||||
|| (!(aifp->int_if_flags & IFF_POINTOPOINT)
|
||||
&& !on_net(from.sin_addr.s_addr,
|
||||
aifp->int_net,
|
||||
aifp->int_mask))) {
|
||||
/* If it came via the wrong interface, do not
|
||||
* trust it.
|
||||
*/
|
||||
aifp = 0;
|
||||
}
|
||||
}
|
||||
#else
|
||||
aifp = iflookup(from.sin_addr.s_addr);
|
||||
|
@ -22,10 +22,10 @@
|
||||
* documentation and/or software.
|
||||
*/
|
||||
|
||||
#ident "$Revision: 1.3 $"
|
||||
#ident "$Revision: 1.4 $"
|
||||
|
||||
#ifdef sgi
|
||||
#include <strings.h>
|
||||
#ifdef sgi
|
||||
#include <bstring.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
|
@ -36,7 +36,7 @@ static char sccsid[] = "@(#)rdisc.c 8.1 (Berkeley) x/y/95";
|
||||
#elif defined(__NetBSD__)
|
||||
static char rcsid[] = "$NetBSD$";
|
||||
#endif
|
||||
#ident "$Revision: 1.19 $"
|
||||
#ident "$Revision: 1.20 $"
|
||||
|
||||
#include "defs.h"
|
||||
#include <netinet/in_systm.h>
|
||||
@ -916,10 +916,12 @@ void
|
||||
read_d(void)
|
||||
{
|
||||
static struct msg_limit bad_asize, bad_len;
|
||||
#ifdef USE_PASSIFNAME
|
||||
static struct msg_limit bad_name;
|
||||
#endif
|
||||
struct sockaddr_in from;
|
||||
int n, fromlen, cc, hlen;
|
||||
struct {
|
||||
#undef USE_PASSIFNAME /* it is too bad it does not work on raw sockets */
|
||||
#ifdef USE_PASSIFNAME
|
||||
char ifname[IFNAMSIZ];
|
||||
#endif
|
||||
@ -961,16 +963,10 @@ read_d(void)
|
||||
|
||||
#ifdef USE_PASSIFNAME
|
||||
ifp = ifwithname(buf.ifname, 0);
|
||||
if (ifp == 0) {
|
||||
/* maybe it is a new interface */
|
||||
ifinit();
|
||||
ifp = ifwithname(buf.ifname, 0);
|
||||
if (ifp == 0) {
|
||||
msglim(&bad_name, from.sin_addr.s_addr,
|
||||
"impossible rdisc if_ name %.*s",
|
||||
IFNAMSIZ, buf.ifname);
|
||||
}
|
||||
}
|
||||
if (ifp == 0)
|
||||
msglim(&bad_name, from.sin_addr.s_addr,
|
||||
"impossible rdisc if_ name %.*s",
|
||||
IFNAMSIZ, buf.ifname);
|
||||
#else
|
||||
/* If we could tell the interface on which a packet from
|
||||
* address 0 arrived, we could deal with such solicitations.
|
||||
@ -978,15 +974,13 @@ read_d(void)
|
||||
ifp = ((from.sin_addr.s_addr == 0)
|
||||
? 0 : iflookup(from.sin_addr.s_addr));
|
||||
#endif
|
||||
ifp = ck_icmp("Recv",
|
||||
from.sin_addr.s_addr, ifp,
|
||||
buf.pkt.ip.ip_dst.s_addr,
|
||||
p, cc);
|
||||
ifp = ck_icmp("Recv", from.sin_addr.s_addr, ifp,
|
||||
buf.pkt.ip.ip_dst.s_addr, p, cc);
|
||||
if (ifp == 0)
|
||||
continue;
|
||||
if (ifwithaddr(from.sin_addr.s_addr, 0, 0)) {
|
||||
trace_pkt(" discard our own Router Discovery"
|
||||
" message");
|
||||
trace_pkt(" "
|
||||
"discard our own Router Discovery message");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -22,10 +22,10 @@
|
||||
* documentation and/or software.
|
||||
*/
|
||||
|
||||
#ident "$Revision: 1.3 $"
|
||||
#ident "$Revision: 1.4 $"
|
||||
|
||||
#ifdef sgi
|
||||
#include <strings.h>
|
||||
#ifdef sgi
|
||||
#include <bstring.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
|
@ -40,7 +40,7 @@ static char sccsid[] = "@(#)query.c 8.1 (Berkeley) 6/5/93";
|
||||
#elif defined(__NetBSD__)
|
||||
static char rcsid[] = "$NetBSD$";
|
||||
#endif
|
||||
#ident "$Revision: 1.10 $"
|
||||
#ident "$Revision: 1.11 $"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/protosw.h>
|
||||
@ -117,7 +117,7 @@ static u_int std_mask(u_int);
|
||||
static int parse_quote(char **, char *, char *, char *, int);
|
||||
|
||||
|
||||
int
|
||||
void
|
||||
main(int argc,
|
||||
char *argv[])
|
||||
{
|
||||
@ -255,7 +255,7 @@ main(int argc,
|
||||
if ((not_trace && trace) || argc == 0) {
|
||||
usage: fprintf(stderr, "%s: [-np1v] [-r tgt_rt] [-w wtime]"
|
||||
" [-a type=passwd] host1 [host2 ...]\n"
|
||||
"or\t-t {on=filename|more|off|on=dump/../table}"
|
||||
"or\t-t {on=filename|more|off|dump}"
|
||||
" host1 [host2 ...]\n",
|
||||
pgmname);
|
||||
exit(1);
|
||||
|
@ -36,7 +36,7 @@ static char sccsid[] = "@(#)trace.c 8.1 (Berkeley) 6/5/93";
|
||||
#elif defined(__NetBSD__)
|
||||
static char rcsid[] = "$NetBSD$";
|
||||
#endif
|
||||
#ident "$Revision: 1.16 $"
|
||||
#ident "$Revision: 1.17 $"
|
||||
|
||||
#define RIPCMDS
|
||||
#include "defs.h"
|
||||
|
Loading…
Reference in New Issue
Block a user