diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/if.c | 6 | ||||
| -rw-r--r-- | lib/if.h | 2 | ||||
| -rw-r--r-- | lib/zclient.c | 14 | ||||
| -rw-r--r-- | lib/zclient.h | 2 |
4 files changed, 14 insertions, 10 deletions
@@ -175,6 +175,12 @@ static struct interface *if_create_backend(const char *name, ifindex_t ifindex, return ifp; } +void if_new_via_zapi(struct interface *ifp) +{ + if (ifp_master.create_hook) + (*ifp_master.create_hook)(ifp); +} + struct interface *if_create(const char *name, vrf_id_t vrf_id) { return if_create_backend(name, IFINDEX_INTERNAL, vrf_id); @@ -563,6 +563,8 @@ extern void if_zapi_callbacks(int (*create)(struct interface *ifp), int (*down)(struct interface *ifp), int (*destroy)(struct interface *ifp)); +extern void if_new_via_zapi(struct interface *ifp); + extern const struct frr_yang_module_info frr_interface_info; #ifdef __cplusplus diff --git a/lib/zclient.c b/lib/zclient.c index 92a495ac61..ea151be53a 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -1547,10 +1547,11 @@ static void zclient_vrf_delete(struct zclient *zclient, vrf_id_t vrf_id) vrf_delete(vrf); } -struct interface *zebra_interface_add_read(struct stream *s, vrf_id_t vrf_id) +static void zclient_interface_add(struct zclient *zclient, vrf_id_t vrf_id) { struct interface *ifp; char ifname_tmp[INTERFACE_NAMSIZ]; + struct stream *s = zclient->ibuf; /* Read interface name. */ stream_get(ifname_tmp, s, INTERFACE_NAMSIZ); @@ -1560,15 +1561,14 @@ struct interface *zebra_interface_add_read(struct stream *s, vrf_id_t vrf_id) zebra_interface_if_set_value(s, ifp); - return ifp; + if_new_via_zapi(ifp); } /* * Read interface up/down msg (ZEBRA_INTERFACE_UP/ZEBRA_INTERFACE_DOWN) * from zebra server. The format of this message is the same as - * that sent for ZEBRA_INTERFACE_ADD/ZEBRA_INTERFACE_DELETE (see - * comments for zebra_interface_add_read), except that no sockaddr_dl - * is sent at the tail of the message. + * that sent for ZEBRA_INTERFACE_ADD/ZEBRA_INTERFACE_DELETE, + * except that no sockaddr_dl is sent at the tail of the message. */ struct interface *zebra_interface_state_read(struct stream *s, vrf_id_t vrf_id) { @@ -2789,9 +2789,7 @@ static int zclient_read(struct thread *thread) zclient_vrf_delete(zclient, vrf_id); break; case ZEBRA_INTERFACE_ADD: - if (zclient->interface_add) - (*zclient->interface_add)(command, zclient, length, - vrf_id); + zclient_interface_add(zclient, vrf_id); break; case ZEBRA_INTERFACE_DELETE: if (zclient->interface_delete) diff --git a/lib/zclient.h b/lib/zclient.h index eb3c97b111..9361b56c31 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -240,7 +240,6 @@ struct zclient { void (*zebra_connected)(struct zclient *); void (*zebra_capabilities)(struct zclient_capabilities *cap); int (*router_id_update)(ZAPI_CALLBACK_ARGS); - int (*interface_add)(ZAPI_CALLBACK_ARGS); int (*interface_delete)(ZAPI_CALLBACK_ARGS); int (*interface_up)(ZAPI_CALLBACK_ARGS); int (*interface_down)(ZAPI_CALLBACK_ARGS); @@ -617,7 +616,6 @@ extern bool zapi_parse_header(struct stream *zmsg, struct zmsghdr *hdr); extern void zclient_interface_set_master(struct zclient *client, struct interface *master, struct interface *slave); -extern struct interface *zebra_interface_add_read(struct stream *, vrf_id_t); extern struct interface *zebra_interface_state_read(struct stream *s, vrf_id_t); extern struct connected *zebra_interface_address_read(int, struct stream *, vrf_id_t); |
