diff options
author | Martin Mares <mj@ucw.cz> | 1999-08-03 19:30:49 +0000 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 1999-08-03 19:30:49 +0000 |
commit | 8edf2361f9c4bd745a1249db3f66dfc079dd2ca1 (patch) | |
tree | 5b97c4394925806715ea89a6c9fc61a0e44cdc1a /nest/iface.c | |
parent | 9273035403ace754e5b405b2c5efba7d55c28e78 (diff) |
Cleaned up handling of interface patterns:
o Parsing of interface patterns moved to generic code,
introduced this_ipatt which works similarly to this_iface.
o Interface patterns now support selection by both interface
names and primary IP addresses.
o Proto `direct' updated.
o RIP updated as well, it also seems the memory corruption
bug there is gone.
Diffstat (limited to 'nest/iface.c')
-rw-r--r-- | nest/iface.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/nest/iface.c b/nest/iface.c index 19ed7fbd..3a5d9c6b 100644 --- a/nest/iface.c +++ b/nest/iface.c @@ -588,13 +588,19 @@ iface_patt_match(list *l, struct iface *i) { char *t = p->pattern; int ok = 1; - if (*t == '-') + if (t) { - t++; - ok = 0; + if (*t == '-') + { + t++; + ok = 0; + } + if (!patmatch(t, i->name)) + continue; } - if (patmatch(t, i->name)) - return ok ? p : NULL; + if (!i->addr || !ipa_in_net(i->addr->ip, p->prefix, p->pxlen)) + continue; + return ok ? p : NULL; } return NULL; } @@ -608,7 +614,10 @@ iface_patts_equal(list *a, list *b, int (*comp)(struct iface_patt *, struct ifac y = HEAD(*b); while (x->n.next && y->n.next) { - if (strcmp(x->pattern, y->pattern) || comp && !comp(x, y)) + if (strcmp(x->pattern, y->pattern) || + !ipa_equal(x->prefix, y->prefix) || + x->pxlen != y->pxlen || + comp && !comp(x, y)) return 0; x = (void *) x->n.next; y = (void *) y->n.next; |