Changeset View
Changeset View
Standalone View
Standalone View
sbin/ifconfig/ifconfig.c
Show First 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | |||||
int setaddr; | int setaddr; | ||||
int setmask; | int setmask; | ||||
int doalias; | int doalias; | ||||
int clearaddr; | int clearaddr; | ||||
int newaddr = 1; | int newaddr = 1; | ||||
int verbose; | int verbose; | ||||
int noload; | int noload; | ||||
int printifname = 0; | int printifname = 0; | ||||
int vfstatus = 0; | |||||
int supmedia = 0; | int supmedia = 0; | ||||
int printkeys = 0; /* Print keying material for interfaces. */ | int printkeys = 0; /* Print keying material for interfaces. */ | ||||
int exit_code = 0; | int exit_code = 0; | ||||
/* Formatter Strings */ | /* Formatter Strings */ | ||||
char *f_inet, *f_inet6, *f_ether, *f_addr; | char *f_inet, *f_inet6, *f_ether, *f_addr; | ||||
▲ Show 20 Lines • Show All 275 Lines • ▼ Show 20 Lines | main(int argc, char *argv[]) | ||||
/* | /* | ||||
* Ensure we print interface name when expected to, | * Ensure we print interface name when expected to, | ||||
* even if we terminate early due to error. | * even if we terminate early due to error. | ||||
*/ | */ | ||||
atexit(printifnamemaybe); | atexit(printifnamemaybe); | ||||
/* Parse leading line options */ | /* Parse leading line options */ | ||||
strlcpy(options, "f:adklmnuv", sizeof(options)); | strlcpy(options, "f:adklmnsuv", sizeof(options)); | ||||
marius: I don't particularly like the idea of adding "-s" (no real association with the VF status in… | |||||
Not Done Inline ActionsMy thought was that verbose might get too verbose with both SFP data and this info in it -- especially if you decide to add 128 VFs to a single port, which is currently possible on ixl. That said, I did this because I was experimenting to see what I could get away with in terms of editing ifconfig. I don't mind removing the option if this patch ends up being something that people seriously want. erj: My thought was that verbose might get too verbose with both SFP data and this info in it… | |||||
Not Done Inline ActionsWell, with 128 VFs on a single port, the 4 lines of SFP status at the verbosity level of 1 hardly should make it too verbose and at higher verbosity levels, the user really is asking for more output. But okay, let's see what others think. marius: Well, with 128 VFs on a single port, the 4 lines of SFP status at the verbosity level of 1… | |||||
for (p = opts; p != NULL; p = p->next) | for (p = opts; p != NULL; p = p->next) | ||||
strlcat(options, p->opt, sizeof(options)); | strlcat(options, p->opt, sizeof(options)); | ||||
while ((c = getopt(argc, argv, options)) != -1) { | while ((c = getopt(argc, argv, options)) != -1) { | ||||
switch (c) { | switch (c) { | ||||
case 'a': /* scan all interfaces */ | case 'a': /* scan all interfaces */ | ||||
all++; | all++; | ||||
break; | break; | ||||
case 'd': /* restrict scan to "down" interfaces */ | case 'd': /* restrict scan to "down" interfaces */ | ||||
Show All 11 Lines | case 'l': /* scan interface names only */ | ||||
namesonly++; | namesonly++; | ||||
break; | break; | ||||
case 'm': /* show media choices in status */ | case 'm': /* show media choices in status */ | ||||
supmedia = 1; | supmedia = 1; | ||||
break; | break; | ||||
case 'n': /* suppress module loading */ | case 'n': /* suppress module loading */ | ||||
noload++; | noload++; | ||||
break; | break; | ||||
case 's': /* print vf status, if any */ | |||||
vfstatus++; | |||||
break; | |||||
case 'u': /* restrict scan to "up" interfaces */ | case 'u': /* restrict scan to "up" interfaces */ | ||||
uponly++; | uponly++; | ||||
break; | break; | ||||
case 'v': | case 'v': | ||||
verbose++; | verbose++; | ||||
break; | break; | ||||
default: | default: | ||||
for (p = opts; p != NULL; p = p->next) | for (p = opts; p != NULL; p = p->next) | ||||
▲ Show 20 Lines • Show All 897 Lines • ▼ Show 20 Lines | #if 0 | ||||
} | } | ||||
#endif | #endif | ||||
if (allfamilies) | if (allfamilies) | ||||
af_other_status(s); | af_other_status(s); | ||||
else if (afp->af_other_status != NULL) | else if (afp->af_other_status != NULL) | ||||
afp->af_other_status(s); | afp->af_other_status(s); | ||||
strlcpy(ifs.ifs_name, name, sizeof ifs.ifs_name); | strlcpy(ifs.ifs_name, name, sizeof ifs.ifs_name); | ||||
if (ioctl(s, SIOCGIFSTATUS, &ifs) == 0) | if (ioctl(s, SIOCGIFSTATUS, &ifs) == 0) | ||||
printf("%s", ifs.ascii); | printf("%s", ifs.ascii); | ||||
if (vfstatus) | |||||
vf_status(s); | |||||
if (verbose > 0) | if (verbose > 0) | ||||
sfp_status(s, &ifr, verbose); | sfp_status(s, &ifr, verbose); | ||||
close(s); | close(s); | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 217 Lines • Show Last 20 Lines |
I don't particularly like the idea of adding "-s" (no real association with the VF status in particular) or actually adding any additional option for this; what's wrong with just adding the VF status to the verbose ("-v") information akin to the SFP data?