summaryrefslogtreecommitdiff
path: root/sbin/ifconfig
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-06-14 01:07:46 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-06-14 01:07:46 +0000
commit21bf65f17c4b4c5447ba042bed602700c28f619d (patch)
tree319f44f89d0d1c618cd143ad7f4115a010f0a259 /sbin/ifconfig
parentcb19aa7c716653ce4082bec8c260f71aff22e1e2 (diff)
metric and mtu are u_long, not int.
Diffstat (limited to 'sbin/ifconfig')
-rw-r--r--sbin/ifconfig/ifconfig.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 618176ba54d..d3a1d0e76fe 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifconfig.c,v 1.65 2002/06/10 22:18:48 markus Exp $ */
+/* $OpenBSD: ifconfig.c,v 1.66 2002/06/14 01:07:45 itojun Exp $ */
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
/*
@@ -81,7 +81,7 @@ static const char copyright[] =
#if 0
static const char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
#else
-static const char rcsid[] = "$OpenBSD: ifconfig.c,v 1.65 2002/06/10 22:18:48 markus Exp $";
+static const char rcsid[] = "$OpenBSD: ifconfig.c,v 1.66 2002/06/14 01:07:45 itojun Exp $";
#endif
#endif /* not lint */
@@ -149,7 +149,8 @@ struct netrange at_nr; /* AppleTalk net range */
int ipx_type = ETHERTYPE_II;
char name[IFNAMSIZ];
-int flags, metric, mtu, setaddr, setipdst, doalias;
+int flags, setaddr, setipdst, doalias;
+u_long metric, mtu;
int clearaddr, s;
int newaddr = 0;
int nsellength = 1;
@@ -917,6 +918,7 @@ setia6flags(vname, value)
char *vname;
int value;
{
+
if (value < 0) {
value = -value;
in6_addreq.ifra_flags &= ~value;
@@ -929,6 +931,7 @@ setia6pltime(val, d)
char *val;
int d;
{
+
setia6lifetime("pltime", val);
}
@@ -937,6 +940,7 @@ setia6vltime(val, d)
char *val;
int d;
{
+
setia6lifetime("vltime", val);
}
@@ -968,8 +972,12 @@ void
setifmetric(val)
char *val;
{
+ char *ep = NULL;
+
(void) strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
- ifr.ifr_metric = atoi(val);
+ ifr.ifr_metric = strtoul(val, &ep, 10);
+ if (!ep || *ep)
+ errx(1, "%s: invalid metric", val);
if (ioctl(s, SIOCSIFMETRIC, (caddr_t)&ifr) < 0)
warn("SIOCSIFMETRIC");
}
@@ -979,8 +987,12 @@ setifmtu(val, d)
char *val;
int d;
{
+ char *ep = NULL;
+
(void) strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
- ifr.ifr_mtu = atoi(val);
+ ifr.ifr_mtu = strtoul(val, &ep, 10);
+ if (!ep || *ep)
+ errx(1, "%s: invalid mtu", val);
if (ioctl(s, SIOCSIFMTU, (caddr_t)&ifr) < 0)
warn("SIOCSIFMTU");
}
@@ -1635,9 +1647,9 @@ status(link, sdl)
printf("%s: ", name);
printb("flags", flags, IFFBITS);
if (metric)
- printf(" metric %d", metric);
+ printf(" metric %lu", metric);
if (mtu)
- printf(" mtu %d", mtu);
+ printf(" mtu %lu", mtu);
putchar('\n');
if (sdl != NULL && sdl->sdl_type == IFT_ETHER && sdl->sdl_alen)
(void)printf("\taddress: %s\n", ether_ntoa(