X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/7cd60aa5ef4fca82ac8d6535ccfd1cf64516dc59..505837c54a962e8f6c8e49fda22775998bb50b82:/usr/src/sbin/route/route.c diff --git a/usr/src/sbin/route/route.c b/usr/src/sbin/route/route.c index 1927f374db..2fda3f0e82 100644 --- a/usr/src/sbin/route/route.c +++ b/usr/src/sbin/route/route.c @@ -2,17 +2,7 @@ * Copyright (c) 1983, 1989 The Regents of the University of California. * All rights reserved. * - * Redistribution and use in source and binary forms 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 University of California, Berkeley. The name of the - * University 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 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * %sccs.include.redist.c% */ #ifndef lint @@ -22,10 +12,9 @@ char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)route.c 5.23 (Berkeley) %G%"; +static char sccsid[] = "@(#)route.c 5.26 (Berkeley) %G%"; #endif /* not lint */ -#include #include #include #include @@ -43,6 +32,7 @@ static char sccsid[] = "@(#)route.c 5.23 (Berkeley) %G%"; #include #include #include +#include struct keytab { char *kt_cp; @@ -69,6 +59,7 @@ int iflag, verbose, aflen = sizeof (struct sockaddr_in); int locking, lockrest, debugonly; struct sockaddr_in sin = { sizeof(sin), AF_INET }; struct rt_metrics rt_metrics; +u_long rtm_inits; struct in_addr inet_makeaddr(); char *malloc(), *routename(), *netname(); extern char *iso_ntoa(), *link_ntoa(); @@ -84,6 +75,7 @@ char *cp; exit(1); } + main(argc, argv) int argc; char *argv[]; @@ -400,6 +392,7 @@ char *value; caseof(K_RTT, RTV_RTT, rmx_rtt); caseof(K_RTTVAR, RTV_RTTVAR, rmx_rttvar); } + rtm_inits |= flag; if (lockrest || locking) rt_metrics.rmx_locks |= flag; if (locking) @@ -838,6 +831,7 @@ rtmsg(cmd, flags) m_rtmsg.m_rtm.rtm_seq = ++seq; m_rtmsg.m_rtm.rtm_addrs = rtm_addrs; m_rtmsg.m_rtm.rtm_rmx = rt_metrics; + m_rtmsg.m_rtm.rtm_inits = rtm_inits; #define ROUND(a) (1 + (((a) - 1) | (sizeof(long) - 1))) #define NEXTADDR(w, u) { if (rtm_addrs & (w)) {l = (u).sa.sa_len;\ @@ -991,128 +985,3 @@ char *which; } fflush(stdout); } - -/* - * Copyright (c) 1990 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms 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 University of California, Berkeley. The name of the - * University 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 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)linkaddr.c 5.1 (Berkeley) 4/1/90"; -#endif /* LIBC_SCCS and not lint */ - -#ifndef AF_LINK -#include -#include -#include -#endif -/* States*/ -#define NAMING 0 -#define GOTONE 1 -#define GOTTWO 2 -#define RESET 3 -/* Inputs */ -#define DIGIT (4*0) -#define END (4*1) -#define DELIM (4*2) -#define LETTER (4*3) - -link_addr(addr, sdl) -register char *addr; -register struct sockaddr_dl *sdl; -{ - register char *cp = sdl->sdl_data; - char *cplim = sdl->sdl_len + (char *)sdl; - register int byte = 0, state = NAMING, new; - - bzero((char *)&sdl->sdl_family, sdl->sdl_len - 1); - sdl->sdl_family = AF_LINK; - do { - state &= ~LETTER; - if ((*addr >= '0') && (*addr <= '9')) { - new = *addr - '0'; - } else if ((*addr >= 'a') && (*addr <= 'f')) { - new = *addr - 'a' + 10; - } else if ((*addr >= 'A') && (*addr <= 'F')) { - new = *addr - 'A' + 10; - } else if (*addr == 0) { - state |= END; - } else if (state == NAMING && - (((*addr >= 'A') && (*addr <= 'Z')) || - ((*addr >= 'a') && (*addr <= 'z')))) - state |= LETTER; - else - state |= DELIM; - addr++; - switch (state /* | INPUT */) { - case NAMING | DIGIT: - case NAMING | LETTER: - *cp++ = addr[-1]; continue; - case NAMING | DELIM: - state = RESET; sdl->sdl_nlen = cp - sdl->sdl_data; continue; - case GOTTWO | DIGIT: - *cp++ = byte; /*FALLTHROUGH*/ - case RESET | DIGIT: - state = GOTONE; byte = new; continue; - case GOTONE | DIGIT: - state = GOTTWO; byte = new + (byte << 4); continue; - default: /* | DELIM */ - state = RESET; *cp++ = byte; byte = 0; continue; - case GOTONE | END: - case GOTTWO | END: - *cp++ = byte; /* FALLTHROUGH */ - case RESET | END: - break; - } - break; - } while (cp < cplim); - sdl->sdl_alen = cp - LLADDR(sdl); - new = cp - (char *)sdl; - if (new > sizeof(*sdl)) - sdl->sdl_len = new; - return; -} -static char hexlist[] = "0123456789abcdef"; - -char * -link_ntoa(sdl) -register struct sockaddr_dl *sdl; -{ - static char obuf[64]; - register char *out = obuf; - register int i; - register u_char *in = (u_char *)LLADDR(sdl); - u_char *inlim = in + sdl->sdl_nlen; - int firsttime = 1; - - if (sdl->sdl_nlen) { - bcopy(sdl->sdl_data, obuf, sdl->sdl_nlen); - out += sdl->sdl_nlen; - *out++ = ':'; - } - while (in < inlim) { - if (firsttime) firsttime = 0; else *out++ = '.'; - i = *in++; - if (i > 0xf) { - out[1] = hexlist[i & 0xf]; - i >>= 4; - out[0] = hexlist[i]; - out += 2; - } else - *out++ = hexlist[i]; - } - *out = 0; - return(obuf); -}