Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- asuswrt/release/src/router/rc/sysdeps/init-broadcom.c 2013-08-01 04:56:42.000000000 +0400
- +++ asuswrt-merlin/release/src/router/rc/sysdeps/init-broadcom.c 2014-05-01 22:38:17.639101537 +0400
- ...
- @@ -521,6 +1100,107 @@
- nvram_set(t->name, t->value);
- }
- }
- +#endif
- +
- +static void
- +reset_mssid_hwaddr(int unit)
- +{
- + char word[256], *next;
- + char macaddr_str[18], macbuf[13];
- + char *macaddr_strp;
- + unsigned char mac_binary[6];
- + unsigned long long macvalue;
- + unsigned char *macp;
- + int model = get_model();
- + int unit_total = 0, idx, subunit;
- + int max_mssid = num_of_mssid_support(unit);
- + char tmp[100], prefix[]="wlXXXXXXX_";
- +
- + foreach(word, nvram_safe_get("wl_ifnames"), next)
- + unit_total++;
- +
- + if (unit > (unit_total - 1))
- + return;
- +
- + for (idx = 0; idx < unit_total ; idx++) {
- + memset(mac_binary, 0x0, 6);
- + memset(macbuf, 0x0, 13);
- +
- + switch(model) {
- + case MODEL_RTN53:
- + case MODEL_RTN16:
- + case MODEL_RTN15U:
- + case MODEL_RTN12:
- + case MODEL_RTN12B1:
- + case MODEL_RTN12C1:
- + case MODEL_RTN12D1:
- + case MODEL_RTN12VP:
- + case MODEL_RTN12HP:
- + case MODEL_RTN12HP_B1:
- + case MODEL_APN12HP:
- + case MODEL_RTN14UHP:
- + case MODEL_RTN10U:
- + case MODEL_RTN10P:
- + case MODEL_RTN10D1:
- + case MODEL_RTN10PV2:
- + case MODEL_RTAC53U:
- + if (unit == 0) /* 2.4G */
- + snprintf(macaddr_str, sizeof(macaddr_str), "sb/1/macaddr");
- + else /* 5G */
- + snprintf(macaddr_str, sizeof(macaddr_str), "0:macaddr");
- + break;
- + case MODEL_RTN66U:
- + case MODEL_RTAC66U:
- + snprintf(macaddr_str, sizeof(macaddr_str), "pci/%d/1/macaddr", unit + 1);
- + break;
- + case MODEL_RTN18U:
- + case MODEL_RTAC68U:
- + case MODEL_RTAC87U:
- + case MODEL_RTAC56S:
- + case MODEL_RTAC56U:
- + snprintf(macaddr_str, sizeof(macaddr_str), "%d:macaddr", unit);
- + break;
- + default:
- +#ifdef RTCONFIG_BCMARM
- + snprintf(macaddr_str, sizeof(macaddr_str), "%d:macaddr", unit);
- +#else
- + snprintf(macaddr_str, sizeof(macaddr_str), "pci/%d/1/macaddr", unit + 1);
- +#endif
- + break;
- + }
- +
- + macaddr_strp = nvram_get(macaddr_str);
- + if (macaddr_strp)
- + {
- + if (!mssid_mac_validate(macaddr_strp))
- + return;
- +
- + if (idx != unit)
- + continue;
- +
- + ether_atoe(macaddr_strp, mac_binary);
- + sprintf(macbuf, "%02X%02X%02X%02X%02X%02X",
- + mac_binary[0],
- + mac_binary[1],
- + mac_binary[2],
- + mac_binary[3],
- + mac_binary[4],
- + mac_binary[5]);
- + macvalue = strtoll(macbuf, (char **) NULL, 16);
- +
- + /* including primary ssid */
- + for (subunit = 1; subunit < max_mssid + 1 ; subunit++)
- + {
- + macvalue++;
- + macp = (unsigned char*) &macvalue;
- + memset(macaddr_str, 0, sizeof(macaddr_str));
- + sprintf(macaddr_str, "%02X:%02X:%02X:%02X:%02X:%02X", *(macp+5), *(macp+4), *(macp+3), *(macp+2), *(macp+1), *(macp+0));
- + snprintf(prefix, sizeof(prefix), "wl%d.%d_", unit, subunit);
- + nvram_set(strcat_r(prefix, "hwaddr", tmp), macaddr_str);
- + }
- + } else return;
- + }
- +}
- void init_wl(void)
- {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement