]>
git.ipfire.org Git - thirdparty/bird.git/blob - nest/rt-dev.c
2 * BIRD -- Direct Device Routes
4 * (c) 1998--1999 Martin Mares <mj@ucw.cz>
6 * Can be freely distributed and used under the terms of the GNU GPL.
13 #include "nest/bird.h"
14 #include "nest/iface.h"
15 #include "nest/protocol.h"
16 #include "nest/route.h"
17 #include "nest/rt-dev.h"
18 #include "conf/conf.h"
19 #include "lib/resource.h"
22 dev_ifa_notify(struct proto
*p
, unsigned c
, struct ifa
*ad
)
24 struct rt_dev_config
*P
= (void *) p
->cf
;
26 if (!EMPTY_LIST(P
->iface_list
) &&
27 !iface_patt_match(&P
->iface_list
, ad
->iface
))
28 /* Empty list is automagically treated as "*" */
30 if (c
& IF_CHANGE_DOWN
)
34 DBG("dev_if_notify: %s:%I going down\n", ad
->iface
->name
, ad
->ip
);
35 n
= net_find(p
->table
, ad
->prefix
, ad
->pxlen
);
38 debug("dev_if_notify: device shutdown: prefix not found\n");
41 rte_update(p
->table
, n
, p
, NULL
);
43 else if (c
& IF_CHANGE_UP
)
49 debug("dev_if_notify: %s:%I going up\n", ad
->iface
->name
, ad
->ip
);
52 A
.source
= RTS_DEVICE
;
59 if (ad
->flags
& IF_UNNUMBERED
)
60 n
= net_get(p
->table
, ad
->opposite
, ad
->pxlen
);
62 n
= net_get(p
->table
, ad
->prefix
, ad
->pxlen
);
66 rte_update(p
->table
, n
, p
, e
);
71 dev_init(struct proto_config
*c
)
73 struct proto
*p
= proto_new(c
, sizeof(struct proto
));
75 p
->ifa_notify
= dev_ifa_notify
;
79 struct protocol proto_device
= {