diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-05-21 23:29:47 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-05-21 23:29:47 +0000 |
commit | 2fceb7bd90de7d129435d53c94a55c5a4126c027 (patch) | |
tree | e886704947393c2a2cdc94dae18e17570d8287dc /usr.sbin/rtadvd/if.c | |
parent | 928ec3c40ba5669e00b228da6d7b973c01279b5a (diff) |
minor KNF. plug a memory leak on reconfig.
Diffstat (limited to 'usr.sbin/rtadvd/if.c')
-rw-r--r-- | usr.sbin/rtadvd/if.c | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/usr.sbin/rtadvd/if.c b/usr.sbin/rtadvd/if.c index 841b93dfc9e..3edd634e21b 100644 --- a/usr.sbin/rtadvd/if.c +++ b/usr.sbin/rtadvd/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.11 2002/02/17 19:42:39 millert Exp $ */ +/* $OpenBSD: if.c,v 1.12 2002/05/21 23:29:46 itojun Exp $ */ /* $KAME: if.c,v 1.17 2001/01/21 15:27:30 itojun Exp $ */ /* @@ -36,23 +36,12 @@ #include <sys/ioctl.h> #include <net/if.h> #include <net/if_types.h> -#ifdef __FreeBSD__ -# include <net/ethernet.h> -#endif #include <ifaddrs.h> -#ifdef __NetBSD__ -#include <net/if_ether.h> -#endif #include <net/route.h> #include <net/if_dl.h> #include <netinet/in.h> #include <netinet/icmp6.h> -#ifdef __bsdi__ -# include <netinet/if_ether.h> -#endif -#ifdef __OpenBSD__ #include <netinet/if_ether.h> -#endif #include <unistd.h> #include <errno.h> #include <stdlib.h> @@ -215,11 +204,12 @@ if_getflags(int ifindex, int oifflags) int lladdropt_length(struct sockaddr_dl *sdl) { - switch(sdl->sdl_type) { - case IFT_ETHER: - return(ROUNDUP8(ETHER_ADDR_LEN + 2)); - default: - return(0); + switch (sdl->sdl_type) { + case IFT_ETHER: + case IFT_FDDI: + return(ROUNDUP8(ETHER_ADDR_LEN + 2)); + default: + return(0); } } @@ -230,17 +220,17 @@ lladdropt_fill(struct sockaddr_dl *sdl, struct nd_opt_hdr *ndopt) ndopt->nd_opt_type = ND_OPT_SOURCE_LINKADDR; /* fixed */ - switch(sdl->sdl_type) { - case IFT_ETHER: - ndopt->nd_opt_len = (ROUNDUP8(ETHER_ADDR_LEN + 2)) >> 3; - addr = (char *)(ndopt + 1); - memcpy(addr, LLADDR(sdl), ETHER_ADDR_LEN); - break; - default: - syslog(LOG_ERR, - "<%s> unsupported link type(%d)", - __FUNCTION__, sdl->sdl_type); - exit(1); + switch (sdl->sdl_type) { + case IFT_ETHER: + case IFT_FDDI: + ndopt->nd_opt_len = (ROUNDUP8(ETHER_ADDR_LEN + 2)) >> 3; + addr = (char *)(ndopt + 1); + memcpy(addr, LLADDR(sdl), ETHER_ADDR_LEN); + break; + default: + syslog(LOG_ERR, "<%s> unsupported link type(%d)", + __FUNCTION__, sdl->sdl_type); + exit(1); } return; |