- lmac = ether_aton(str_macaddr);
- if (lmac == NULL)
- bb_error_msg_and_die("cannot parse MAC %s", str_macaddr);
- mac = xmalloc(ETH_ALEN);
- memcpy(mac, lmac, ETH_ALEN);
+ while (*selector) {
+ char *next;
+#endif
+ selector = skip_whitespace(selector);
+#if ENABLE_FEATURE_NAMEIF_EXTENDED
+ if (*selector == '\0')
+ break;
+ /* Search for the end .... */
+ next = skip_non_whitespace(selector);
+ if (*next)
+ *next++ = '\0';
+ /* Check for selectors, mac= is assumed */
+ if (strncmp(selector, "bus=", 4) == 0) {
+ ch->bus_info = xstrdup(selector + 4);
+ found_selector++;
+ } else if (strncmp(selector, "driver=", 7) == 0) {
+ ch->driver = xstrdup(selector + 7);
+ found_selector++;
+ } else {
+#endif
+ lmac = xmalloc(ETH_ALEN);
+ ch->mac = ether_aton_r(selector + (strncmp(selector, "mac=", 4) ? 0 : 4), lmac);
+ if (ch->mac == NULL)
+ bb_error_msg_and_die("cannot parse %s", selector);
+#if ENABLE_FEATURE_NAMEIF_EXTENDED
+ found_selector++;
+ };
+ selector = next;
+ }
+ if (found_selector == 0)
+ bb_error_msg_and_die("no selectors found for %s", ch->ifname);
+#endif
+}