Merge branch 'iproute2-master' into iproute2-next

Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
David Ahern 2018-08-13 07:46:26 -07:00
commit c044be6b34
3 changed files with 12 additions and 17 deletions

View File

@ -49,9 +49,9 @@ static void usage(void) __attribute__((noreturn));
static void usage(void) static void usage(void)
{ {
if (do_link) { if (do_link)
iplink_usage(); iplink_usage();
}
fprintf(stderr, "Usage: ip address {add|change|replace} IFADDR dev IFNAME [ LIFETIME ]\n"); fprintf(stderr, "Usage: ip address {add|change|replace} IFADDR dev IFNAME [ LIFETIME ]\n");
fprintf(stderr, " [ CONFFLAG-LIST ]\n"); fprintf(stderr, " [ CONFFLAG-LIST ]\n");
fprintf(stderr, " ip address del IFADDR dev IFNAME [mngtmpaddr]\n"); fprintf(stderr, " ip address del IFADDR dev IFNAME [mngtmpaddr]\n");
@ -77,7 +77,7 @@ static void usage(void)
fprintf(stderr, " bridge | bond | ipoib | ip6tnl | ipip | sit | vxlan | lowpan |\n"); fprintf(stderr, " bridge | bond | ipoib | ip6tnl | ipip | sit | vxlan | lowpan |\n");
fprintf(stderr, " gre | gretap | erspan | ip6gre | ip6gretap | ip6erspan | vti |\n"); fprintf(stderr, " gre | gretap | erspan | ip6gre | ip6gretap | ip6erspan | vti |\n");
fprintf(stderr, " nlmon | can | bond_slave | ipvlan | geneve | bridge_slave |\n"); fprintf(stderr, " nlmon | can | bond_slave | ipvlan | geneve | bridge_slave |\n");
fprintf(stderr, " hsr | macsec | netdevsim\n"); fprintf(stderr, " hsr | macsec | netdevsim }\n");
exit(-1); exit(-1);
} }
@ -1946,7 +1946,7 @@ static int ipaddr_list_flush_or_save(int argc, char **argv, int action)
exit(1); exit(1);
} }
delete_json_obj(); delete_json_obj();
exit(0); goto out;
} }
if (filter.family != AF_PACKET) { if (filter.family != AF_PACKET) {

View File

@ -82,19 +82,13 @@ int netns_switch(char *name)
/* Mount a version of /sys that describes the network namespace */ /* Mount a version of /sys that describes the network namespace */
if (statvfs("/sys", &fsstat) < 0) { if (umount2("/sys", MNT_DETACH) < 0) {
fprintf(stderr, "could not stat /sys (not mounted?): %s\n",strerror(errno)); /* If this fails, perhaps there wasn't a sysfs instance mounted. Good. */
return -1; if (statvfs("/sys", &fsstat) == 0) {
} /* We couldn't umount the sysfs, we'll attempt to overlay it.
if (fsstat.f_flag & ST_RDONLY) { * A read-only instance can't be shadowed with a read-write one. */
/* If /sys is not writable (e.g. in a container), we can't if (fsstat.f_flag & ST_RDONLY)
* unmount the old /sys instance, but we can still mount a new mountflags = MS_RDONLY;
* read-only instance over it. */
mountflags = MS_RDONLY;
} else {
if (umount2("/sys", MNT_DETACH) < 0) {
fprintf(stderr, "umount of /sys failed: %s\n", strerror(errno));
return -1;
} }
} }
if (mount(name, "/sys", "sysfs", mountflags, NULL) < 0) { if (mount(name, "/sys", "sysfs", mountflags, NULL) < 0) {

View File

@ -405,6 +405,7 @@ static int batch(const char *name)
err = do_cmd(largc, largv, tail == NULL ? NULL : tail->buf, err = do_cmd(largc, largv, tail == NULL ? NULL : tail->buf,
tail == NULL ? 0 : sizeof(tail->buf)); tail == NULL ? 0 : sizeof(tail->buf));
fflush(stdout);
if (err != 0) { if (err != 0) {
fprintf(stderr, "Command failed %s:%d\n", name, fprintf(stderr, "Command failed %s:%d\n", name,
cmdlineno - 1); cmdlineno - 1);