- NULL
- };
-
- currif = xzalloc(sizeof(struct interface_defn_t));
- iface_name = next_word(&buf_ptr);
- address_family_name = next_word(&buf_ptr);
- method_name = next_word(&buf_ptr);
-
- if (buf_ptr == NULL) {
- bb_error_msg("too few parameters for line \"%s\"", buf);
- return NULL;
- }
-
- /* ship any trailing whitespace */
- while (isspace(*buf_ptr)) {
- ++buf_ptr;
- }
-
- if (buf_ptr[0] != '\0') {
- bb_error_msg("too many parameters \"%s\"", buf);
- return NULL;
- }
-
- currif->iface = xstrdup(iface_name);
-
- currif->address_family = get_address_family(addr_fams, address_family_name);
- if (!currif->address_family) {
- bb_error_msg("unknown address type \"%s\"", address_family_name);
- return NULL;
+ NULL
+ };
+ char *iface_name;
+ char *address_family_name;
+ char *method_name;
+ llist_t *iface_list;
+
+ currif = xzalloc(sizeof(*currif));
+ iface_name = next_word(&rest_of_line);
+ address_family_name = next_word(&rest_of_line);
+ method_name = next_word(&rest_of_line);
+
+ if (method_name == NULL)
+ bb_error_msg_and_die("too few parameters for line \"%s\"", buf);
+
+ /* ship any trailing whitespace */
+ rest_of_line = skip_whitespace(rest_of_line);
+
+ if (rest_of_line[0] != '\0' /* && rest_of_line[0] != '#' */)
+ bb_error_msg_and_die("too many parameters \"%s\"", buf);
+
+ currif->iface = xstrdup(iface_name);
+
+ currif->address_family = get_address_family(addr_fams, address_family_name);
+ if (!currif->address_family)
+ bb_error_msg_and_die("unknown address type \"%s\"", address_family_name);
+
+ currif->method = get_method(currif->address_family, method_name);
+ if (!currif->method)
+ bb_error_msg_and_die("unknown method \"%s\"", method_name);
+
+ for (iface_list = defn->ifaces; iface_list; iface_list = iface_list->link) {
+ struct interface_defn_t *tmp = (struct interface_defn_t *) iface_list->data;
+ if ((strcmp(tmp->iface, currif->iface) == 0)
+ && (tmp->address_family == currif->address_family)
+ ) {
+ bb_error_msg_and_die("duplicate interface \"%s\"", tmp->iface);