Revision 9a158361 nest/rt-dev.c
nest/rt-dev.c | ||
---|---|---|
19 | 19 |
#include "lib/resource.h" |
20 | 20 |
|
21 | 21 |
static void |
22 |
dev_if_notify(struct proto *p, unsigned c, struct iface *new, struct iface *old)
|
|
22 |
dev_ifa_notify(struct proto *p, unsigned c, struct ifa *ad)
|
|
23 | 23 |
{ |
24 | 24 |
struct rt_dev_config *P = (void *) p->cf; |
25 | 25 |
|
26 |
if (old && !iface_patt_match(&P->iface_list, old) || |
|
27 |
new && !iface_patt_match(&P->iface_list, new)) |
|
26 |
if (!iface_patt_match(&P->iface_list, ad->iface)) |
|
28 | 27 |
return; |
29 | 28 |
if (c & IF_CHANGE_DOWN) |
30 | 29 |
{ |
31 | 30 |
net *n; |
32 | 31 |
|
33 |
debug("dev_if_notify: %s going down\n", old->name);
|
|
34 |
n = net_find(p->table, old->prefix, old->pxlen);
|
|
32 |
DBG("dev_if_notify: %s:%I going down\n", ad->iface->name, ad->ip);
|
|
33 |
n = net_find(p->table, ad->prefix, ad->pxlen);
|
|
35 | 34 |
if (!n) |
36 | 35 |
{ |
37 | 36 |
debug("dev_if_notify: device shutdown: prefix not found\n"); |
... | ... | |
45 | 44 |
net *n; |
46 | 45 |
rte *e; |
47 | 46 |
|
48 |
debug("dev_if_notify: %s going up\n", new->name);
|
|
47 |
debug("dev_if_notify: %s:%I going up\n", ad->iface->name, ad->ip);
|
|
49 | 48 |
bzero(&A, sizeof(A)); |
50 | 49 |
A.proto = p; |
51 | 50 |
A.source = RTS_DEVICE; |
52 |
A.scope = (new->flags & IF_LOOPBACK) ? SCOPE_HOST : SCOPE_UNIVERSE;
|
|
51 |
A.scope = ad->scope;
|
|
53 | 52 |
A.cast = RTC_UNICAST; |
54 | 53 |
A.dest = RTD_DEVICE; |
55 |
A.iface = new;
|
|
54 |
A.iface = ad->iface;
|
|
56 | 55 |
A.attrs = NULL; |
57 | 56 |
a = rta_lookup(&A); |
58 |
if (new->flags & IF_UNNUMBERED)
|
|
59 |
n = net_get(p->table, new->opposite, new->pxlen);
|
|
57 |
if (ad->flags & IF_UNNUMBERED)
|
|
58 |
n = net_get(p->table, ad->opposite, ad->pxlen);
|
|
60 | 59 |
else |
61 |
n = net_get(p->table, new->prefix, new->pxlen);
|
|
60 |
n = net_get(p->table, ad->prefix, ad->pxlen);
|
|
62 | 61 |
e = rte_get_temp(a); |
63 | 62 |
e->net = n; |
64 | 63 |
e->pflags = 0; |
... | ... | |
71 | 70 |
{ |
72 | 71 |
struct proto *p = proto_new(c, sizeof(struct proto)); |
73 | 72 |
|
74 |
p->if_notify = dev_if_notify;
|
|
73 |
p->ifa_notify = dev_ifa_notify;
|
|
75 | 74 |
return p; |
76 | 75 |
} |
77 | 76 |
|
Also available in: Unified diff