Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,39 @@ add_interface(char *ifname, struct interface_conf *if_conf)
return ifp;
}

void
remove_interface(char *ifname)
{
struct interface *tmp_ifp, *ifp = NULL;

if(interfaces == NULL)
return;

if(strcmp(interfaces->name, ifname) == 0) {
tmp_ifp = interfaces;
interface_updown(tmp_ifp, 0);
interfaces = tmp_ifp->next;
free(tmp_ifp);
return;
}

FOR_ALL_INTERFACES(ifp) {
if(ifp->next == NULL)
break;
if(strcmp(ifp->next->name, ifname) == 0) {
break;
}
}

if(ifp->next == NULL)
return;

tmp_ifp = ifp->next;
interface_updown(tmp_ifp, 0);
ifp->next = tmp_ifp->next;
free(tmp_ifp);
}

int
flush_interface(char *ifname)
{
Expand Down
1 change: 1 addition & 0 deletions interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ if_up(struct interface *ifp)
}

struct interface *add_interface(char *ifname, struct interface_conf *if_conf);
void remove_interface(char *ifname);
int flush_interface(char *ifname);
unsigned jitter(struct buffered *buf, int urgent);
unsigned update_jitter(struct interface *ifp, int urgent);
Expand Down
1 change: 1 addition & 0 deletions local.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ struct xroute;
#define LOCAL_FLUSH 0
#define LOCAL_ADD 1
#define LOCAL_CHANGE 2
#define LOCAL_REMOVE 3

#ifndef MAX_LOCAL_SOCKETS
#define MAX_LOCAL_SOCKETS 4
Expand Down