KNF, from openbsd via kame

This commit is contained in:
itojun 2002-06-02 23:43:21 +00:00
parent cfb25c839c
commit 4bb986ded2
1 changed files with 96 additions and 99 deletions

View File

@ -1,5 +1,5 @@
/* $NetBSD: ndp.c,v 1.20 2002/05/29 22:23:06 itojun Exp $ */
/* $KAME: ndp.c,v 1.89 2002/05/29 22:21:46 itojun Exp $ */
/* $NetBSD: ndp.c,v 1.21 2002/06/02 23:43:21 itojun Exp $ */
/* $KAME: ndp.c,v 1.91 2002/06/02 15:22:07 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
@ -84,7 +84,6 @@
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/time.h>
#include <sys/queue.h>
#include <net/if.h>
#include <net/if_dl.h>
@ -136,8 +135,7 @@ int set __P((int, char **));
void get __P((char *));
int delete __P((char *));
void dump __P((struct in6_addr *));
static struct in6_nbrinfo *getnbrinfo __P((struct in6_addr *addr,
int ifindex, int));
static struct in6_nbrinfo *getnbrinfo __P((struct in6_addr *, int, int));
static char *ether_str __P((struct sockaddr_dl *));
int ndp_ether_aton __P((char *, u_char *));
void usage __P((void));
@ -153,8 +151,8 @@ void harmonize_rtr __P((void));
static void getdefif __P((void));
static void setdefif __P((char *));
#endif
static char *sec2str __P((time_t t));
static char *ether_str __P((struct sockaddr_dl *sdl));
static char *sec2str __P((time_t));
static char *ether_str __P((struct sockaddr_dl *));
static void ts_print __P((const struct timeval *));
#ifdef ICMPV6CTL_ND6_DRLIST
@ -172,8 +170,8 @@ main(argc, argv)
char **argv;
{
int ch;
int aflag = 0, dflag = 0, sflag = 0, Hflag = 0,
pflag = 0, rflag = 0, Pflag = 0, Rflag = 0;
int aflag = 0, dflag = 0, sflag = 0, Hflag = 0;
int pflag = 0, rflag = 0, Pflag = 0, Rflag = 0;
pid = getpid();
thiszone = gmt2local(0);
@ -393,6 +391,7 @@ set(argc, argv)
while (argc-- > 0) {
if (strncmp(argv[0], "temp", 4) == 0) {
struct timeval time;
gettimeofday(&time, 0);
expire_time = time.tv_sec + 20 * 60;
} else if (strncmp(argv[0], "proxy", 5) == 0)
@ -728,10 +727,8 @@ again:;
#if 0 /* W and P are mystery even for us */
snprintf(flgbuf, sizeof(flgbuf), "%s%s%s%s",
isrouter ? "R" : "",
!IN6_IS_ADDR_UNSPECIFIED(&sin->sin6_addr)
? "P" : "",
(sin->sin6_len != sizeof(struct sockaddr_in6))
? "W" : "",
!IN6_IS_ADDR_UNSPECIFIED(&sin->sin6_addr) ? "P" : "",
(sin->sin6_len != sizeof(struct sockaddr_in6)) ? "W" : "",
(rtm->rtm_flags & RTF_ANNOUNCE) ? "p" : "");
#else
snprintf(flgbuf, sizeof(flgbuf), "%s%s",
@ -1207,8 +1204,8 @@ plist()
strlcpy(namebuf, "?", sizeof(namebuf));
printf(" %s", namebuf);
nbi = getnbrinfo(&sin6->sin6_addr, p->if_index,
0);
nbi = getnbrinfo(&sin6->sin6_addr,
p->if_index, 0);
if (nbi) {
switch (nbi->state) {
case ND6_LLINFO_REACHABLE:
@ -1374,8 +1371,8 @@ plist()
(nflag ? NI_NUMERICHOST : 0));
printf(" %s", host_buf);
nbi = getnbrinfo(&sin6.sin6_addr, PR.if_index,
0);
nbi = getnbrinfo(&sin6.sin6_addr,
PR.if_index, 0);
if (nbi) {
switch (nbi->state) {
case ND6_LLINFO_REACHABLE: