diff options
author | hrs <hrs@FreeBSD.org> | 2013-07-09 07:08:36 +0000 |
---|---|---|
committer | hrs <hrs@FreeBSD.org> | 2013-07-09 07:08:36 +0000 |
commit | 044c45e4164270465459fcdccdf0a58c93994fb0 (patch) | |
tree | 669e6ef3d370ee21a6c8f7a42a183564f36df428 /usr.sbin/rtadvd | |
parent | 9a4247565de725056056c44711059c67146f2be5 (diff) | |
download | FreeBSD-src-044c45e4164270465459fcdccdf0a58c93994fb0.zip FreeBSD-src-044c45e4164270465459fcdccdf0a58c93994fb0.tar.gz |
- Add missing "static" keywords.
- Add a check for ifindex to if_indextoifinfo(). It returns NULL when
if_indextoname() fails.
MFC after: 3 days
Diffstat (limited to 'usr.sbin/rtadvd')
-rw-r--r-- | usr.sbin/rtadvd/rtadvd.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.sbin/rtadvd/rtadvd.c b/usr.sbin/rtadvd/rtadvd.c index 880b283..c3420ef 100644 --- a/usr.sbin/rtadvd/rtadvd.c +++ b/usr.sbin/rtadvd/rtadvd.c @@ -95,7 +95,7 @@ struct sockaddr_in6 rcvfrom; static const char *pidfilename = _PATH_RTADVDPID; const char *conffile = _PATH_RTADVDCONF; static struct pidfh *pfh; -int dflag = 0, sflag = 0; +static int dflag, sflag; static int wait_shutdown; #define PFD_RAWSOCK 0 @@ -139,7 +139,7 @@ union nd_opt { #define NDOPT_FLAG_RDNSS (1 << 5) #define NDOPT_FLAG_DNSSL (1 << 6) -uint32_t ndopt_flags[] = { +static uint32_t ndopt_flags[] = { [ND_OPT_SOURCE_LINKADDR] = NDOPT_FLAG_SRCLINKADDR, [ND_OPT_TARGET_LINKADDR] = NDOPT_FLAG_TGTLINKADDR, [ND_OPT_PREFIX_INFORMATION] = NDOPT_FLAG_PREFIXINFO, @@ -1637,6 +1637,11 @@ struct ifinfo * if_indextoifinfo(int idx) { struct ifinfo *ifi; + char *name, name0[IFNAMSIZ]; + + /* Check if the interface has a valid name or not. */ + if (if_indextoname(idx, name0) == NULL) + return (NULL); TAILQ_FOREACH(ifi, &ifilist, ifi_next) { if (ifi->ifi_ifindex == idx) |