mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 02:53:55 +00:00
lib: Add a function to delete all interfaces
if.c: (if_terminate) This adds a cleanup function that can be called when a daemon exits, similar to vty_terminate().
This commit is contained in:
parent
13351032d1
commit
a809d1cc54
18
lib/if.c
18
lib/if.c
@ -872,3 +872,21 @@ if_init (void)
|
|||||||
|
|
||||||
memset (&if_master, 0, sizeof if_master);
|
memset (&if_master, 0, sizeof if_master);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
if_terminate (void)
|
||||||
|
{
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
struct interface *ifp;
|
||||||
|
|
||||||
|
ifp = listnode_head (iflist);
|
||||||
|
if (ifp == NULL)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if_delete (ifp);
|
||||||
|
}
|
||||||
|
|
||||||
|
list_delete (iflist);
|
||||||
|
iflist = NULL;
|
||||||
|
}
|
||||||
|
1
lib/if.h
1
lib/if.h
@ -266,6 +266,7 @@ extern int if_is_pointopoint (struct interface *);
|
|||||||
extern int if_is_multicast (struct interface *);
|
extern int if_is_multicast (struct interface *);
|
||||||
extern void if_add_hook (int, int (*)(struct interface *));
|
extern void if_add_hook (int, int (*)(struct interface *));
|
||||||
extern void if_init (void);
|
extern void if_init (void);
|
||||||
|
extern void if_terminate (void);
|
||||||
extern void if_dump_all (void);
|
extern void if_dump_all (void);
|
||||||
extern const char *if_flag_dump(unsigned long);
|
extern const char *if_flag_dump(unsigned long);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user