-
Notifications
You must be signed in to change notification settings - Fork 0
/
ifupdown.c
54 lines (48 loc) · 1.38 KB
/
ifupdown.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* system includes */
#include <stdlib.h>
/* ifupdown includes */
#include "ifupdown.h"
void
free_interfaces (interfaces_file *ifaces_file)
{
allowup_defn *allowup, *next_allowup;
int ifno, optno;
interface_defn *iface, *next_iface;
if (ifaces_file) {
if (ifaces_file->allowups) {
for (allowup = ifaces_file->allowups; allowup; allowup = next_allowup) {
next_allowup = allowup->next;
if (allowup->when)
free (allowup->when);
if (allowup->interfaces) {
for (ifno = 0; ifno < allowup->n_interfaces; ifno++) {
if (allowup->interfaces[ifno])
free (allowup->interfaces[ifno]);
}
free (allowup->interfaces);
}
free (allowup);
}
}
if (ifaces_file->ifaces) {
for (iface = ifaces_file->ifaces; iface; iface = next_iface) {
next_iface = iface->next;
if (iface->logical_iface)
free (iface->logical_iface);
if (iface->option) {
for (optno = 0; optno < iface->n_options; optno++) {
if (iface->option[optno].name)
free (iface->option[optno].name);
if (iface->option[optno].value)
free (iface->option[optno].value);
}
free (iface->option);
}
free (iface);
}
}
//if (ifaces_file->mappings) {
//}
free (ifaces_file);
}
}