[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ipcop-svn
Subject:    [Ipcop-svn] SF.net SVN: ipcop:[3135]
From:       owes () users ! sourceforge ! net
Date:       2009-06-27 11:57:51
Message-ID: E1MKWXX-0005wT-9w () d5vjzd1 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Revision: 3135
          http://ipcop.svn.sourceforge.net/ipcop/?rev=3135&view=rev
Author:   owes
Date:     2009-06-27 11:57:51 +0000 (Sat, 27 Jun 2009)

Log Message:
-----------
In case there are multiple, slightly different cards using the same kernelmodule, the \
NIC list can show wrong descriptions, which can confuse the user. Use the vendor and \
device ID, when available, to fix that.

Modified Paths:
--------------
    ipcop/trunk/src/installer/networking.c

Modified: ipcop/trunk/src/installer/networking.c
===================================================================
--- ipcop/trunk/src/installer/networking.c	2009-06-27 11:31:44 UTC (rev 3134)
+++ ipcop/trunk/src/installer/networking.c	2009-06-27 11:57:51 UTC (rev 3135)
@@ -176,14 +176,33 @@
 
         /* walk thru all interfaces and try to match to our information list */
         for (i = 0, j = 0; (i < newcards); i++) {
+            int found = 0;
             char *kernelmodule = getkernelmodule(scndir[i]->d_name);
 
+            /* First match on Vendor and Device ID (if present) */
+            fprintf(flog, "  %s %s %s %s\n", scndir[i]->d_name, kernelmodule, \
vendorid_buffer, deviceid_buffer); +            if ((strlen(vendorid_buffer) > 0) && \
(strlen(deviceid_buffer) > 0)) { +                for (k = 0; !found && (k < \
numnetwork); k++) { +                    if (!networks[k].device[0] && 
+                            (strlen(networks[k].vendorid) > 0) && \
!strcmp(networks[k].vendorid, vendorid_buffer) && +                            \
(strlen(networks[k].modelid) > 0) && !strcmp(networks[k].modelid, deviceid_buffer)) { \
+                        free(networks[k].device); +                        \
networks[k].device = strdup(scndir[i]->d_name); +                        \
networks[k].address = strdup(getmac(networks[k].device)); +                        \
fprintf(flog, "  hwlist %s device %s MAC %s\n",  +                            \
networks[k].module, networks[k].device, networks[k].address); +                       \
found = 1; +                        j++;
+                    }
+                }
+            }
+
             if (!kernelmodule[0]) {
                 fprintf(flog, "  no kernel module found for device %s\n", \
scndir[i]->d_name);  continue;
             }
 
-            for (k = 0; (k < numnetwork); k++) {
+            for (k = 0; !found && (k < numnetwork); k++) {
                 if (!networks[k].device[0] && !strcmp(kernelmodule, \
networks[k].module)) {  free(networks[k].device);
                     networks[k].device = strdup(scndir[i]->d_name);
@@ -262,6 +281,8 @@
             networks[numnetwork].description = hardwares[i].description;
             networks[numnetwork].colour = NONE;
             networks[numnetwork].address = strdup("");
+            networks[numnetwork].vendorid = hardwares[i].vendorid;
+            networks[numnetwork].modelid = hardwares[i].modelid;
 
             numnetwork++;
         }
@@ -282,15 +303,37 @@
             c = atoi(find_kv(eth_kv, key));
 
             for (j = 1; j <= c; j++) {
+                int found = 0;
+
                 /* Test if the configured device is still present */
                 snprintf(key, STRING_SIZE, "%s_%d_DEV", ipcop_colours_text[i], j);
                 if (exist_ethernet_device(find_kv(eth_kv, key)) == FAILURE) {
                     continue;
                 }
 
+                /* Check for Vendor / Device ID first */
+                getkernelmodule(find_kv(eth_kv, key));
+                if ((strlen(vendorid_buffer) > 0) && (strlen(deviceid_buffer) > 0)) \
{ +                    for (n = 0; !found && (n < numnetwork); n++) {
+                        if (!networks[n].device[0] && 
+                            (strlen(networks[n].vendorid) > 0) && \
!strcmp(networks[n].vendorid, vendorid_buffer) && +                            \
(strlen(networks[n].modelid) > 0) && !strcmp(networks[n].modelid, deviceid_buffer)) { \
+                            /* 6,5,4,3,2,1 meins */ +                            \
networks[n].colour = i; +                            snprintf(key, STRING_SIZE, \
"%s_%d_DEV", ipcop_colours_text[i], j); +                            \
networks[n].device = strdup(find_kv(eth_kv, key)); +
+                            /* owes: copy driver options here */
+
+                            /* find MAC address */
+                            networks[n].address = \
strdup(getmac(networks[n].device)); +                            found = 1;
+                        }
+                    }
+                }
+
                 snprintf(key, STRING_SIZE, "%s_%d_DRIVER", ipcop_colours_text[i], \
                j);
-
-                for (n = 0; n < numnetwork; n++) {
+                for (n = 0; !found && (n < numnetwork); n++) {
                     if (!networks[n].device[0] && (find_kv(eth_kv, key) != NULL)
                         && !strcmp(networks[n].module, find_kv(eth_kv, key))) {
                         /* 3,2,1 meins */


This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.

------------------------------------------------------------------------------
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic