diff --git a/mtcp/src/io_module.c b/mtcp/src/io_module.c
index ad3e01d..83e0893 100644
--- a/mtcp/src/io_module.c
+++ b/mtcp/src/io_module.c
@@ -63,6 +63,22 @@ GetNumQueues()
return queue_cnt;
}
/*----------------------------------------------------------------------------*/
+
+static int GetPortIndex(char *dev_name)
+{
+ char *p = dev_name;
+ long val = -1;
+ while (*p) { // While there are more characters to process...
+ if (isdigit(*p)) { // Upon finding a digit, ...
+ val = strtol(p, &p, 10); // Read a number, ...
+ } else {
+ p++;
+ }
+ }
+ return (int)val;
+}
+
+
int
SetInterfaceInfo(char* dev_name_list)
{
@@ -243,9 +259,10 @@ SetInterfaceInfo(char* dev_name_list)
CONFIG.eths[eidx].ip_addr = *(uint32_t *)&sin;
}
- if (ioctl(sock, SIOCGIFHWADDR, &ifr) == 0 ) {
+ if(strstr(iter_if->ifa_name, "dpdk") != NULL) {
+ ret = GetPortIndex(iter_if->ifa_name);
for (j = 0; j < ETH_ALEN; j ++) {
- CONFIG.eths[eidx].haddr[j] = ifr.ifr_addr.sa_data[j];
+ CONFIG.eths[eidx].haddr[j] = ports_eth_addr[ret].addr_bytes[j];
}
}
No comments:
Post a Comment