diff options
author | Tom Goff <thomas.goff@boeing.com> | 2010-11-10 13:00:54 -0800 |
---|---|---|
committer | Paul Jakma <paul@quagga.net> | 2011-03-21 13:30:54 +0000 |
commit | 4bd045d5dd28653af899c01d6f0c413d74677114 (patch) | |
tree | f1e633f50e4dc19b4b0cda9dc6e6feb46e3bab46 /lib/if.c | |
parent | c8e7b8959051bf525183bdbff605e54b4b532e2c (diff) |
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().
Diffstat (limited to 'lib/if.c')
-rw-r--r-- | lib/if.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -878,3 +878,21 @@ if_init (void) 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; +} |