From 5a0ccebf9184edc9cbd0a5070aa7efa70c274724 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 13 Sep 2017 11:18:51 -0400 Subject: [PATCH] bgpd: deduplicate struct definition Signed-off-by: Quentin Young --- bgpd/bgp_ecommunity.c | 11 ++--------- bgpd/bgp_ecommunity.h | 10 ++++++++++ bgpd/bgp_evpn_vty.c | 11 +++-------- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c index 897b1c7508..bdcc12705c 100644 --- a/bgpd/bgp_ecommunity.c +++ b/bgpd/bgp_ecommunity.c @@ -555,15 +555,8 @@ static int ecommunity_rt_soo_str(char *buf, u_int8_t *pnt, int type, const char *prefix; /* For parse Extended Community attribute tupple. */ - struct ecommunity_as { - as_t as; - u_int32_t val; - } eas; - - struct ecommunity_ip { - struct in_addr ip; - u_int16_t val; - } eip; + struct ecommunity_as eas; + struct ecommunity_ip eip; /* Determine prefix for string, if any. */ diff --git a/bgpd/bgp_ecommunity.h b/bgpd/bgp_ecommunity.h index 927b1370cf..c967f8bd47 100644 --- a/bgpd/bgp_ecommunity.h +++ b/bgpd/bgp_ecommunity.h @@ -70,6 +70,16 @@ struct ecommunity { char *str; }; +struct ecommunity_as { + as_t as; + uint32_t val; +}; + +struct ecommunity_ip { + struct in_addr ip; + uint16_t val; +}; + /* Extended community value is eight octet. */ struct ecommunity_val { char val[ECOMMUNITY_SIZE]; diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index 17511827b1..eb69e76051 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -35,6 +35,7 @@ #include "bgpd/bgp_evpn_private.h" #include "bgpd/bgp_zebra.h" #include "bgpd/bgp_vty.h" +#include "bgpd/bgp_ecommunity.h" #define SHOW_DISPLAY_STANDARD 0 #define SHOW_DISPLAY_TAGS 1 @@ -57,14 +58,8 @@ static void display_import_rt(struct vty *vty, struct irt_node *irt, { u_char *pnt; u_char type, sub_type; - struct ecommunity_as { - as_t as; - u_int32_t val; - } eas; - struct ecommunity_ip { - struct in_addr ip; - u_int16_t val; - } eip; + struct ecommunity_as eas; + struct ecommunity_ip eip; struct listnode *node, *nnode; struct bgpevpn *tmp_vpn; json_object *json_rt = NULL; -- 2.39.5