[prev in list] [next in list] [prev in thread] [next in thread]
List: ipcop-svn
Subject: [Ipcop-svn] SF.net SVN: ipcop:[2146]
From: owes () users ! sourceforge ! net
Date: 2008-11-30 21:16:23
Message-ID: E1L6teR-0000wS-Rr () 74yxhf1 ! ch3 ! sourceforge ! com
[Download RAW message or body]
Revision: 2146
http://ipcop.svn.sourceforge.net/ipcop/?rev=2146&view=rev
Author: owes
Date: 2008-11-30 21:16:23 +0000 (Sun, 30 Nov 2008)
Log Message:
-----------
Hack udev persistent rules to rename network interfaces.
Modified Paths:
--------------
ipcop/trunk/src/installer/networking.c
Modified: ipcop/trunk/src/installer/networking.c
===================================================================
--- ipcop/trunk/src/installer/networking.c 2008-11-30 18:58:44 UTC (rev 2145)
+++ ipcop/trunk/src/installer/networking.c 2008-11-30 21:16:23 UTC (rev 2146)
@@ -459,6 +459,8 @@
update_kv(ð_kv, key, "");
snprintf(key, STRING_SIZE, "%s_1_DRIVER", colour);
update_kv(ð_kv, key, "");
+ snprintf(key, STRING_SIZE, "%s_1_MAC", colour);
+ update_kv(ð_kv, key, "");
snprintf(key, STRING_SIZE, "%s_COUNT", colour);
update_kv(ð_kv, key, "0");
}
@@ -467,6 +469,8 @@
update_kv(ð_kv, key, networks[n].device);
snprintf(key, STRING_SIZE, "%s_1_DRIVER", colour);
update_kv(ð_kv, key, networks[n].module);
+ snprintf(key, STRING_SIZE, "%s_1_MAC", colour);
+ update_kv(ð_kv, key, networks[n].address);
snprintf(key, STRING_SIZE, "%s_COUNT", colour);
update_kv(ð_kv, key, "1");
}
@@ -541,6 +545,47 @@
}
+/* Hack udev persistent-net-rules and ethernet/settings.
+*/
+static void udevconfig(void)
+{
+ int i;
+ int counter = 1;
+ char command[STRING_SIZE];
+ char device[STRING_SIZE];
+
+ /* set the device names with the help of udev */
+ for (i = 0; i < numnetwork; i++) {
+ if (networks[i].address[0]) {
+ if (!strcmp(networks[i].colour, ipcop_colours_text[NONE])) {
+ snprintf(device, STRING_SIZE, "unused_%d", counter++);
+ }
+ else if (!strcmp(networks[i].colour, ipcop_colours_text[GREEN])) {
+ strcpy(device, "lan_1");
+ update_kv(ð_kv, "GREEN_1_DEV", "lan_1");
+ }
+ else if (!strcmp(networks[i].colour, ipcop_colours_text[RED])) {
+ strcpy(device, "wan_1");
+ update_kv(ð_kv, "RED_1_DEV", "wan_1");
+ }
+ else if (!strcmp(networks[i].colour, ipcop_colours_text[BLUE])) {
+ strcpy(device, "wlan_1");
+ update_kv(ð_kv, "BLUE_1_DEV", "wlan_1");
+ }
+ else if (!strcmp(networks[i].colour, ipcop_colours_text[ORANGE])) {
+ strcpy(device, "dmz_1");
+ update_kv(ð_kv, "ORANGE_1_DEV", "dmz_1");
+ }
+
+ snprintf(command, STRING_SIZE, "/bin/sed -i -e \
's#\\(%s\\)\\(.*\\)NAME=\".*\"#\\1\\2NAME=\"%s\"#g' %s", + \
networks[i].address, device, + \
"/etc/udev/rules.d/70-persistent-net.rules"); + mysystem(command);
+ }
+ }
+}
+
+
/* window with field for module and options */
static void addmanual(void)
{
@@ -650,6 +695,10 @@
break;
case 3:
/* owes: ToDo test if we have green and possibly red here */
+
+ if (changed_config) {
+ udevconfig();
+ }
return;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
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