diff options
Diffstat (limited to 'pingu_iface.c')
-rw-r--r-- | pingu_iface.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/pingu_iface.c b/pingu_iface.c index 4de0bc6..689d36b 100644 --- a/pingu_iface.c +++ b/pingu_iface.c @@ -85,7 +85,7 @@ struct pingu_iface *pingu_iface_get_by_index(int index) return NULL; } -struct pingu_iface *pingu_iface_find_or_create(struct ev_loop *loop, const char *name) +struct pingu_iface *pingu_iface_new(struct ev_loop *loop, const char *name) { struct pingu_iface *iface = pingu_iface_get_by_name(name); if (iface != NULL) @@ -132,8 +132,13 @@ int pingu_iface_init(struct ev_loop *loop, struct list_head *host_list) { struct pingu_host *host; struct pingu_iface *iface; + int autotbl = 10; list_for_each_entry(host, host_list, host_list_entry) { - iface = pingu_iface_find_or_create(loop, host->interface); + iface = pingu_iface_get_by_name(host->interface); + if (iface == NULL) { + iface = pingu_iface_new(loop, host->interface); + iface->route_table = autotbl++; + } if (iface == NULL) return -1; host->iface = iface; |