diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-01-22 14:16:27 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-01-22 17:55:22 +0100 |
commit | 7cf15b250181f0b108c6b9e1899d3bb4f933e836 (patch) | |
tree | 4cb61e03bf000ec6d490161df8babbc387fefba2 /zebra | |
parent | lib, zebra: Rename and place appropriately the label stack (diff) | |
download | frr-7cf15b250181f0b108c6b9e1899d3bb4f933e836.tar.xz frr-7cf15b250181f0b108c6b9e1899d3bb4f933e836.zip |
zebra: use zclient_create_header
The function zserv_create_header was exactly the same
as zclient_create_header. Let's just have one in the
system.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra')
-rw-r--r-- | zebra/label_manager.c | 2 | ||||
-rw-r--r-- | zebra/zebra_mpls.c | 2 | ||||
-rw-r--r-- | zebra/zebra_mroute.c | 2 | ||||
-rw-r--r-- | zebra/zebra_ptm_redistribute.c | 5 | ||||
-rw-r--r-- | zebra/zebra_rnh.c | 2 | ||||
-rw-r--r-- | zebra/zebra_vxlan.c | 10 | ||||
-rw-r--r-- | zebra/zserv.c | 40 | ||||
-rw-r--r-- | zebra/zserv.h | 2 |
8 files changed, 26 insertions, 39 deletions
diff --git a/zebra/label_manager.c b/zebra/label_manager.c index f38206d8e..ace13eda7 100644 --- a/zebra/label_manager.c +++ b/zebra/label_manager.c @@ -121,7 +121,7 @@ static int reply_error(int cmd, struct zserv *zserv, vrf_id_t vrf_id) s = zserv->obuf; stream_reset(s); - zserv_create_header(s, cmd, vrf_id); + zclient_create_header(s, cmd, vrf_id); /* result */ stream_putc(s, 1); diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index 193aaa068..61051ba87 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -457,7 +457,7 @@ static int fec_send(zebra_fec_t *fec, struct zserv *client) s = client->obuf; stream_reset(s); - zserv_create_header(s, ZEBRA_FEC_UPDATE, VRF_DEFAULT); + zclient_create_header(s, ZEBRA_FEC_UPDATE, VRF_DEFAULT); stream_putw(s, rn->p.family); stream_put_prefix(s, &rn->p); diff --git a/zebra/zebra_mroute.c b/zebra/zebra_mroute.c index 519c120a6..e9cd19ebe 100644 --- a/zebra/zebra_mroute.c +++ b/zebra/zebra_mroute.c @@ -61,7 +61,7 @@ stream_failure: stream_reset(s); - zserv_create_header(s, ZEBRA_IPMR_ROUTE_STATS, zvrf_id(zvrf)); + zclient_create_header(s, ZEBRA_IPMR_ROUTE_STATS, zvrf_id(zvrf)); stream_put_in_addr(s, &mroute.sg.src); stream_put_in_addr(s, &mroute.sg.grp); stream_put(s, &mroute.lastused, sizeof(mroute.lastused)); diff --git a/zebra/zebra_ptm_redistribute.c b/zebra/zebra_ptm_redistribute.c index 1378ea186..8fddd400c 100644 --- a/zebra/zebra_ptm_redistribute.c +++ b/zebra/zebra_ptm_redistribute.c @@ -41,7 +41,7 @@ static int zsend_interface_bfd_update(int cmd, struct zserv *client, s = client->obuf; stream_reset(s); - zserv_create_header(s, cmd, vrf_id); + zclient_create_header(s, cmd, vrf_id); if (ifp) stream_putl(s, ifp->ifindex); else @@ -96,8 +96,7 @@ static int zsend_bfd_peer_replay(int cmd, struct zserv *client) s = client->obuf; stream_reset(s); - zserv_create_header( - s, cmd, VRF_DEFAULT); // Pending: adjust when multi-vrf bfd work + zclient_create_header(s, cmd, VRF_DEFAULT); /* Write packet size. */ stream_putw_at(s, 0, stream_get_endp(s)); diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c index 33d0b3a64..825dea21b 100644 --- a/zebra/zebra_rnh.c +++ b/zebra/zebra_rnh.c @@ -1000,7 +1000,7 @@ static int send_client(struct rnh *rnh, struct zserv *client, rnh_type_t type, s = client->obuf; stream_reset(s); - zserv_create_header(s, cmd, vrf_id); + zclient_create_header(s, cmd, vrf_id); stream_putw(s, rn->p.family); switch (rn->p.family) { diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 0ef180236..1690079f6 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -1166,7 +1166,7 @@ static int zvni_macip_send_msg_to_client(vni_t vni, s = client->obuf; stream_reset(s); - zserv_create_header(s, cmd, VRF_DEFAULT); + zclient_create_header(s, cmd, VRF_DEFAULT); stream_putl(s, vni); stream_put(s, macaddr->octet, ETH_ALEN); if (ip) { @@ -2531,7 +2531,7 @@ static int zvni_send_add_to_client(zebra_vni_t *zvni) s = client->obuf; stream_reset(s); - zserv_create_header(s, ZEBRA_VNI_ADD, VRF_DEFAULT); + zclient_create_header(s, ZEBRA_VNI_ADD, VRF_DEFAULT); stream_putl(s, zvni->vni); stream_put_in_addr(s, &zvni->local_vtep_ip); stream_put(s, &zvni->vrf_id, sizeof(vrf_id_t)); /* tenant vrf */ @@ -2565,7 +2565,7 @@ static int zvni_send_del_to_client(vni_t vni) s = client->obuf; stream_reset(s); - zserv_create_header(s, ZEBRA_VNI_DEL, VRF_DEFAULT); + zclient_create_header(s, ZEBRA_VNI_DEL, VRF_DEFAULT); stream_putl(s, vni); /* Write packet size. */ @@ -3550,7 +3550,7 @@ static int zl3vni_send_add_to_client(zebra_l3vni_t *zl3vni) s = client->obuf; stream_reset(s); - zserv_create_header(s, ZEBRA_L3VNI_ADD, + zclient_create_header(s, ZEBRA_L3VNI_ADD, zl3vni_vrf_id(zl3vni)); stream_putl(s, zl3vni->vni); stream_put(s, &rmac, sizeof(struct ethaddr)); @@ -3586,7 +3586,7 @@ static int zl3vni_send_del_to_client(zebra_l3vni_t *zl3vni) s = client->obuf; stream_reset(s); - zserv_create_header(s, ZEBRA_L3VNI_DEL, + zclient_create_header(s, ZEBRA_L3VNI_DEL, zl3vni_vrf_id(zl3vni)); stream_putl(s, zl3vni->vni); diff --git a/zebra/zserv.c b/zebra/zserv.c index 6241a1638..604054f2a 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -149,16 +149,6 @@ int zebra_server_send_message(struct zserv *client) return 0; } -void zserv_create_header(struct stream *s, uint16_t cmd, vrf_id_t vrf_id) -{ - /* length placeholder, caller can update */ - stream_putw(s, ZEBRA_HEADER_SIZE); - stream_putc(s, ZEBRA_HEADER_MARKER); - stream_putc(s, ZSERV_VERSION); - stream_putl(s, vrf_id); - stream_putw(s, cmd); -} - static void zserv_encode_interface(struct stream *s, struct interface *ifp) { /* Interface information. */ @@ -221,7 +211,7 @@ int zsend_interface_add(struct zserv *client, struct interface *ifp) s = client->obuf; stream_reset(s); - zserv_create_header(s, ZEBRA_INTERFACE_ADD, ifp->vrf_id); + zclient_create_header(s, ZEBRA_INTERFACE_ADD, ifp->vrf_id); zserv_encode_interface(s, ifp); client->ifadd_cnt++; @@ -236,7 +226,7 @@ int zsend_interface_delete(struct zserv *client, struct interface *ifp) s = client->obuf; stream_reset(s); - zserv_create_header(s, ZEBRA_INTERFACE_DELETE, ifp->vrf_id); + zclient_create_header(s, ZEBRA_INTERFACE_DELETE, ifp->vrf_id); zserv_encode_interface(s, ifp); client->ifdel_cnt++; @@ -250,7 +240,7 @@ int zsend_vrf_add(struct zserv *client, struct zebra_vrf *zvrf) s = client->obuf; stream_reset(s); - zserv_create_header(s, ZEBRA_VRF_ADD, zvrf_id(zvrf)); + zclient_create_header(s, ZEBRA_VRF_ADD, zvrf_id(zvrf)); zserv_encode_vrf(s, zvrf); client->vrfadd_cnt++; @@ -265,7 +255,7 @@ int zsend_vrf_delete(struct zserv *client, struct zebra_vrf *zvrf) s = client->obuf; stream_reset(s); - zserv_create_header(s, ZEBRA_VRF_DELETE, zvrf_id(zvrf)); + zclient_create_header(s, ZEBRA_VRF_DELETE, zvrf_id(zvrf)); zserv_encode_vrf(s, zvrf); client->vrfdel_cnt++; @@ -285,7 +275,7 @@ int zsend_interface_link_params(struct zserv *client, struct interface *ifp) s = client->obuf; stream_reset(s); - zserv_create_header(s, ZEBRA_INTERFACE_LINK_PARAMS, ifp->vrf_id); + zclient_create_header(s, ZEBRA_INTERFACE_LINK_PARAMS, ifp->vrf_id); /* Add Interface Index */ stream_putl(s, ifp->ifindex); @@ -348,7 +338,7 @@ int zsend_interface_address(int cmd, struct zserv *client, s = client->obuf; stream_reset(s); - zserv_create_header(s, cmd, ifp->vrf_id); + zclient_create_header(s, cmd, ifp->vrf_id); stream_putl(s, ifp->ifindex); /* Interface address flag. */ @@ -393,7 +383,7 @@ static int zsend_interface_nbr_address(int cmd, struct zserv *client, s = client->obuf; stream_reset(s); - zserv_create_header(s, cmd, ifp->vrf_id); + zclient_create_header(s, cmd, ifp->vrf_id); stream_putl(s, ifp->ifindex); /* Prefix information. */ @@ -504,7 +494,7 @@ int zsend_interface_vrf_update(struct zserv *client, struct interface *ifp, s = client->obuf; stream_reset(s); - zserv_create_header(s, ZEBRA_INTERFACE_VRF_UPDATE, ifp->vrf_id); + zclient_create_header(s, ZEBRA_INTERFACE_VRF_UPDATE, ifp->vrf_id); /* Fill in the ifIndex of the interface and its new VRF (id) */ stream_putl(s, ifp->ifindex); @@ -581,7 +571,7 @@ int zsend_interface_update(int cmd, struct zserv *client, struct interface *ifp) s = client->obuf; stream_reset(s); - zserv_create_header(s, cmd, ifp->vrf_id); + zclient_create_header(s, cmd, ifp->vrf_id); zserv_encode_interface(s, ifp); if (cmd == ZEBRA_INTERFACE_UP) @@ -957,7 +947,7 @@ static int zsend_ipv4_nexthop_lookup_mrib(struct zserv *client, stream_reset(s); /* Fill in result. */ - zserv_create_header(s, ZEBRA_IPV4_NEXTHOP_LOOKUP_MRIB, zvrf_id(zvrf)); + zclient_create_header(s, ZEBRA_IPV4_NEXTHOP_LOOKUP_MRIB, zvrf_id(zvrf)); stream_put_in_addr(s, &addr); if (re) { @@ -1009,7 +999,7 @@ int zsend_route_notify_owner(u_char proto, u_short instance, s = client->obuf; stream_reset(s); - zserv_create_header(s, ZEBRA_ROUTE_NOTIFY_OWNER, vrf_id); + zclient_create_header(s, ZEBRA_ROUTE_NOTIFY_OWNER, vrf_id); stream_put(s, ¬e, sizeof(note)); @@ -1039,7 +1029,7 @@ int zsend_router_id_update(struct zserv *client, struct prefix *p, stream_reset(s); /* Message type. */ - zserv_create_header(s, ZEBRA_ROUTER_ID_UPDATE, vrf_id); + zclient_create_header(s, ZEBRA_ROUTER_ID_UPDATE, vrf_id); /* Prefix information. */ stream_putc(s, p->family); @@ -1063,7 +1053,7 @@ int zsend_pw_update(struct zserv *client, struct zebra_pw *pw) s = client->obuf; stream_reset(s); - zserv_create_header(s, ZEBRA_PW_STATUS_UPDATE, pw->vrf_id); + zclient_create_header(s, ZEBRA_PW_STATUS_UPDATE, pw->vrf_id); stream_write(s, pw->ifname, IF_NAMESIZE); stream_putl(s, pw->ifindex); stream_putl(s, pw->status); @@ -2089,7 +2079,7 @@ static int zsend_label_manager_connect_response(struct zserv *client, s = client->obuf; stream_reset(s); - zserv_create_header(s, ZEBRA_LABEL_MANAGER_CONNECT, vrf_id); + zclient_create_header(s, ZEBRA_LABEL_MANAGER_CONNECT, vrf_id); /* result */ stream_putc(s, result); @@ -2151,7 +2141,7 @@ static int zsend_assign_label_chunk_response(struct zserv *client, s = client->obuf; stream_reset(s); - zserv_create_header(s, ZEBRA_GET_LABEL_CHUNK, vrf_id); + zclient_create_header(s, ZEBRA_GET_LABEL_CHUNK, vrf_id); if (lmc) { /* keep */ diff --git a/zebra/zserv.h b/zebra/zserv.h index 63db9d9eb..4b3b0041b 100644 --- a/zebra/zserv.h +++ b/zebra/zserv.h @@ -177,8 +177,6 @@ extern int zsend_route_notify_owner(u_char proto, u_short instance, vrf_id_t vrf_id, struct prefix *p, enum zapi_route_notify_owner note); -extern void zserv_create_header(struct stream *s, uint16_t cmd, - vrf_id_t vrf_id); extern void zserv_nexthop_num_warn(const char *, const struct prefix *, const unsigned int); extern int zebra_server_send_message(struct zserv *client); |