sbin/ifconfig WARNS=6
Sepherosa Ziehau
sepherosa at softhome.net
Sun Feb 13 00:53:13 PST 2005
WARNS=6 cleanup,
patch:
Index: Makefile
===================================================================
RCS file: /opt/df_cvs/src/sbin/ifconfig/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- Makefile 17 Jun 2003 04:27:33 -0000 1.2
+++ Makefile 13 Feb 2005 08:54:45 -0000
@@ -2,6 +2,7 @@
# $FreeBSD: src/sbin/ifconfig/Makefile,v 1.14.2.7 2002/02/15 03:58:37
luigi Exp $
# $DragonFly: src/sbin/ifconfig/Makefile,v 1.2 2003/06/17 04:27:33 dillon
Exp $
+WARNS= 6
PROG= ifconfig
SRCS= ifconfig.c
@@ -27,7 +28,6 @@
LDADD= -lipx
.endif
-CFLAGS+=-DNS -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings \
- -Wnested-externs -I..
+CFLAGS+=-DNS -I..
.include <bsd.prog.mk>
Index: ifconfig.c
===================================================================
RCS file: /opt/df_cvs/src/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.13
diff -u -r1.13 ifconfig.c
--- ifconfig.c 5 Jan 2005 15:14:04 -0000 1.13
+++ ifconfig.c 13 Feb 2005 08:54:45 -0000
@@ -105,9 +105,9 @@
struct in6_ifreq in6_ridreq;
struct in6_aliasreq in6_addreq =
{ { 0 },
- { 0 },
- { 0 },
- { 0 },
+ { 0, 0, 0, 0, { { { 0 } } }, 0 },
+ { 0, 0, 0, 0, { { { 0 } } }, 0 },
+ { 0, 0, 0, 0, { { { 0 } } }, 0 },
0,
{ 0, 0, ND6_INFINITE_LIFETIME, ND6_INFINITE_LIFETIME } };
#endif
@@ -148,7 +148,7 @@
struct ifa_msghdr *ifam);
void tunnel_status(int s);
void usage(void);
-void ifmaybeload(char *name);
+void ifmaybeload(char *if_nm);
#ifdef INET6
void in6_fillscopeid(struct sockaddr_in6 *sin6);
@@ -190,102 +190,102 @@
void (*c_func)(const char *, int, int, const struct afswtch *afp);
void (*c_func2)(const char *, const char *, int, const struct afswtch
*afp);
} cmds[] = {
- { "up", IFF_UP, setifflags } ,
- { "down", -IFF_UP, setifflags },
- { "arp", -IFF_NOARP, setifflags },
- { "-arp", IFF_NOARP, setifflags },
- { "debug", IFF_DEBUG, setifflags },
- { "-debug", -IFF_DEBUG, setifflags },
- { "promisc", IFF_PPROMISC, setifflags },
- { "-promisc", -IFF_PPROMISC, setifflags },
- { "add", IFF_UP, notealias },
- { "alias", IFF_UP, notealias },
- { "-alias", -IFF_UP, notealias },
- { "delete", -IFF_UP, notealias },
- { "remove", -IFF_UP, notealias },
+ { "up", IFF_UP, setifflags, NULL },
+ { "down", -IFF_UP, setifflags, NULL },
+ { "arp", -IFF_NOARP, setifflags, NULL },
+ { "-arp", IFF_NOARP, setifflags, NULL },
+ { "debug", IFF_DEBUG, setifflags, NULL },
+ { "-debug", -IFF_DEBUG, setifflags, NULL },
+ { "promisc", IFF_PPROMISC, setifflags, NULL },
+ { "-promisc", -IFF_PPROMISC, setifflags, NULL },
+ { "add", IFF_UP, notealias, NULL },
+ { "alias", IFF_UP, notealias, NULL },
+ { "-alias", -IFF_UP, notealias, NULL },
+ { "delete", -IFF_UP, notealias, NULL },
+ { "remove", -IFF_UP, notealias, NULL },
#ifdef notdef
#define EN_SWABIPS 0x1000
- { "swabips", EN_SWABIPS, setifflags },
- { "-swabips", -EN_SWABIPS, setifflags },
+ { "swabips", EN_SWABIPS, setifflags, NULL },
+ { "-swabips", -EN_SWABIPS, setifflags, NULL },
#endif
- { "netmask", NEXTARG, setifnetmask },
+ { "netmask", NEXTARG, setifnetmask, NULL },
#ifdef INET6
- { "prefixlen", NEXTARG, setifprefixlen },
- { "anycast", IN6_IFF_ANYCAST, setip6flags },
- { "tentative", IN6_IFF_TENTATIVE, setip6flags },
- { "-tentative", -IN6_IFF_TENTATIVE, setip6flags },
- { "deprecated", IN6_IFF_DEPRECATED, setip6flags },
- { "-deprecated", -IN6_IFF_DEPRECATED, setip6flags },
- { "autoconf", IN6_IFF_AUTOCONF, setip6flags },
- { "-autoconf", -IN6_IFF_AUTOCONF, setip6flags },
- { "pltime", NEXTARG, setip6pltime },
- { "vltime", NEXTARG, setip6vltime },
- { "eui64", 0, setip6eui64 },
-#endif
- { "range", NEXTARG, setatrange },
- { "phase", NEXTARG, setatphase },
- { "metric", NEXTARG, setifmetric },
- { "broadcast", NEXTARG, setifbroadaddr },
- { "ipdst", NEXTARG, setifipdst },
- { "tunnel", NEXTARG2, NULL, settunnel },
- { "deletetunnel", 0, deletetunnel },
- { "link0", IFF_LINK0, setifflags },
- { "-link0", -IFF_LINK0, setifflags },
- { "link1", IFF_LINK1, setifflags },
- { "-link1", -IFF_LINK1, setifflags },
- { "link2", IFF_LINK2, setifflags },
- { "-link2", -IFF_LINK2, setifflags },
+ { "prefixlen", NEXTARG, setifprefixlen, NULL },
+ { "anycast", IN6_IFF_ANYCAST, setip6flags, NULL },
+ { "tentative", IN6_IFF_TENTATIVE, setip6flags, NULL },
+ { "-tentative", -IN6_IFF_TENTATIVE, setip6flags, NULL },
+ { "deprecated", IN6_IFF_DEPRECATED, setip6flags, NULL },
+ { "-deprecated", -IN6_IFF_DEPRECATED, setip6flags, NULL },
+ { "autoconf", IN6_IFF_AUTOCONF, setip6flags, NULL },
+ { "-autoconf", -IN6_IFF_AUTOCONF, setip6flags, NULL },
+ { "pltime", NEXTARG, setip6pltime, NULL },
+ { "vltime", NEXTARG, setip6vltime, NULL },
+ { "eui64", 0, setip6eui64, NULL },
+#endif
+ { "range", NEXTARG, setatrange, NULL },
+ { "phase", NEXTARG, setatphase, NULL },
+ { "metric", NEXTARG, setifmetric, NULL },
+ { "broadcast", NEXTARG, setifbroadaddr, NULL },
+ { "ipdst", NEXTARG, setifipdst, NULL },
+ { "tunnel", NEXTARG2, NULL, settunnel },
+ { "deletetunnel", 0, deletetunnel, NULL },
+ { "link0", IFF_LINK0, setifflags, NULL },
+ { "-link0", -IFF_LINK0, setifflags, NULL },
+ { "link1", IFF_LINK1, setifflags, NULL },
+ { "-link1", -IFF_LINK1, setifflags, NULL },
+ { "link2", IFF_LINK2, setifflags, NULL },
+ { "-link2", -IFF_LINK2, setifflags, NULL },
#ifdef USE_IF_MEDIA
- { "media", NEXTARG, setmedia },
- { "mediaopt", NEXTARG, setmediaopt },
- { "-mediaopt", NEXTARG, unsetmediaopt },
+ { "media", NEXTARG, setmedia, NULL },
+ { "mediaopt", NEXTARG, setmediaopt, NULL },
+ { "-mediaopt", NEXTARG, unsetmediaopt, NULL },
#endif
#ifdef USE_VLANS
- { "vlan", NEXTARG, setvlantag },
- { "vlandev", NEXTARG, setvlandev },
- { "-vlandev", NEXTARG, unsetvlandev },
+ { "vlan", NEXTARG, setvlantag, NULL },
+ { "vlandev", NEXTARG, setvlandev, NULL },
+ { "-vlandev", NEXTARG, unsetvlandev, NULL },
#endif
#if 0
/* XXX `create' special-cased below */
- {"create", 0, clone_create },
- {"plumb", 0, clone_create },
+ {"create", 0, clone_create, NULL },
+ {"plumb", 0, clone_create, NULL },
#endif
- {"destroy", 0, clone_destroy },
- {"unplumb", 0, clone_destroy },
+ {"destroy", 0, clone_destroy, NULL },
+ {"unplumb", 0, clone_destroy, NULL },
#ifdef USE_IEEE80211
- { "ssid", NEXTARG, set80211ssid },
- { "nwid", NEXTARG, set80211ssid },
- { "stationname", NEXTARG, set80211stationname },
- { "station", NEXTARG, set80211stationname }, /* BSD/OS */
- { "channel", NEXTARG, set80211channel },
- { "authmode", NEXTARG, set80211authmode },
- { "powersavemode", NEXTARG, set80211powersavemode },
- { "powersave", 1, set80211powersave },
- { "-powersave", 0, set80211powersave },
- { "powersavesleep", NEXTARG, set80211powersavesleep },
- { "wepmode", NEXTARG, set80211wepmode },
- { "wep", 1, set80211wep },
- { "-wep", 0, set80211wep },
- { "weptxkey", NEXTARG, set80211weptxkey },
- { "wepkey", NEXTARG, set80211wepkey },
- { "nwkey", NEXTARG, set80211nwkey }, /* NetBSD */
- { "-nwkey", 0, set80211wep }, /* NetBSD */
-#endif
- { "rxcsum", IFCAP_RXCSUM, setifcap },
- { "-rxcsum", -IFCAP_RXCSUM, setifcap },
- { "txcsum", IFCAP_TXCSUM, setifcap },
- { "-txcsum", -IFCAP_TXCSUM, setifcap },
- { "netcons", IFCAP_NETCONS, setifcap },
- { "-netcons", -IFCAP_NETCONS, setifcap },
- { "polling", IFCAP_POLLING, setifcap },
- { "-polling", -IFCAP_POLLING, setifcap },
- { "normal", -IFF_LINK0, setifflags },
- { "compress", IFF_LINK0, setifflags },
- { "noicmp", IFF_LINK1, setifflags },
- { "mtu", NEXTARG, setifmtu },
- { "name", NEXTARG, setifname },
- { 0, 0, setifaddr },
- { 0, 0, setifdstaddr },
+ { "ssid", NEXTARG, set80211ssid, NULL },
+ { "nwid", NEXTARG, set80211ssid, NULL },
+ { "stationname", NEXTARG, set80211stationname, NULL },
+ { "station", NEXTARG, set80211stationname, NULL },/* BSD/OS */
+ { "channel", NEXTARG, set80211channel, NULL },
+ { "authmode", NEXTARG, set80211authmode, NULL },
+ { "powersavemode", NEXTARG, set80211powersavemode, NULL },
+ { "powersave", 1, set80211powersave, NULL },
+ { "-powersave", 0, set80211powersave, NULL },
+ { "powersavesleep", NEXTARG, set80211powersavesleep, NULL },
+ { "wepmode", NEXTARG, set80211wepmode, NULL },
+ { "wep", 1, set80211wep, NULL },
+ { "-wep", 0, set80211wep, NULL },
+ { "weptxkey", NEXTARG, set80211weptxkey, NULL },
+ { "wepkey", NEXTARG, set80211wepkey, NULL },
+ { "nwkey", NEXTARG, set80211nwkey, NULL }, /* NetBSD */
+ { "-nwkey", 0, set80211wep, NULL }, /* NetBSD */
+#endif
+ { "rxcsum", IFCAP_RXCSUM, setifcap, NULL },
+ { "-rxcsum", -IFCAP_RXCSUM, setifcap, NULL },
+ { "txcsum", IFCAP_TXCSUM, setifcap, NULL },
+ { "-txcsum", -IFCAP_TXCSUM, setifcap, NULL },
+ { "netcons", IFCAP_NETCONS, setifcap, NULL },
+ { "-netcons", -IFCAP_NETCONS, setifcap, NULL },
+ { "polling", IFCAP_POLLING, setifcap, NULL },
+ { "-polling", -IFCAP_POLLING, setifcap, NULL },
+ { "normal", -IFF_LINK0, setifflags, NULL },
+ { "compress", IFF_LINK0, setifflags, NULL },
+ { "noicmp", IFF_LINK1, setifflags, NULL },
+ { "mtu", NEXTARG, setifmtu, NULL },
+ { "name", NEXTARG, setifname, NULL },
+ { NULL, 0, setifaddr, NULL },
+ { NULL, 0, setifdstaddr, NULL },
};
/*
@@ -362,7 +362,7 @@
{ "ieee80211", AF_UNSPEC, ieee80211_status, NULL, NULL, }, /* XXX not
real!! */
#endif
#endif
- { 0, 0, 0, 0 }
+ { NULL, 0, NULL, NULL, NULL, 0, 0, NULL, NULL }
};
/*
@@ -607,7 +607,7 @@
int len;
/* sdl_data may not be terminated, don't use strlcpy */
- if ((len = sdl->sdl_nlen) > sizeof(name) - 1)
+ if ((len = sdl->sdl_nlen) > (int)sizeof(name) - 1)
len = sizeof(name) - 1;
bcopy(sdl->sdl_data, name, len);
name[len] = 0;
@@ -761,7 +761,8 @@
/*ARGSUSED*/
void
-setifaddr(const char *addr, int param, int s, const struct afswtch *afp)
+setifaddr(const char *addr, int param __unused, int s __unused,
+ const struct afswtch *afp)
{
if (*afp->af_getaddr == NULL)
return;
@@ -780,10 +781,10 @@
settunnel(const char *src, const char *dst, int s, const struct afswtch
*afp)
{
struct addrinfo hints, *srcres, *dstres;
- struct ifaliasreq addreq;
+ struct ifaliasreq addr_req;
int ecode;
#ifdef INET6
- struct in6_aliasreq in6_addreq;
+ struct in6_aliasreq in6_addr_req;
#endif
memset(&hints, 0, sizeof(hints));
@@ -803,27 +804,27 @@
switch (srcres->ai_addr->sa_family) {
case AF_INET:
- memset(&addreq, 0, sizeof(addreq));
- strncpy(addreq.ifra_name, name, IFNAMSIZ);
- memcpy(&addreq.ifra_addr, srcres->ai_addr,
+ memset(&addr_req, 0, sizeof(addr_req));
+ strncpy(addr_req.ifra_name, name, IFNAMSIZ);
+ memcpy(&addr_req.ifra_addr, srcres->ai_addr,
srcres->ai_addr->sa_len);
- memcpy(&addreq.ifra_dstaddr, dstres->ai_addr,
+ memcpy(&addr_req.ifra_dstaddr, dstres->ai_addr,
dstres->ai_addr->sa_len);
- if (ioctl(s, SIOCSIFPHYADDR, &addreq) < 0)
+ if (ioctl(s, SIOCSIFPHYADDR, &addr_req) < 0)
warn("SIOCSIFPHYADDR");
break;
#ifdef INET6
case AF_INET6:
- memset(&in6_addreq, 0, sizeof(in6_addreq));
- strncpy(in6_addreq.ifra_name, name, IFNAMSIZ);
- memcpy(&in6_addreq.ifra_addr, srcres->ai_addr,
+ memset(&in6_addr_req, 0, sizeof(in6_addr_req));
+ strncpy(in6_addr_req.ifra_name, name, IFNAMSIZ);
+ memcpy(&in6_addr_req.ifra_addr, srcres->ai_addr,
srcres->ai_addr->sa_len);
- memcpy(&in6_addreq.ifra_dstaddr, dstres->ai_addr,
+ memcpy(&in6_addr_req.ifra_dstaddr, dstres->ai_addr,
dstres->ai_addr->sa_len);
- if (ioctl(s, SIOCSIFPHYADDR_IN6, &in6_addreq) < 0)
+ if (ioctl(s, SIOCSIFPHYADDR_IN6, &in6_addr_req) < 0)
warn("SIOCSIFPHYADDR_IN6");
break;
#endif /* INET6 */
@@ -838,7 +839,8 @@
/* ARGSUSED */
void
-deletetunnel(const char *vname, int param, int s, const struct afswtch
*afp)
+deletetunnel(const char *vname __unused, int param __unused, int s,
+ const struct afswtch *afp __unused)
{
if (ioctl(s, SIOCDIFPHYADDR, &ifr) < 0)
@@ -846,7 +848,7 @@
}
void
-setifnetmask(const char *addr, int dummy __unused, int s,
+setifnetmask(const char *addr, int dummy __unused, int s __unused,
const struct afswtch *afp)
{
if (*afp->af_getaddr == NULL)
@@ -857,7 +859,7 @@
#ifdef INET6
void
-setifprefixlen(const char *addr, int dummy __unused, int s,
+setifprefixlen(const char *addr, int dummy __unused, int s __unused,
const struct afswtch *afp)
{
if (*afp->af_getprefix)
@@ -893,7 +895,7 @@
}
void
-setip6lifetime(const char *cmd, const char *val, int s,
+setip6lifetime(const char *cmd, const char *val, int s __unused,
const struct afswtch *afp)
{
time_t newval, t;
@@ -915,7 +917,7 @@
}
void
-setip6eui64(const char *cmd, int dummy __unused, int s,
+setip6eui64(const char *cmd, int dummy __unused, int s __unused,
const struct afswtch *afp)
{
struct ifaddrs *ifap, *ifa;
@@ -950,7 +952,7 @@
#endif
void
-setifbroadaddr(const char *addr, int dummy __unused, int s,
+setifbroadaddr(const char *addr, int dummy __unused, int s __unused,
const struct afswtch *afp)
{
if (*afp->af_getaddr == NULL)
@@ -959,8 +961,8 @@
}
void
-setifipdst(const char *addr, int dummy __unused, int s,
- const struct afswtch *afp)
+setifipdst(const char *addr, int dummy __unused, int s __unused,
+ const struct afswtch *afp __unused)
{
in_getaddr(addr, DSTADDR);
setipdst++;
@@ -970,7 +972,8 @@
#define rqtosa(x) (&(((struct ifreq *)(afp->x))->ifr_addr))
void
-notealias(const char *addr, int param, int s, const struct afswtch *afp)
+notealias(const char *addr __unused, int param, int s __unused,
+ const struct afswtch *afp)
{
if (setaddr && doalias == 0 && param < 0)
bcopy((caddr_t)rqtosa(af_addreq),
@@ -986,7 +989,7 @@
/*ARGSUSED*/
void
-setifdstaddr(const char *addr, int param __unused, int s,
+setifdstaddr(const char *addr, int param __unused, int s __unused,
const struct afswtch *afp)
{
if (*afp->af_getaddr == NULL)
@@ -1000,7 +1003,8 @@
* Make a private copy so we can avoid that.
*/
void
-setifflags(const char *vname, int value, int s, const struct afswtch *afp)
+setifflags(const char *vname, int value, int s,
+ const struct afswtch *afp __unused)
{
struct ifreq my_ifr;
@@ -1025,7 +1029,8 @@
}
void
-setifcap(const char *vname, int value, int s, const struct afswtch *afp)
+setifcap(const char *vname, int value, int s,
+ const struct afswtch *afp __unused)
{
if (ioctl(s, SIOCGIFCAP, (caddr_t)&ifr) < 0) {
@@ -1045,7 +1050,7 @@
void
setifmetric(const char *val, int dummy __unused, int s,
- const struct afswtch *afp)
+ const struct afswtch *afp __unused)
{
strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name));
ifr.ifr_metric = atoi(val);
@@ -1054,7 +1059,8 @@
}
void
-setifmtu(const char *val, int dummy __unused, int s, const struct afswtch
*afp)
+setifmtu(const char *val, int dummy __unused, int s,
+ const struct afswtch *afp __unused)
{
strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name));
ifr.ifr_mtu = atoi(val);
@@ -1064,7 +1070,7 @@
void
setifname(const char *val, int dummy __unused, int s,
- const struct afswtch *afp)
+ const struct afswtch *afp __unused)
{
char *newname;
@@ -1261,38 +1267,46 @@
void
in_status(int s __unused, struct rt_addrinfo *info)
{
- struct sockaddr_in *sin, null_sin;
-
- memset(&null_sin, 0, sizeof(null_sin));
+ struct sockaddr_in *addr_in, null_in;
+
+ memset(&null_in, 0, sizeof(null_in));
- sin = (struct sockaddr_in *)info->rti_info[RTAX_IFA];
- printf("\tinet %s ", inet_ntoa(sin->sin_addr));
+ addr_in = (struct sockaddr_in *)info->rti_info[RTAX_IFA];
+ printf("\tinet %s ", inet_ntoa(addr_in->sin_addr));
if (flags & IFF_POINTOPOINT) {
/* note RTAX_BRD overlap with IFF_BROADCAST */
- sin = (struct sockaddr_in *)info->rti_info[RTAX_BRD];
- if (!sin)
- sin = &null_sin;
- printf("--> %s ", inet_ntoa(sin->sin_addr));
+ addr_in = (struct sockaddr_in *)info->rti_info[RTAX_BRD];
+ if (!addr_in)
+ addr_in = &null_in;
+ printf("--> %s ", inet_ntoa(addr_in->sin_addr));
}
- sin = (struct sockaddr_in *)info->rti_info[RTAX_NETMASK];
- if (!sin)
- sin = &null_sin;
- printf("netmask 0x%lx ", (unsigned long)ntohl(sin->sin_addr.s_addr));
+ addr_in = (struct sockaddr_in *)info->rti_info[RTAX_NETMASK];
+ if (!addr_in)
+ addr_in = &null_in;
+ printf("netmask 0x%lx ",
+ (unsigned long)ntohl(addr_in->sin_addr.s_addr));
if (flags & IFF_BROADCAST) {
/* note RTAX_BRD overlap with IFF_POINTOPOINT */
- sin = (struct sockaddr_in *)info->rti_info[RTAX_BRD];
- if (sin && sin->sin_addr.s_addr != 0)
- printf("broadcast %s", inet_ntoa(sin->sin_addr));
+ addr_in = (struct sockaddr_in *)info->rti_info[RTAX_BRD];
+ if (addr_in && addr_in->sin_addr.s_addr != 0)
+ printf("broadcast %s", inet_ntoa(addr_in->sin_addr));
}
putchar('\n');
}
#ifdef INET6
+
+#if defined(__KAME__) && defined(KAME_SCOPEID)
+#define __UNUSED
+#else
+#define __UNUSED __unused
+#endif
+
void
-in6_fillscopeid(struct sockaddr_in6 *sin6)
+in6_fillscopeid(struct sockaddr_in6 *sin6 __UNUSED)
{
#if defined(__KAME__) && defined(KAME_SCOPEID)
if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
@@ -1302,11 +1316,12 @@
}
#endif
}
+#undef __UNUSED
void
in6_status(int s __unused, struct rt_addrinfo *info)
{
- struct sockaddr_in6 *sin, null_sin;
+ struct sockaddr_in6 *addr_in, null_in;
struct in6_ifreq ifr6;
int s6;
u_int32_t flags6;
@@ -1315,15 +1330,15 @@
int error;
u_int32_t scopeid;
- memset(&null_sin, 0, sizeof(null_sin));
+ memset(&null_in, 0, sizeof(null_in));
- sin = (struct sockaddr_in6 *)info->rti_info[RTAX_IFA];
+ addr_in = (struct sockaddr_in6 *)info->rti_info[RTAX_IFA];
strncpy(ifr6.ifr_name, ifr.ifr_name, sizeof(ifr.ifr_name));
if ((s6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
perror("ifconfig: socket");
return;
}
- ifr6.ifr_addr = *sin;
+ ifr6.ifr_addr = *addr_in;
if (ioctl(s6, SIOCGIFAFLAG_IN6, &ifr6) < 0) {
perror("ifconfig: ioctl(SIOCGIFAFLAG_IN6)");
close(s6);
@@ -1331,7 +1346,7 @@
}
flags6 = ifr6.ifr_ifru.ifru_flags6;
memset(&lifetime, 0, sizeof(lifetime));
- ifr6.ifr_addr = *sin;
+ ifr6.ifr_addr = *addr_in;
if (ioctl(s6, SIOCGIFALIFETIME_IN6, &ifr6) < 0) {
perror("ifconfig: ioctl(SIOCGIFALIFETIME_IN6)");
close(s6);
@@ -1341,61 +1356,58 @@
close(s6);
/* XXX: embedded link local addr check */
- if (IN6_IS_ADDR_LINKLOCAL(&sin->sin6_addr) &&
- *(u_short *)&sin->sin6_addr.s6_addr[2] != 0) {
- u_short index;
-
- index = *(u_short *)&sin->sin6_addr.s6_addr[2];
- *(u_short *)&sin->sin6_addr.s6_addr[2] = 0;
- if (sin->sin6_scope_id == 0)
- sin->sin6_scope_id = ntohs(index);
+ if (IN6_IS_ADDR_LINKLOCAL(&addr_in->sin6_addr) &&
+ *(u_short *)&addr_in->sin6_addr.s6_addr[2] != 0) {
+ u_short idx;
+
+ idx = *(u_short *)&addr_in->sin6_addr.s6_addr[2];
+ *(u_short *)&addr_in->sin6_addr.s6_addr[2] = 0;
+ if (addr_in->sin6_scope_id == 0)
+ addr_in->sin6_scope_id = ntohs(idx);
}
- scopeid = sin->sin6_scope_id;
+ scopeid = addr_in->sin6_scope_id;
- error = getnameinfo((struct sockaddr *)sin, sin->sin6_len, addr_buf,
+ error = getnameinfo((struct sockaddr *)addr_in, addr_in->sin6_len,
addr_buf,
sizeof(addr_buf), NULL, 0,
NI_NUMERICHOST|NI_WITHSCOPEID);
if (error != 0)
- inet_ntop(AF_INET6, &sin->sin6_addr, addr_buf,
+ inet_ntop(AF_INET6, &addr_in->sin6_addr, addr_buf,
sizeof(addr_buf));
printf("\tinet6 %s ", addr_buf);
if (flags & IFF_POINTOPOINT) {
/* note RTAX_BRD overlap with IFF_BROADCAST */
- sin = (struct sockaddr_in6 *)info->rti_info[RTAX_BRD];
+ addr_in = (struct sockaddr_in6 *)info->rti_info[RTAX_BRD];
/*
* some of the interfaces do not have valid destination
* address.
*/
- if (sin && sin->sin6_family == AF_INET6) {
- int error;
-
+ if (addr_in && addr_in->sin6_family == AF_INET6) {
/* XXX: embedded link local addr check */
- if (IN6_IS_ADDR_LINKLOCAL(&sin->sin6_addr) &&
- *(u_short *)&sin->sin6_addr.s6_addr[2] != 0) {
- u_short index;
-
- index = *(u_short *)&sin->sin6_addr.s6_addr[2];
- *(u_short *)&sin->sin6_addr.s6_addr[2] = 0;
- if (sin->sin6_scope_id == 0)
- sin->sin6_scope_id = ntohs(index);
+ if (IN6_IS_ADDR_LINKLOCAL(&addr_in->sin6_addr) &&
+ *(u_short *)&addr_in->sin6_addr.s6_addr[2] != 0) {
+ u_short idx;
+
+ idx = *(u_short *)&addr_in->sin6_addr.s6_addr[2];
+ *(u_short *)&addr_in->sin6_addr.s6_addr[2] = 0;
+ if (addr_in->sin6_scope_id == 0)
+ addr_in->sin6_scope_id = ntohs(idx);
}
- error = getnameinfo((struct sockaddr *)sin,
- sin->sin6_len, addr_buf,
- sizeof(addr_buf), NULL, 0,
- NI_NUMERICHOST|NI_WITHSCOPEID);
- if (error != 0)
- inet_ntop(AF_INET6, &sin->sin6_addr, addr_buf,
+ if (getnameinfo((struct sockaddr *)addr_in,
+ addr_in->sin6_len, addr_buf,
+ sizeof(addr_buf), NULL, 0,
+ NI_NUMERICHOST|NI_WITHSCOPEID) != 0)
+ inet_ntop(AF_INET6, &addr_in->sin6_addr, addr_buf,
sizeof(addr_buf));
printf("--> %s ", addr_buf);
}
}
- sin = (struct sockaddr_in6 *)info->rti_info[RTAX_NETMASK];
- if (!sin)
- sin = &null_sin;
- printf("prefixlen %d ", prefix(&sin->sin6_addr,
+ addr_in = (struct sockaddr_in6 *)info->rti_info[RTAX_NETMASK];
+ if (!addr_in)
+ addr_in = &null_in;
+ printf("prefixlen %d ", prefix(&addr_in->sin6_addr,
sizeof(struct in6_addr)));
if ((flags6 & IN6_IFF_ANYCAST) != 0)
@@ -1558,13 +1570,13 @@
void
in_getaddr(const char *s, int which)
{
- register struct sockaddr_in *sin = sintab[which];
+ register struct sockaddr_in *addr_in = sintab[which];
struct hostent *hp;
struct netent *np;
- sin->sin_len = sizeof(*sin);
+ addr_in->sin_len = sizeof(*addr_in);
if (which != MASK)
- sin->sin_family = AF_INET;
+ addr_in->sin_family = AF_INET;
if (which == ADDR) {
char *p = NULL;
@@ -1586,13 +1598,13 @@
}
}
- if (inet_aton(s, &sin->sin_addr))
+ if (inet_aton(s, &addr_in->sin_addr))
return;
if ((hp = gethostbyname(s)) != 0)
- bcopy(hp->h_addr, (char *)&sin->sin_addr,
- MIN(hp->h_length, sizeof(sin->sin_addr)));
+ bcopy(hp->h_addr, (char *)&addr_in->sin_addr,
+ MIN(hp->h_length, (int)sizeof(addr_in->sin_addr)));
else if ((np = getnetbyname(s)) != 0)
- sin->sin_addr = inet_makeaddr(np->n_net, INADDR_ANY);
+ addr_in->sin_addr = inet_makeaddr(np->n_net, INADDR_ANY);
else
errx(1, "%s: bad value", s);
}
@@ -1606,15 +1618,15 @@
void
in6_getaddr(const char *s, int which)
{
- register struct sockaddr_in6 *sin = sin6tab[which];
+ register struct sockaddr_in6 *addr_in = sin6tab[which];
struct addrinfo hints, *res;
int error = -1;
newaddr &= 1;
- sin->sin6_len = sizeof(*sin);
+ addr_in->sin6_len = sizeof(*addr_in);
if (which != MASK)
- sin->sin6_family = AF_INET6;
+ addr_in->sin6_family = AF_INET6;
if (which == ADDR) {
char *p = NULL;
@@ -1625,36 +1637,36 @@
}
}
- if (sin->sin6_family == AF_INET6) {
+ if (addr_in->sin6_family == AF_INET6) {
bzero(&hints, sizeof(struct addrinfo));
hints.ai_family = AF_INET6;
error = getaddrinfo(s, NULL, &hints, &res);
}
if (error != 0) {
- if (inet_pton(AF_INET6, s, &sin->sin6_addr) != 1)
+ if (inet_pton(AF_INET6, s, &addr_in->sin6_addr) != 1)
errx(1, "%s: bad value", s);
} else
- bcopy(res->ai_addr, sin, res->ai_addrlen);
+ bcopy(res->ai_addr, addr_in, res->ai_addrlen);
}
void
in6_getprefix(const char *plen, int which)
{
- register struct sockaddr_in6 *sin = sin6tab[which];
+ register struct sockaddr_in6 *addr_in = sin6tab[which];
register u_char *cp;
int len = atoi(plen);
if ((len < 0) || (len > 128))
errx(1, "%s: bad value", plen);
- sin->sin6_len = sizeof(*sin);
+ addr_in->sin6_len = sizeof(*addr_in);
if (which != MASK)
- sin->sin6_family = AF_INET6;
+ addr_in->sin6_family = AF_INET6;
if ((len == 0) || (len == 128)) {
- memset(&sin->sin6_addr, 0xff, sizeof(struct in6_addr));
+ memset(&addr_in->sin6_addr, 0xff, sizeof(struct in6_addr));
return;
}
- memset((void *)&sin->sin6_addr, 0x00, sizeof(sin->sin6_addr));
- for (cp = (u_char *)&sin->sin6_addr; len > 7; len -= 8)
+ memset((void *)&addr_in->sin6_addr, 0x00, sizeof(addr_in->sin6_addr));
+ for (cp = (u_char *)&addr_in->sin6_addr; len > 7; len -= 8)
*cp++ = 0xff;
*cp = 0xff << (8 - len);
}
@@ -1752,8 +1764,8 @@
/* XXX FIXME -- should use strtoul for better parsing. */
void
-setatrange(const char *range, int dummy __unused, int s,
- const struct afswtch *afp)
+setatrange(const char *range, int dummy __unused, int s __unused,
+ const struct afswtch *afp __unused)
{
u_short first = 123, last = 123;
@@ -1766,8 +1778,8 @@
}
void
-setatphase(const char *phase, int dummy __unused, int s,
- const struct afswtch *afp)
+setatphase(const char *phase, int dummy __unused, int s __unused,
+ const struct afswtch *afp __unused)
{
if (!strcmp(phase, "1"))
at_nr.nr_phase = 1;
@@ -1819,25 +1831,25 @@
int
prefix(void *val, int size)
{
- register u_char *name = (u_char *)val;
- register int byte, bit, plen = 0;
+ register u_char *addr = (u_char *)val;
+ register int byte, bit, plen = 0;
- for (byte = 0; byte < size; byte++, plen += 8)
- if (name[byte] != 0xff)
- break;
+ for (byte = 0; byte < size; byte++, plen += 8)
+ if (addr[byte] != 0xff)
+ break;
if (byte == size)
return (plen);
for (bit = 7; bit != 0; bit--, plen++)
- if (!(name[byte] & (1 << bit)))
- break;
- for (; bit != 0; bit--)
- if (name[byte] & (1 << bit))
- return(0);
- byte++;
- for (; byte < size; byte++)
- if (name[byte])
- return(0);
- return (plen);
+ if (!(addr[byte] & (1 << bit)))
+ break;
+ for (; bit != 0; bit--)
+ if (addr[byte] & (1 << bit))
+ return(0);
+ byte++;
+ for (; byte < size; byte++)
+ if (addr[byte])
+ return(0);
+ return (plen);
}
static char *
@@ -1875,7 +1887,7 @@
#endif /*INET6*/
void
-ifmaybeload(char *name)
+ifmaybeload(char *if_nm)
{
struct module_stat mstat;
int fileid, modid;
@@ -1884,8 +1896,8 @@
/* turn interface and unit into module name */
strcpy(ifkind, "if_");
- for (cp = name, dp = ifkind + 3;
- (*cp != 0) && !isdigit(*cp); cp++, dp++)
+ for (cp = if_nm, dp = ifkind + 3;
+ (*cp != 0) && !isdigit(*cp); cp++, dp++)
*dp = *cp;
*dp = 0;
@@ -1904,7 +1916,7 @@
cp = mstat.name;
}
/* already loaded? */
- if (strncmp(name, cp, strlen(cp)) == 0 ||
+ if (strncmp(if_nm, cp, strlen(cp)) == 0 ||
strncmp(ifkind, cp, strlen(cp)) == 0)
return;
}
@@ -1985,7 +1997,8 @@
}
void
-clone_destroy(const char *val, int d, int s, const struct afswtch *rafp)
+clone_destroy(const char *val __unused, int d __unused, int s,
+ const struct afswtch *rafp __unused)
{
strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
Index: ifieee80211.c
===================================================================
RCS file: /opt/df_cvs/src/sbin/ifconfig/ifieee80211.c,v
retrieving revision 1.6
diff -u -r1.6 ifieee80211.c
--- ifieee80211.c 18 Dec 2004 21:43:38 -0000 1.6
+++ ifieee80211.c 13 Feb 2005 08:54:45 -0000
@@ -94,7 +94,8 @@
static void print_string(const u_int8_t *buf, int len);
void
-set80211ssid(const char *val, int d, int s, const struct afswtch *rafp)
+set80211ssid(const char *val, int d __unused, int s,
+ const struct afswtch *rafp __unused)
{
int ssid;
int len;
@@ -115,7 +116,8 @@
}
void
-set80211stationname(const char *val, int d, int s, const struct afswtch
*rafp)
+set80211stationname(const char *val, int d __unused, int s,
+ const struct afswtch *rafp __unused)
{
int len;
u_int8_t data[33];
@@ -128,13 +130,15 @@
}
void
-set80211channel(const char *val, int d, int s, const struct afswtch *rafp)
+set80211channel(const char *val, int d __unused, int s,
+ const struct afswtch *rafp __unused)
{
set80211(s, IEEE80211_IOC_CHANNEL, atoi(val), 0, NULL);
}
void
-set80211authmode(const char *val, int d, int s, const struct afswtch
*rafp)
+set80211authmode(const char *val, int d __unused, int s,
+ const struct afswtch *rafp __unused)
{
int mode;
@@ -152,7 +156,8 @@
}
void
-set80211powersavemode(const char *val, int d, int s, const struct afswtch
*rafp)
+set80211powersavemode(const char *val, int d __unused, int s,
+ const struct afswtch *rafp __unused)
{
int mode;
@@ -174,7 +179,8 @@
}
void
-set80211powersave(const char *val, int d, int s, const struct afswtch
*rafp)
+set80211powersave(const char *val __unused, int d, int s,
+ const struct afswtch *rafp __unused)
{
if (d == 0)
set80211(s, IEEE80211_IOC_POWERSAVE, IEEE80211_POWERSAVE_OFF,
@@ -185,13 +191,15 @@
}
void
-set80211powersavesleep(const char *val, int d, int s, const struct
afswtch *rafp)
+set80211powersavesleep(const char *val, int d __unused, int s,
+ const struct afswtch *rafp __unused)
{
set80211(s, IEEE80211_IOC_POWERSAVESLEEP, atoi(val), 0, NULL);
}
void
-set80211wepmode(const char *val, int d, int s, const struct afswtch *rafp)
+set80211wepmode(const char *val, int d __unused, int s,
+ const struct afswtch *rafp __unused)
{
int mode;
@@ -209,19 +217,22 @@
}
void
-set80211wep(const char *val, int d, int s, const struct afswtch *rafp)
+set80211wep(const char *val __unused, int d, int s,
+ const struct afswtch *rafp __unused)
{
set80211(s, IEEE80211_IOC_WEP, d, 0, NULL);
}
-set80211weptxkey(const char *val, int d, int s, const struct afswtch
*rafp)
+set80211weptxkey(const char *val, int d __unused, int s,
+ const struct afswtch *rafp __unused)
{
set80211(s, IEEE80211_IOC_WEPTXKEY, atoi(val)-1, 0, NULL);
}
void
-set80211wepkey(const char *val, int d, int s, const struct afswtch *rafp)
+set80211wepkey(const char *val, int d __unused, int s,
+ const struct afswtch *rafp __unused)
{
int key = 0;
int len;
@@ -245,7 +256,8 @@
* it's not all that hard.
*/
void
-set80211nwkey(const char *val, int d, int s, const struct afswtch *rafp)
+set80211nwkey(const char *val, int d __unused, int s,
+ const struct afswtch *rafp __unused)
{
int txkey;
int i, len;
Index: ifmedia.c
===================================================================
RCS file: /opt/df_cvs/src/sbin/ifconfig/ifmedia.c,v
retrieving revision 1.6
diff -u -r1.6 ifmedia.c
--- ifmedia.c 18 Dec 2004 21:43:38 -0000 1.6
+++ ifmedia.c 13 Feb 2005 08:54:45 -0000
@@ -183,7 +183,8 @@
}
void
-setmedia(const char *val, int d, int s, const struct afswtch *afp)
+setmedia(const char *val, int d __unused, int s,
+ const struct afswtch *afp __unused)
{
struct ifmediareq ifmr;
int first_type, subtype;
@@ -225,14 +226,16 @@
}
void
-setmediaopt(const char *val, int d, int s, const struct afswtch *afp)
+setmediaopt(const char *val, int d __unused, int s,
+ const struct afswtch *afp __unused)
{
domediaopt(val, 0, s);
}
void
-unsetmediaopt(const char *val, int d, int s, const struct afswtch *afp)
+unsetmediaopt(const char *val, int d __unused, int s,
+ const struct afswtch *afp __unused)
{
domediaopt(val, 1, s);
Index: ifvlan.c
===================================================================
RCS file: /opt/df_cvs/src/sbin/ifconfig/ifvlan.c,v
retrieving revision 1.4
diff -u -r1.4 ifvlan.c
--- ifvlan.c 28 Sep 2003 14:39:18 -0000 1.4
+++ ifvlan.c 13 Feb 2005 08:54:45 -0000
@@ -80,7 +80,8 @@
return;
}
-void setvlantag(const char *val, int d, int s, const struct afswtch *afp)
+void setvlantag(const char *val, int d __unused, int s,
+ const struct afswtch *afp __unused)
{
u_int16_t tag;
struct vlanreq vreq;
@@ -102,7 +103,8 @@
return;
}
-void setvlandev(const char *val, int d, int s, const struct afswtch *afp)
+void setvlandev(const char *val, int d __unused, int s,
+ const struct afswtch *afp __unused)
{
struct vlanreq vreq;
@@ -124,7 +126,8 @@
return;
}
-void unsetvlandev(const char *val, int d, int s, const struct afswtch
*afp)
+void unsetvlandev(const char *val __unused, int d __unused, int s,
+ const struct afswtch *afp __unused)
{
struct vlanreq vreq;
More information about the Submit
mailing list