#include <string.h>
#include <unistd.h>
-#include "libbb.h"
+#include "busybox.h"
#define MAX_OPT_DEPTH 10
#define EUNBALBRACK 10001
llist_t *iface_list;
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) ||
+ if ((strcmp(tmp->iface, currif->iface) == 0) &&
(tmp->address_family == currif->address_family)) {
bb_error_msg("duplicate interface \"%s\"", tmp->iface);
return NULL;
return(NULL);
}
-extern int ifupdown_main(int argc, char **argv)
+int ifupdown_main(int argc, char **argv)
{
int (*cmds) (struct interface_defn_t *) = NULL;
struct interfaces_file_t *defn;
} else {
/* Remove an interface from the linked list */
if (iface_state) {
- /* This needs to be done better */
+ llist_t *l = iface_state->link;
free(iface_state->data);
- free(iface_state->link);
- if (iface_state->link) {
- iface_state->data = iface_state->link->data;
- iface_state->link = iface_state->link->link;
- } else {
- iface_state->data = NULL;
- iface_state->link = NULL;
+ iface_state->data = NULL;
+ iface_state->link = NULL;
+ if (l) {
+ iface_state->data = l->data;
+ iface_state->link = l->link;
}
+ free(l);
}
}
}