aboutsummaryrefslogtreecommitdiffstats
path: root/pingu_iface.c
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-07-21 13:03:12 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2011-07-21 13:31:15 +0200
commit4e3d2e3093b9dcbb7d37ee3f18db8d6fa54f0deb (patch)
tree180f87fc5f167469fd66b7188cc611634ca50355 /pingu_iface.c
parentb1817e210a434bec5543c574c6846f6e114426a5 (diff)
downloadpingu-4e3d2e3093b9dcbb7d37ee3f18db8d6fa54f0deb.tar.bz2
pingu-4e3d2e3093b9dcbb7d37ee3f18db8d6fa54f0deb.tar.xz
pingu: add initial code to modify routing tables
For now we just create the alternate routing tables from table 10 and +1 for each new interface. First interface is 10, second is 11 etc.
Diffstat (limited to 'pingu_iface.c')
-rw-r--r--pingu_iface.c9
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;