Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F110771319
D10587.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D10587.id.diff
View Options
Index: head/sbin/ifconfig/af_inet6.c
===================================================================
--- head/sbin/ifconfig/af_inet6.c
+++ head/sbin/ifconfig/af_inet6.c
@@ -349,12 +349,14 @@
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)
+ errx(1, "%s: bad value", s);
+ } else {
+ bcopy(res->ai_addr, sin, res->ai_addrlen);
+ freeaddrinfo(res);
+ }
}
- if (error != 0) {
- if (inet_pton(AF_INET6, s, &sin->sin6_addr) != 1)
- errx(1, "%s: bad value", s);
- } else
- bcopy(res->ai_addr, sin, res->ai_addrlen);
}
static int
Index: head/sbin/ifconfig/ifclone.c
===================================================================
--- head/sbin/ifconfig/ifclone.c
+++ head/sbin/ifconfig/ifclone.c
@@ -87,6 +87,7 @@
putchar('\n');
free(buf);
+ close(s);
}
struct clone_defcb {
Index: head/sbin/ifconfig/ifconfig.c
===================================================================
--- head/sbin/ifconfig/ifconfig.c
+++ head/sbin/ifconfig/ifconfig.c
@@ -106,7 +106,7 @@
static void status(const struct afswtch *afp, const struct sockaddr_dl *sdl,
struct ifaddrs *ifa);
static void tunnel_status(int s);
-static void usage(void);
+static void usage(void) _Noreturn;
static struct afswtch *af_getbyname(const char *name);
static struct afswtch *af_getbyfamily(int af);
@@ -802,26 +802,24 @@
*/
p = (setaddr ? &setifdstaddr_cmd : &setifaddr_cmd);
}
- if (p->c_u.c_func || p->c_u.c_func2) {
- if (p->c_parameter == NEXTARG) {
- if (argv[1] == NULL)
- errx(1, "'%s' requires argument",
- p->c_name);
- p->c_u.c_func(argv[1], 0, s, afp);
+ if (p->c_parameter == NEXTARG && p->c_u.c_func) {
+ if (argv[1] == NULL)
+ errx(1, "'%s' requires argument",
+ p->c_name);
+ p->c_u.c_func(argv[1], 0, s, afp);
+ argc--, argv++;
+ } else if (p->c_parameter == OPTARG && p->c_u.c_func) {
+ p->c_u.c_func(argv[1], 0, s, afp);
+ if (argv[1] != NULL)
argc--, argv++;
- } else if (p->c_parameter == OPTARG) {
- p->c_u.c_func(argv[1], 0, s, afp);
- if (argv[1] != NULL)
- argc--, argv++;
- } else if (p->c_parameter == NEXTARG2) {
- if (argc < 3)
- errx(1, "'%s' requires 2 arguments",
- p->c_name);
- p->c_u.c_func2(argv[1], argv[2], s, afp);
- argc -= 2, argv += 2;
- } else
- p->c_u.c_func(*argv, p->c_parameter, s, afp);
- }
+ } else if (p->c_parameter == NEXTARG2 && p->c_u.c_func2) {
+ if (argc < 3)
+ errx(1, "'%s' requires 2 arguments",
+ p->c_name);
+ p->c_u.c_func2(argv[1], argv[2], s, afp);
+ argc -= 2, argv += 2;
+ } else if (p->c_u.c_func)
+ p->c_u.c_func(*argv, p->c_parameter, s, afp);
argc--, argv++;
}
@@ -1297,8 +1295,8 @@
printf("%s=%o", s, v);
else
printf("%s=%x", s, v);
- bits++;
if (bits) {
+ bits++;
putchar('<');
while ((i = *bits++) != '\0') {
if (v & (1 << (i-1))) {
@@ -1377,7 +1375,8 @@
}
/* not present, we should try to load it */
- kldload(ifkind);
+ if (kldload(ifkind) < 0)
+ err(1, "kldload(%s)", ifkind);
}
static struct cmd basic_cmds[] = {
Index: head/sbin/ifconfig/iflagg.c
===================================================================
--- head/sbin/ifconfig/iflagg.c
+++ head/sbin/ifconfig/iflagg.c
@@ -200,24 +200,17 @@
lagg_status(int s)
{
struct lagg_protos lpr[] = LAGG_PROTOS;
- struct lagg_reqport rp, rpbuf[LAGG_MAX_PORTS];
+ struct lagg_reqport rpbuf[LAGG_MAX_PORTS];
struct lagg_reqall ra;
struct lagg_reqopts ro;
struct lagg_reqflags rf;
struct lacp_opreq *lp;
const char *proto = "<unknown>";
- int i, isport = 0;
+ int i;
- bzero(&rp, sizeof(rp));
bzero(&ra, sizeof(ra));
bzero(&ro, sizeof(ro));
- strlcpy(rp.rp_ifname, name, sizeof(rp.rp_ifname));
- strlcpy(rp.rp_portname, name, sizeof(rp.rp_portname));
-
- if (ioctl(s, SIOCGLAGGPORT, &rp) == 0)
- isport = 1;
-
strlcpy(ra.ra_ifname, name, sizeof(ra.ra_ifname));
ra.ra_size = sizeof(rpbuf);
ra.ra_port = rpbuf;
@@ -257,8 +250,6 @@
sep = ",";
}
}
- if (isport)
- printf(" laggdev %s", rp.rp_ifname);
putchar('\n');
if (verbose) {
printf("\tlagg options:\n");
Index: head/sbin/ifconfig/ifpfsync.c
===================================================================
--- head/sbin/ifconfig/ifpfsync.c
+++ head/sbin/ifconfig/ifpfsync.c
@@ -120,6 +120,7 @@
if (ioctl(s, SIOCSETPFSYNC, (caddr_t)&ifr) == -1)
err(1, "SIOCSETPFSYNC");
+ freeaddrinfo(peerres);
}
/* ARGSUSED */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 23, 10:19 PM (11 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16805764
Default Alt Text
D10587.id.diff (4 KB)
Attached To
Mode
D10587: Various Coverity fixes in ifconfig(8)
Attached
Detach File
Event Timeline
Log In to Comment