Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 598433 Details for
Bug 741195
arping cannot choose em1 to default ethernet device
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
[Patch] Look for "eth" or "em" in /proc/self/net/dev
iputils-20071127-eth.patch (text/plain), 2.19 KB, created by
Jan Synacek
on 2012-07-16 12:10:05 UTC
(
hide
)
Description:
[Patch] Look for "eth" or "em" in /proc/self/net/dev
Filename:
MIME Type:
Creator:
Jan Synacek
Created:
2012-07-16 12:10:05 UTC
Size:
2.19 KB
patch
obsolete
>--- iputils-s20071127/arping.c 2012-07-16 13:57:22.006701598 +0200 >+++ iputils-s20071127-new/arping.c 2012-07-16 14:02:26.766797919 +0200 >@@ -37,7 +37,7 @@ > static void usage(void) __attribute__((noreturn)); > > int quit_on_reply=0; >-char *device="eth0"; >+char *device=NULL; > int ifindex; > char *source; > struct in_addr src, dst; >@@ -70,6 +70,10 @@ int received=0, brd_recv, req_recv; > #define SYSFS_PATH_ENV "SYSFS_PATH" > #define SYSFS_PATH_LEN 256 > >+#define PREF_ETH "eth" >+#define PREF_EM "em" >+static char *dev_file="/proc/self/net/dev"; >+ > #define MS_TDIFF(tv1,tv2) ( ((tv1).tv_sec-(tv2).tv_sec)*1000 + \ > ((tv1).tv_usec-(tv2).tv_usec)/1000 ) > >@@ -368,6 +372,46 @@ char * read_sysfs_broadcast(char *brdcas > return brdcast; > } > >+/* >+ * get_first_ethernet - return the name of the first ethernet-style >+ * interface on this system. >+ */ >+char * get_first_ethernet(void) >+{ >+ FILE *f; >+ char buf[255], *dv, *smc; >+ char pci[16]; >+ >+ memset(pci, 0, sizeof(pci)); >+ if ((f = fopen(dev_file, "r")) != NULL) >+ { >+ // go through network dev file >+ while (fgets (buf, sizeof(buf), f) != NULL) >+ { >+ // the line describes interface >+ if ((smc = strchr(buf, ':')) != NULL) >+ { >+ // trim white characters >+ for (dv=buf, *smc=0; *dv <= ' '; dv++) ; >+ // is "eth" (originial ethernet name) or "em" (ethernet on board) >+ if (!strncmp(dv, PREF_ETH, strlen(PREF_ETH)) || >+ !strncmp(dv, PREF_EM, strlen(PREF_EM))) >+ { >+ return strdup(dv); >+ } >+ // remember the first pci NIC-card >+ if (strlen(pci) == 0 && dv[0] == 'p' && isdigit(dv[1])) >+ { >+ strcpy(pci, dv); >+ } >+ } >+ } >+ fclose(f); >+ } >+ // return pci NIC-card or nil if no if name >+ return strlen(pci) > 0 ? strdup(pci) : 0L; >+} >+ > int > main(int argc, char **argv) > { >@@ -383,6 +427,8 @@ main(int argc, char **argv) > exit(-1); > } > >+ device = get_first_ethernet(); >+ > while ((ch = getopt(argc, argv, "h?bfDUAqc:w:s:I:V")) != EOF) { > switch(ch) { > case 'b': >@@ -409,6 +455,10 @@ main(int argc, char **argv) > timeout = atoi(optarg); > break; > case 'I': >+ if (device) { >+ free(device); >+ device = NULL; >+ } > device = strdup(optarg); > break; > case 'f':
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 741195
: 598433