diff options
author | sam <sam@FreeBSD.org> | 2006-07-09 06:10:23 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2006-07-09 06:10:23 +0000 |
commit | 5fe5db7b92d100880e8e1049b140630a29d38514 (patch) | |
tree | 459ad9fd08735e01e8a354fad1a3b67f5cd31477 /sbin/ifconfig/ifconfig.c | |
parent | 2350e920372288f7ed8401d362497880b30dea50 (diff) | |
download | FreeBSD-src-5fe5db7b92d100880e8e1049b140630a29d38514.zip FreeBSD-src-5fe5db7b92d100880e8e1049b140630a29d38514.tar.gz |
o replace special handling of clone operations by a clone callback
mechanism
o change vlan cloning to use callback and pass all vlan parameters
on create using the new SIOCREATE2 ioctl
o update vlan set logic to match existing practice
Diffstat (limited to 'sbin/ifconfig/ifconfig.c')
-rw-r--r-- | sbin/ifconfig/ifconfig.c | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index a97b089..3f0172f 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -92,7 +92,6 @@ int verbose; int supmedia = 0; int printkeys = 0; /* Print keying material for interfaces. */ -int printname = 0; /* Print the name of the created interface. */ static int ifconfig(int argc, char *const *argv, const struct afswtch *afp); static void status(const struct afswtch *afp, int addrcount, @@ -234,21 +233,20 @@ main(int argc, char *argv[]) /* check and maybe load support for this interface */ ifmaybeload(name); - /* - * NOTE: We must special-case the `create' command right - * here as we would otherwise fail when trying to find - * the interface. - */ - if (argc > 0 && (strcmp(argv[0], "create") == 0 || - strcmp(argv[0], "plumb") == 0)) { - clone_create(); - argc--, argv++; - if (argc == 0) - goto end; - } ifindex = if_nametoindex(name); - if (ifindex == 0) + if (ifindex == 0) { + /* + * NOTE: We must special-case the `create' command + * right here as we would otherwise fail when trying + * to find the interface. + */ + if (argc > 0 && (strcmp(argv[0], "create") == 0 || + strcmp(argv[0], "plumb") == 0)) { + ifconfig(argc, argv, NULL); + exit(0); + } errx(1, "interface %s does not exist", name); + } } /* Check for address family */ @@ -356,9 +354,6 @@ retry: if (namesonly && need_nl > 0) putchar('\n'); -end: - if (printname) - printf("%s\n", name); exit (0); } @@ -782,12 +777,6 @@ setifname(const char *val, int dummy __unused, int s, } strlcpy(name, newname, sizeof(name)); free(newname); - - /* - * Even if we just created the interface, we don't need to print - * its name because we just nailed it down separately. - */ - printname = 0; } /* |