diff options
Diffstat (limited to 'pbrd')
-rw-r--r-- | pbrd/pbr_main.c | 2 | ||||
-rw-r--r-- | pbrd/pbr_zebra.c | 40 | ||||
-rw-r--r-- | pbrd/pbr_zebra.h | 6 |
3 files changed, 12 insertions, 36 deletions
diff --git a/pbrd/pbr_main.c b/pbrd/pbr_main.c index 246d836ac..bb92703ae 100644 --- a/pbrd/pbr_main.c +++ b/pbrd/pbr_main.c @@ -166,6 +166,8 @@ int main(int argc, char **argv, char **envp) access_list_init(); pbr_nht_init(); pbr_map_init(); + if_zapi_callbacks(pbr_ifp_create, pbr_ifp_up, + pbr_ifp_down, pbr_ifp_destroy); pbr_zebra_init(); pbr_vty_init(); diff --git a/pbrd/pbr_zebra.c b/pbrd/pbr_zebra.c index d74d0fcd2..2bba83738 100644 --- a/pbrd/pbr_zebra.c +++ b/pbrd/pbr_zebra.c @@ -59,15 +59,8 @@ struct pbr_interface *pbr_if_new(struct interface *ifp) } /* Inteface addition message from zebra. */ -static int interface_add(ZAPI_CALLBACK_ARGS) +int pbr_ifp_create(struct interface *ifp) { - struct interface *ifp; - - ifp = zebra_interface_add_read(zclient->ibuf, vrf_id); - - if (!ifp) - return 0; - DEBUGD(&pbr_dbg_zebra, "%s: %s", __PRETTY_FUNCTION__, ifp->name); @@ -79,24 +72,11 @@ static int interface_add(ZAPI_CALLBACK_ARGS) return 0; } -static int interface_delete(ZAPI_CALLBACK_ARGS) +int pbr_ifp_destroy(struct interface *ifp) { - struct interface *ifp; - struct stream *s; - - s = zclient->ibuf; - /* zebra_interface_state_read () updates interface structure in iflist - */ - ifp = zebra_interface_state_read(s, vrf_id); - - if (ifp == NULL) - return 0; - DEBUGD(&pbr_dbg_zebra, "%s: %s", __PRETTY_FUNCTION__, ifp->name); - if_set_index(ifp, IFINDEX_INTERNAL); - return 0; } @@ -133,12 +113,8 @@ static int interface_address_delete(ZAPI_CALLBACK_ARGS) return 0; } -static int interface_state_up(ZAPI_CALLBACK_ARGS) +int pbr_ifp_up(struct interface *ifp) { - struct interface *ifp; - - ifp = zebra_interface_state_read(zclient->ibuf, vrf_id); - DEBUGD(&pbr_dbg_zebra, "%s: %s is up", __PRETTY_FUNCTION__, ifp->name); @@ -147,12 +123,8 @@ static int interface_state_up(ZAPI_CALLBACK_ARGS) return 0; } -static int interface_state_down(ZAPI_CALLBACK_ARGS) +int pbr_ifp_down(struct interface *ifp) { - struct interface *ifp; - - ifp = zebra_interface_state_read(zclient->ibuf, vrf_id); - DEBUGD(&pbr_dbg_zebra, "%s: %s is down", __PRETTY_FUNCTION__, ifp->name); @@ -447,10 +419,6 @@ void pbr_zebra_init(void) zclient_init(zclient, ZEBRA_ROUTE_PBR, 0, &pbr_privs); zclient->zebra_connected = zebra_connected; - zclient->interface_add = interface_add; - zclient->interface_delete = interface_delete; - zclient->interface_up = interface_state_up; - zclient->interface_down = interface_state_down; zclient->interface_address_add = interface_address_add; zclient->interface_address_delete = interface_address_delete; zclient->route_notify_owner = route_notify_owner; diff --git a/pbrd/pbr_zebra.h b/pbrd/pbr_zebra.h index 4cbefe263..d5d938021 100644 --- a/pbrd/pbr_zebra.h +++ b/pbrd/pbr_zebra.h @@ -39,4 +39,10 @@ extern void pbr_send_pbr_map(struct pbr_map_sequence *pbrms, struct pbr_map_interface *pmi, bool install); extern struct pbr_interface *pbr_if_new(struct interface *ifp); + +extern int pbr_ifp_create(struct interface *ifp); +extern int pbr_ifp_up(struct interface *ifp); +extern int pbr_ifp_down(struct interface *ifp); +extern int pbr_ifp_destroy(struct interface *ifp); + #endif |