Changeset 9124
- Timestamp:
- 02/27/08 02:27:17 (5 years ago)
- Location:
- src/router/services
- Files:
-
- 19 edited
-
networking/interface.c (modified) (3 diffs)
-
networking/network.c (modified) (2 diffs)
-
sysinit/defaults.c (modified) (1 diff)
-
sysinit/sysinit-broadcom.c (modified) (4 diffs)
-
sysinit/sysinit-ca8.c (modified) (1 diff)
-
sysinit/sysinit-dir300.c (modified) (3 diffs)
-
sysinit/sysinit-fonera.c (modified) (2 diffs)
-
sysinit/sysinit-gateworx.c (modified) (4 diffs)
-
sysinit/sysinit-ls5.c (modified) (1 diff)
-
sysinit/sysinit-magicbox.c (modified) (1 diff)
-
sysinit/sysinit-mr3202a.c (modified) (1 diff)
-
sysinit/sysinit-newmedia-dual.c (modified) (1 diff)
-
sysinit/sysinit-pb42.c (modified) (1 diff)
-
sysinit/sysinit-rb532.c (modified) (1 diff)
-
sysinit/sysinit-supergerry.c (modified) (1 diff)
-
sysinit/sysinit-whrag108.c (modified) (1 diff)
-
sysinit/sysinit-wrt300nv2.c (modified) (2 diffs)
-
sysinit/sysinit-x86.c (modified) (1 diff)
-
sysinit/sysinit.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/router/services/networking/interface.c
r9116 r9124 222 222 s = socket (AF_INET, SOCK_RAW, IPPROTO_RAW); 223 223 strcpy (mac, nvram_safe_get ("et0macaddr")); 224 224 int vlanswap=0; 225 int ast=0; 226 if (nvram_match("vlan1ports","4 5")) 227 vlanswap=1; 228 if (nvram_natch("vlan0ports","0 1 2 3 5*")) 229 ast=1; 225 230 // if (nvram_match ("trunking", "1")) 226 231 // system ("echo 1 > /proc/sys/dev/adm6996/trunk"); … … 253 258 { 254 259 snprintf (buff, 9, "%d", tmp); 260 eval ("vconfig", "set_name_type", "VLAN_PLUS_VID_NO_PAD"); 255 261 eval ("vconfig", "add", "eth0", buff); 262 snprintf (buff, 9, "vlan%d", i); 263 ifconfig (buff, 0, NULL, NULL); 256 264 } 257 sprintf ((char *) &portsettings[tmp][0], "%s %d", 258 (char *) &portsettings[tmp][0], i); 265 int use = i; 266 if (i==0 && vlanswap==1)use = 4; 267 else 268 if (i==4 && vlanswap==1)use = 0; 269 270 271 sprintf ((char *) &portsettings[tmp][0], "%s %d", 272 (char *) &portsettings[tmp][0], use); 259 273 } 260 274 else 261 275 { 262 if (tmp == 16) 276 if (tmp == 16 && ast) 277 strcat ((char *) &portsettings[lastvlan][0], "*"); 278 if (tmp == 16 && !ast) 263 279 strcat ((char *) &portsettings[lastvlan][0], "t"); 264 280 if (tmp == 17) … … 308 324 } 309 325 } 326 /* 310 327 for (i = 0; i < 16; i++) 311 328 { 312 fprintf (stderr, "vlan setting %s\n", portsettings[i]); 329 sprintf (tmp, "echo "" > /proc/switch/eth0/vlan/%d/ports",i); 330 system2 (tmp); 331 } 332 for (i = 0; i < 16; i++) 333 { 334 sprintf (tmp, "echo %s > /proc/switch/eth0/vlan/%d/ports",portsettings[i], i); 335 system2 (tmp); 336 }*/ 337 for (i = 0; i < 16; i++) 338 { 339 fprintf(stderr,"echo %s > /proc/switch/eth0/vlan/%d/ports\n",portsettings[i], i); 313 340 } 314 341 return ret; -
src/router/services/networking/network.c
r9114 r9124 2431 2431 if (!strncmp (pppoe_wan_ifname, "vlan", 4)) 2432 2432 { 2433 sprintf (vlannic, "eth0.0007", pppoe_wan_ifname);2434 2433 if (nvram_match ("wan_vdsl", "1")) 2435 2434 { 2436 enable_dtag_vlan (1); 2435 char *ifn=enable_dtag_vlan (1); 2436 sprintf (vlannic, "%s.0007", ifn); 2437 2437 if (!ifexists (vlannic)) 2438 2438 { 2439 2439 eval ("vconfig", "set_name_type", "DEV_PLUS_VID"); 2440 eval ("vconfig", "add", "eth0", "7");2440 eval ("vconfig", "add", if, "7"); 2441 2441 eval ("ifconfig", vlannic, "up"); 2442 2442 } … … 2445 2445 else 2446 2446 { 2447 enable_dtag_vlan (0); 2447 char *ifn=enable_dtag_vlan (0); 2448 sprintf (vlannic, "%s.0007", ifn); 2448 2449 if (ifexists (vlannic)) 2449 2450 eval ("vconfig", "rem", vlannic); -
src/router/services/sysinit/defaults.c
r9117 r9124 2264 2264 {"reconnect_hours", "0", 0}, 2265 2265 {"reconnect_minutes", "0", 0}, 2266 {"af_enable", "0",0},2267 {"af_email", "",0},2268 {"af_ssid", "0",0},2269 {"af_ssid_name", "AnchorFree WiFi",0},2270 {"af_address", "",0},2271 {"af_address_2", "",0},2272 {"af_city", "",0},2273 {"af_zip", "",0},2274 {"af_state", "",0},2275 {"af_country", "",0},2276 {"af_category", "0",0},2277 {"af_publish", "1",0},2278 {"af_agree", "0",0},2266 {"af_enable", "0", 0}, 2267 {"af_email", "", 0}, 2268 {"af_ssid", "0", 0}, 2269 {"af_ssid_name", "AnchorFree WiFi", 0}, 2270 {"af_address", "", 0}, 2271 {"af_address_2", "", 0}, 2272 {"af_city", "", 0}, 2273 {"af_zip", "", 0}, 2274 {"af_state", "", 0}, 2275 {"af_country", "", 0}, 2276 {"af_category", "0", 0}, 2277 {"af_publish", "1", 0}, 2278 {"af_agree", "0", 0}, 2279 2279 {0, 0, 0} 2280 2280 }; -
src/router/services/sysinit/sysinit-broadcom.c
r9115 r9124 1156 1156 1157 1157 1158 void 1158 char * 1159 1159 enable_dtag_vlan (int enable) 1160 1160 { 1161 1161 char *vlan7ports = NULL; 1162 vlan7ports="4t 5"; 1163 if (nvram_match("vlan1ports","4 5")) 1164 { 1165 vlan7ports="4t 5"; 1166 } 1167 if (nvram_match("vlan1ports","0 5")) 1168 { 1169 vlan7ports="0t 5"; 1162 vlan7ports = "4t 5"; 1163 if (nvram_match ("vlan1ports", "4 5")) 1164 { 1165 vlan7ports = "4t 5"; 1166 } 1167 if (nvram_match ("vlan1ports", "0 5")) 1168 { 1169 vlan7ports = "0t 5"; 1170 } 1171 if (nvram_match ("vlan2ports", "0 8") || nvram_match ("vlan2ports", "0 8*")) 1172 { 1173 char *eth = "eth1"; 1174 vlan7ports = "0t 8"; 1175 char *save_ports2 = nvram_safe_get ("vlan2ports"); 1176 if (getRouterBrand () == ROUTER_WRT600N) 1177 eth = "eth2"; 1178 if (enable) 1179 { 1180 nvram_set ("vlan2ports", ""); 1181 nvram_set ("vlan7ports", vlan7ports); 1182 } 1183 stop_lan (); 1184 eval ("ifconfig", eth, "down"); 1185 eval ("rmmod", "bcm57xxlsys"); 1186 eval ("insmod", "bcm57xxlsys"); 1187 eval ("ifconfig", eth, "up"); 1188 start_config_vlan (); 1189 start_lan (); 1190 if (enable) 1191 { 1192 nvram_set ("vlan2ports", save_ports2); 1193 nvram_set ("vlan7ports", ""); 1194 } 1195 return eth; 1170 1196 } 1171 1197 system2 ("echo 1 > /proc/switch/eth0/reset"); … … 1174 1200 if (enable) 1175 1201 { 1176 sprintf (tmp, "echo %s > /proc/switch/eth0/vlan/1/ports", "");1202 sprintf (tmp, "echo %s > /proc/switch/eth0/vlan/1/ports", ""); 1177 1203 system2 (tmp); 1178 sprintf (tmp, "echo %s > /proc/switch/eth1/vlan/1/ports", "");1204 sprintf (tmp, "echo %s > /proc/switch/eth1/vlan/1/ports", ""); 1179 1205 system2 (tmp); 1180 sprintf (tmp, "echo %s > /proc/switch/eth0/vlan/0/ports",nvram_safe_get ("vlan0ports")); 1206 sprintf (tmp, "echo %s > /proc/switch/eth0/vlan/0/ports", 1207 nvram_safe_get ("vlan0ports")); 1181 1208 system2 (tmp); 1182 sprintf (tmp, "echo %s > /proc/switch/eth1/vlan/0/ports",nvram_safe_get ("vlan0ports")); 1209 sprintf (tmp, "echo %s > /proc/switch/eth1/vlan/0/ports", 1210 nvram_safe_get ("vlan0ports")); 1183 1211 system2 (tmp); 1184 1212 sprintf (tmp, "echo %s > /proc/switch/eth0/vlan/7/ports", vlan7ports); … … 1192 1220 for (i = 0; i < 16; i++) 1193 1221 { 1194 sprintf (tmp, "echo %s > /proc/switch/eth0/vlan/%d/ports", 1195 "", i); 1222 sprintf (tmp, "echo %s > /proc/switch/eth0/vlan/%d/ports", "", i); 1196 1223 system2 (tmp); 1197 sprintf (tmp, "echo %s > /proc/switch/eth1/vlan/%d/ports", 1198 "", i); 1224 sprintf (tmp, "echo %s > /proc/switch/eth1/vlan/%d/ports", "", i); 1199 1225 system2 (tmp); 1200 1226 } … … 1213 1239 } 1214 1240 } 1215 1241 FILE *in = fopen ("/proc/switch/eth0/reset", "rb"); 1242 if (in == NULL) 1243 return "eth1"; 1244 fclose (in); 1245 return "eth0"; 1216 1246 } 1217 start_dtag(void) 1247 1248 start_dtag (void) 1218 1249 { 1219 enable_dtag_vlan(1);1250 enable_dtag_vlan (1); 1220 1251 } -
src/router/services/sysinit/sysinit-ca8.c
r9114 r9124 143 143 } 144 144 145 void enable_dtag_vlan(int enable) 145 void 146 enable_dtag_vlan (int enable) 146 147 { 147 148 -
src/router/services/sysinit/sysinit-dir300.c
r9114 r9124 96 96 FILE *fp = fopen ("/dev/mtdblock/6", "rb"); 97 97 if (fp) 98 {99 fseek (fp, 0x1000, SEEK_SET);100 unsigned int test;101 fread (&test, 4, 1, fp);102 if (test != 0xffffffff)103 98 { 104 fprintf (stderr, 105 "radio config fixup is required to clean bad stuff out of memory, otherwise the radio config cannot be detected\n"); 106 fseek (fp, 0, SEEK_SET); 107 char *block = (char *) malloc (65536); 108 fread (block, 65536, 1, fp); 99 fseek (fp, 0x1000, SEEK_SET); 100 unsigned int test; 101 fread (&test, 4, 1, fp); 102 if (test != 0xffffffff) 103 { 104 fprintf (stderr, 105 "radio config fixup is required to clean bad stuff out of memory, otherwise the radio config cannot be detected\n"); 106 fseek (fp, 0, SEEK_SET); 107 char *block = (char *) malloc (65536); 108 fread (block, 65536, 1, fp); 109 fclose (fp); 110 int i; 111 for (i = 0x1000; i < 65536; i++) 112 block[i] = 0xff; 113 fp = fopen ("/tmp/radio", "wb"); 114 fwrite (block, 65536, 1, fp); 115 eval ("mtd", "-f", "write", "/tmp/radio", "board_config"); //writes back new config and reboots 116 eval ("event", "5", "1", "15"); 117 } 109 118 fclose (fp); 110 int i;111 for (i = 0x1000; i < 65536; i++)112 block[i] = 0xff;113 fp = fopen ("/tmp/radio", "wb");114 fwrite (block, 65536, 1, fp);115 eval ("mtd", "-f", "write", "/tmp/radio", "board_config"); //writes back new config and reboots116 eval ("event", "5", "1", "15");117 119 } 118 fclose (fp);119 }120 120 121 121 … … 132 132 if (getRouterBrand () == ROUTER_BOARD_FONERA2200) 133 133 { 134 eval ("ifconfig", "eth0", "up"); // required for vlan config 135 eval ("/sbin/vconfig", "set_name_type", "VLAN_PLUS_VID_NO_PAD"); 136 eval ("/sbin/vconfig", "add", "eth0", "0"); 137 eval ("/sbin/vconfig", "add", "eth0", "1"); 138 }else 134 eval ("ifconfig", "eth0", "up"); // required for vlan config 135 eval ("/sbin/vconfig", "set_name_type", "VLAN_PLUS_VID_NO_PAD"); 136 eval ("/sbin/vconfig", "add", "eth0", "0"); 137 eval ("/sbin/vconfig", "add", "eth0", "1"); 138 } 139 else 139 140 { 140 vlan_init (5); // 4 lan + 1 wan141 }141 vlan_init (5); // 4 lan + 1 wan 142 } 142 143 // eval ("insmod", "ipv6"); 143 144 … … 166 167 { 167 168 } 168 void enable_dtag_vlan(int enable) 169 void 170 enable_dtag_vlan (int enable) 169 171 { 170 172 -
src/router/services/sysinit/sysinit-fonera.c
r9114 r9124 116 116 if (getRouterBrand () == ROUTER_BOARD_FONERA2200) 117 117 { 118 eval ("ifconfig", "eth0", "up"); // required for vlan config119 eval ("/sbin/vconfig", "set_name_type", "VLAN_PLUS_VID_NO_PAD");120 eval ("/sbin/vconfig", "add", "eth0", "0");121 eval ("/sbin/vconfig", "add", "eth0", "1");118 eval ("ifconfig", "eth0", "up"); // required for vlan config 119 eval ("/sbin/vconfig", "set_name_type", "VLAN_PLUS_VID_NO_PAD"); 120 eval ("/sbin/vconfig", "add", "eth0", "0"); 121 eval ("/sbin/vconfig", "add", "eth0", "1"); 122 122 } 123 123 // eval ("insmod", "ipv6"); … … 147 147 { 148 148 } 149 void enable_dtag_vlan(int enable) 149 void 150 enable_dtag_vlan (int enable) 150 151 { 151 152 -
src/router/services/sysinit/sysinit-gateworx.c
r9114 r9124 97 97 if (res == 1) 98 98 { 99 in = popen ("/bin/cat /dev/mtdblock/0|/bin/grep \"2\\.03\"|wc -l", "rb"); 99 in = 100 popen ("/bin/cat /dev/mtdblock/0|/bin/grep \"2\\.03\"|wc -l", "rb"); 100 101 fscanf (in, "%d", &res2); 101 102 pclose (in); … … 196 197 #ifndef HAVE_TONZE 197 198 #ifndef HAVE_NOP8670 198 checkupdate ();199 checkupdate (); 199 200 #endif 200 201 #endif … … 272 273 FILE *file = fopen (filename, "r"); 273 274 if (file) 274 {275 unsigned char buf[16];276 fseek(file,0x422,SEEK_SET);277 fread (&buf[0], 6, 1, file);278 char mac[16];279 sprintf (mac, "%02x:%02x:%02x:%02x:%02x:%02x", buf[0], buf[1], buf[2],280 buf[3], buf[4], buf[5]);281 eval ("ifconfig", "ixp0", "hw", "ether", mac);282 fseek(file,0x43b,SEEK_SET);283 fread (&buf[6], 6, 1, file);284 sprintf (mac, "%02x:%02x:%02x:%02x:%02x:%02x", buf[6], buf[7], buf[8],285 buf[9], buf[10], buf[11]);286 eval ("ifconfig", "ixp1", "hw", "ether", mac);287 fclose (file);288 }275 { 276 unsigned char buf[16]; 277 fseek (file, 0x422, SEEK_SET); 278 fread (&buf[0], 6, 1, file); 279 char mac[16]; 280 sprintf (mac, "%02x:%02x:%02x:%02x:%02x:%02x", buf[0], buf[1], buf[2], 281 buf[3], buf[4], buf[5]); 282 eval ("ifconfig", "ixp0", "hw", "ether", mac); 283 fseek (file, 0x43b, SEEK_SET); 284 fread (&buf[6], 6, 1, file); 285 sprintf (mac, "%02x:%02x:%02x:%02x:%02x:%02x", buf[6], buf[7], buf[8], 286 buf[9], buf[10], buf[11]); 287 eval ("ifconfig", "ixp1", "hw", "ether", mac); 288 fclose (file); 289 } 289 290 #else 290 291 char *filename = "/sys/devices/platform/IXP4XX-I2C.0/i2c-adapter:i2c-0/0-0051/eeprom"; /* bank2=0x100 */ 291 292 FILE *file = fopen (filename, "r"); 292 293 if (file) 293 {294 unsigned char buf[16];295 fread (&buf[0], 16, 1, file);296 char mac[16];297 sprintf (mac, "%02x:%02x:%02x:%02x:%02x:%02x", buf[0], buf[1], buf[2],298 buf[3], buf[4], buf[5]);299 eval ("ifconfig", "ixp0", "hw", "ether", mac);300 sprintf (mac, "%02x:%02x:%02x:%02x:%02x:%02x", buf[6], buf[7], buf[8],301 buf[9], buf[10], buf[11]);302 eval ("ifconfig", "ixp1", "hw", "ether", mac);303 304 305 fclose (file);306 }294 { 295 unsigned char buf[16]; 296 fread (&buf[0], 16, 1, file); 297 char mac[16]; 298 sprintf (mac, "%02x:%02x:%02x:%02x:%02x:%02x", buf[0], buf[1], buf[2], 299 buf[3], buf[4], buf[5]); 300 eval ("ifconfig", "ixp0", "hw", "ether", mac); 301 sprintf (mac, "%02x:%02x:%02x:%02x:%02x:%02x", buf[6], buf[7], buf[8], 302 buf[9], buf[10], buf[11]); 303 eval ("ifconfig", "ixp1", "hw", "ether", mac); 304 305 306 fclose (file); 307 } 307 308 308 309 … … 357 358 { 358 359 } 359 void enable_dtag_vlan(int enable) 360 { 361 362 } 360 void 361 enable_dtag_vlan (int enable) 362 { 363 364 } -
src/router/services/sysinit/sysinit-ls5.c
r9114 r9124 143 143 { 144 144 } 145 void enable_dtag_vlan(int enable) 145 void 146 enable_dtag_vlan (int enable) 146 147 { 147 148 -
src/router/services/sysinit/sysinit-magicbox.c
r9114 r9124 176 176 { 177 177 } 178 void enable_dtag_vlan(int enable) 178 void 179 enable_dtag_vlan (int enable) 179 180 { 180 181 -
src/router/services/sysinit/sysinit-mr3202a.c
r9114 r9124 139 139 { 140 140 } 141 void enable_dtag_vlan(int enable) 141 void 142 enable_dtag_vlan (int enable) 142 143 { 143 144 -
src/router/services/sysinit/sysinit-newmedia-dual.c
r9114 r9124 160 160 { 161 161 } 162 void enable_dtag_vlan(int enable) 162 void 163 enable_dtag_vlan (int enable) 163 164 { 164 165 -
src/router/services/sysinit/sysinit-pb42.c
r9114 r9124 137 137 { 138 138 } 139 void enable_dtag_vlan(int enable) 139 void 140 enable_dtag_vlan (int enable) 140 141 { 141 142 -
src/router/services/sysinit/sysinit-rb532.c
r9114 r9124 173 173 { 174 174 } 175 void enable_dtag_vlan(int enable) 175 void 176 enable_dtag_vlan (int enable) 176 177 { 177 178 -
src/router/services/sysinit/sysinit-supergerry.c
r9114 r9124 150 150 { 151 151 } 152 void enable_dtag_vlan(int enable) 152 void 153 enable_dtag_vlan (int enable) 153 154 { 154 155 -
src/router/services/sysinit/sysinit-whrag108.c
r9114 r9124 244 244 { 245 245 } 246 void enable_dtag_vlan(int enable) 247 { 248 249 } 246 void 247 enable_dtag_vlan (int enable) 248 { 249 250 } -
src/router/services/sysinit/sysinit-wrt300nv2.c
r9114 r9124 175 175 FILE *file = fopen (filename, "r"); 176 176 if (file) 177 {178 unsigned char buf[16];179 fseek (file,0x5ffa0,SEEK_SET);//point of mac address180 fread (&buf[0], 6, 1, file);181 char mac[16];182 sprintf (mac, "%02x:%02x:%02x:%02x:%02x:%02x", buf[0], buf[1], buf[2],183 buf[3], buf[4], buf[5]);184 fprintf(stderr,"configure primary mac %s\n",mac);185 eval ("ifconfig", "ixp0", "hw", "ether", mac);186 eval ("ifconfig", "wifi0", "hw", "ether", mac);187 nvram_set("et0macaddr",mac);188 MAC_ADD(mac);189 fprintf(stderr,"configure secondary mac %s\n",mac);190 eval ("ifconfig", "ixp1", "hw", "ether", mac);191 192 193 fclose (file);194 }177 { 178 unsigned char buf[16]; 179 fseek (file, 0x5ffa0, SEEK_SET); //point of mac address 180 fread (&buf[0], 6, 1, file); 181 char mac[16]; 182 sprintf (mac, "%02x:%02x:%02x:%02x:%02x:%02x", buf[0], buf[1], buf[2], 183 buf[3], buf[4], buf[5]); 184 fprintf (stderr, "configure primary mac %s\n", mac); 185 eval ("ifconfig", "ixp0", "hw", "ether", mac); 186 eval ("ifconfig", "wifi0", "hw", "ether", mac); 187 nvram_set ("et0macaddr", mac); 188 MAC_ADD (mac); 189 fprintf (stderr, "configure secondary mac %s\n", mac); 190 eval ("ifconfig", "ixp1", "hw", "ether", mac); 191 192 193 fclose (file); 194 } 195 195 eval ("ifconfig", "ixp0", "0.0.0.0", "up"); 196 196 eval ("ifconfig", "ixp1", "0.0.0.0", "up"); … … 223 223 { 224 224 } 225 void enable_dtag_vlan(int enable) 226 { 227 228 } 225 void 226 enable_dtag_vlan (int enable) 227 { 228 229 } -
src/router/services/sysinit/sysinit-x86.c
r9114 r9124 401 401 { 402 402 } 403 void enable_dtag_vlan(int enable) 404 { 405 406 } 403 void 404 enable_dtag_vlan (int enable) 405 { 406 407 } -
src/router/services/sysinit/sysinit.c
r9081 r9124 140 140 if (nvram_match ("radiooff_button", "1") 141 141 && nvram_match ("radiooff_boot_off", "1")) 142 eval ("wl", "-i", get_wl_instance_name (0), "radio", "off");142 eval ("wl", "-i", get_wl_instance_name (0), "radio", "off"); 143 143 #endif 144 144 #endif … … 588 588 case ROUTER_BUFFALO_WZRRSG54: 589 589 linux_overrides = generic; 590 break;590 break; 591 591 #ifndef HAVE_BUFFALO 592 592 case ROUTER_ASUS_WL500GD:
Note: See TracChangeset
for help on using the changeset viewer.
