Commit df490159 authored by Robert Ricci's avatar Robert Ricci
Browse files

Add a new feature so that Abhijeet can use it on delay nodes - the

-I switch now bypasses checks to only run on interfaces that have an
IP addres.
parent 0f7bff7a
...@@ -227,6 +227,11 @@ int add_all_ethernet = 0; ...@@ -227,6 +227,11 @@ int add_all_ethernet = 0;
*/ */
int no_zero = 0; int no_zero = 0;
/*
* Whether we should include or skip interfaces that have no IP address
*/
int include_ipless_interfaces = 0;
#ifdef EVENTSYS #ifdef EVENTSYS
/* /*
* Time to subtract out of each timestamp reported to clients - this allows * Time to subtract out of each timestamp reported to clients - this allows
...@@ -311,6 +316,8 @@ void usage(char *progname) { ...@@ -311,6 +316,8 @@ void usage(char *progname) {
"-o Print output to stdout\n" "-o Print output to stdout\n"
"-t tcpdump mode\n" "-t tcpdump mode\n"
"-b filter Use the given bpf filter\n" "-b filter Use the given bpf filter\n"
"-I Include interfaces that have no IP "
"address\n"
#ifdef EVENTSYS #ifdef EVENTSYS
"-e pid/eid Wait for a time start for experiment\n" "-e pid/eid Wait for a time start for experiment\n"
"-s server Use <server> for event server\n" "-s server Use <server> for event server\n"
...@@ -377,7 +384,7 @@ int main (int argc, char **argv) { ...@@ -377,7 +384,7 @@ int main (int argc, char **argv) {
/* /*
* Process command-line arguments * Process command-line arguments
*/ */
while ((ch = getopt(argc, argv, "f:i:e:hpnNzs:otb:")) != -1) while ((ch = getopt(argc, argv, "f:i:e:hpnNzs:otb:I")) != -1)
switch(ch) { switch(ch) {
case 'f': case 'f':
/* Find the first empty slot */ /* Find the first empty slot */
...@@ -424,6 +431,9 @@ int main (int argc, char **argv) { ...@@ -424,6 +431,9 @@ int main (int argc, char **argv) {
case 'h': case 'h':
usage(argv[0]); usage(argv[0]);
break; break;
case 'I':
include_ipless_interfaces = 1;
break;
default: default:
fprintf(stderr,"Bad argument\n"); fprintf(stderr,"Bad argument\n");
usage(argv[0]); usage(argv[0]);
...@@ -539,8 +549,10 @@ int main (int argc, char **argv) { ...@@ -539,8 +549,10 @@ int main (int argc, char **argv) {
/* /*
* Only care about INET4 interfaces * Only care about INET4 interfaces
*/ */
if (ifr->ifr_addr.sa_family != AF_INET) if (!include_ipless_interfaces) {
continue; if (ifr->ifr_addr.sa_family != AF_INET)
continue;
}
name = ifr->ifr_name; name = ifr->ifr_name;
if (!strcmp(name,lastname)) { if (!strcmp(name,lastname)) {
...@@ -587,8 +599,10 @@ int main (int argc, char **argv) { ...@@ -587,8 +599,10 @@ int main (int argc, char **argv) {
#else #else
if (getaddr(name,&ifaddr)) { if (getaddr(name,&ifaddr)) {
/* Has carrier, but no IP */ /* Has carrier, but no IP */
printf("down (with carrier)\n"); if (!include_ipless_interfaces) {
continue; printf("down (with carrier)\n");
continue;
}
} }
#endif #endif
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment