summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2017-08-01 02:06:40 +0200
committerRenato Westphal <renato@opensourcerouting.org>2017-08-01 04:44:42 +0200
commit5c5255381e5b457e263081455a9677afa6b9e470 (patch)
tree12e401fd7bdfcb3cfa95583f33aaa124c0ddc3b8 /bgpd
parentlib: remove SAFI_RESERVED_4 and SAFI_RESERVED_5 (diff)
downloadfrr-5c5255381e5b457e263081455a9677afa6b9e470.tar.xz
frr-5c5255381e5b457e263081455a9677afa6b9e470.zip
lib/bgpd: introduce the iana_safi_t enum
We had afi_t/iana_afi_t for AFIs but only safi_t for SAFIs. Fix this inconsistency. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_attr.c10
-rw-r--r--bgpd/bgp_open.c15
-rw-r--r--bgpd/bgp_open.h2
-rw-r--r--bgpd/bgp_packet.c15
-rw-r--r--bgpd/bgp_route.c2
-rw-r--r--bgpd/bgp_updgrp_packet.c4
-rw-r--r--bgpd/bgp_vty.c8
-rw-r--r--bgpd/bgpd.c6
-rw-r--r--bgpd/bgpd.h4
-rw-r--r--bgpd/rfapi/rfapi_import.c4
10 files changed, 45 insertions, 25 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index ef32b9cf9..ca9a50db5 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -1677,7 +1677,8 @@ int bgp_mp_reach_parse(struct bgp_attr_parser_args *args,
{
iana_afi_t pkt_afi;
afi_t afi;
- safi_t pkt_safi, safi;
+ iana_safi_t pkt_safi;
+ safi_t safi;
bgp_size_t nlri_len;
size_t start;
struct stream *s;
@@ -1826,7 +1827,8 @@ int bgp_mp_unreach_parse(struct bgp_attr_parser_args *args,
struct stream *s;
iana_afi_t pkt_afi;
afi_t afi;
- safi_t pkt_safi, safi;
+ iana_safi_t pkt_safi;
+ safi_t safi;
u_int16_t withdraw_len;
struct peer *const peer = args->peer;
struct attr *const attr = args->attr;
@@ -2593,7 +2595,7 @@ size_t bgp_packet_mpattr_start(struct stream *s, struct peer *peer, afi_t afi,
{
size_t sizep;
iana_afi_t pkt_afi;
- safi_t pkt_safi;
+ iana_safi_t pkt_safi;
afi_t nh_afi;
/* Set extended bit always to encode the attribute length as 2 bytes */
@@ -3280,7 +3282,7 @@ size_t bgp_packet_mpunreach_start(struct stream *s, afi_t afi, safi_t safi)
{
unsigned long attrlen_pnt;
iana_afi_t pkt_afi;
- safi_t pkt_safi;
+ iana_safi_t pkt_safi;
/* Set extended bit always to encode the attribute length as 2 bytes */
stream_putc(s, BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_EXTLEN);
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
index b18a4b7c4..2c988f86c 100644
--- a/bgpd/bgp_open.c
+++ b/bgpd/bgp_open.c
@@ -298,7 +298,8 @@ static int bgp_capability_orf_entry(struct peer *peer,
u_char num;
iana_afi_t pkt_afi;
afi_t afi;
- safi_t pkt_safi, safi;
+ iana_safi_t pkt_safi;
+ safi_t safi;
u_char type;
u_char mode;
u_int16_t sm_cap = 0; /* capability send-mode receive */
@@ -466,7 +467,7 @@ static int bgp_capability_restart(struct peer *peer,
afi_t afi;
safi_t safi;
iana_afi_t pkt_afi = stream_getw(s);
- safi_t pkt_safi = stream_getc(s);
+ iana_safi_t pkt_safi = stream_getc(s);
u_char flag = stream_getc(s);
/* Convert AFI, SAFI to internal values, check. */
@@ -543,7 +544,7 @@ static int bgp_capability_addpath(struct peer *peer,
afi_t afi;
safi_t safi;
iana_afi_t pkt_afi = stream_getw(s);
- safi_t pkt_safi = stream_getc(s);
+ iana_safi_t pkt_safi = stream_getc(s);
u_char send_receive = stream_getc(s);
if (bgp_debug_neighbor_events(peer))
@@ -600,7 +601,8 @@ static int bgp_capability_enhe(struct peer *peer, struct capability_header *hdr)
while (stream_get_getp(s) + 6 <= end) {
iana_afi_t pkt_afi = stream_getw(s);
afi_t afi;
- safi_t safi, pkt_safi = stream_getw(s);
+ iana_safi_t pkt_safi = stream_getw(s);
+ safi_t safi;
iana_afi_t pkt_nh_afi = stream_getw(s);
afi_t nh_afi;
@@ -1199,7 +1201,7 @@ static void bgp_open_capability_orf(struct stream *s, struct peer *peer,
unsigned long numberp;
int number_of_orfs = 0;
iana_afi_t pkt_afi;
- safi_t pkt_safi;
+ iana_safi_t pkt_safi;
/* Convert AFI, SAFI to values for packet. */
bgp_map_afi_safi_int2iana(afi, safi, &pkt_afi, &pkt_safi);
@@ -1264,7 +1266,8 @@ void bgp_open_capability(struct stream *s, struct peer *peer)
unsigned long cp, capp, rcapp;
iana_afi_t pkt_afi;
afi_t afi;
- safi_t safi, pkt_safi;
+ safi_t safi;
+ iana_safi_t pkt_safi;
as_t local_as;
u_int32_t restart_time;
u_char afi_safi_count = 0;
diff --git a/bgpd/bgp_open.h b/bgpd/bgp_open.h
index cbd32116b..6b92e6e38 100644
--- a/bgpd/bgp_open.h
+++ b/bgpd/bgp_open.h
@@ -31,7 +31,7 @@ struct capability_header {
struct capability_mp_data {
iana_afi_t afi;
u_char reserved;
- safi_t safi;
+ iana_safi_t safi;
};
struct capability_as4 {
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index e92f2d697..003fbaff6 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -142,7 +142,7 @@ static struct stream *bgp_update_packet_eor(struct peer *peer, afi_t afi,
{
struct stream *s;
iana_afi_t pkt_afi;
- safi_t pkt_safi;
+ iana_safi_t pkt_safi;
if (DISABLE_BGP_ANNOUNCE)
return NULL;
@@ -671,7 +671,7 @@ void bgp_route_refresh_send(struct peer *peer, afi_t afi, safi_t safi,
struct bgp_filter *filter;
int orf_refresh = 0;
iana_afi_t pkt_afi;
- safi_t pkt_safi;
+ iana_safi_t pkt_safi;
if (DISABLE_BGP_ANNOUNCE)
return;
@@ -761,7 +761,7 @@ void bgp_capability_send(struct peer *peer, afi_t afi, safi_t safi,
{
struct stream *s;
iana_afi_t pkt_afi;
- safi_t pkt_safi;
+ iana_safi_t pkt_safi;
/* Convert AFI, SAFI to values for packet. */
bgp_map_afi_safi_int2iana(afi, safi, &pkt_afi, &pkt_safi);
@@ -1338,8 +1338,9 @@ int bgp_nlri_parse(struct peer *peer, struct attr *attr,
packet);
case SAFI_EVPN:
return bgp_nlri_parse_evpn(peer, attr, packet, mp_withdraw);
+ default:
+ return -1;
}
- return -1;
}
/* Parse BGP Update packet and make attribute object. */
@@ -1697,7 +1698,8 @@ static void bgp_route_refresh_receive(struct peer *peer, bgp_size_t size)
{
iana_afi_t pkt_afi;
afi_t afi;
- safi_t pkt_safi, safi;
+ iana_safi_t pkt_safi;
+ safi_t safi;
struct stream *s;
struct peer_af *paf;
struct update_group *updgrp;
@@ -1965,7 +1967,8 @@ static int bgp_capability_msg_parse(struct peer *peer, u_char *pnt,
u_char action;
iana_afi_t pkt_afi;
afi_t afi;
- safi_t pkt_safi, safi;
+ iana_safi_t pkt_safi;
+ safi_t safi;
end = pnt + length;
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index b554aeb32..8c2278339 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -2288,7 +2288,7 @@ int bgp_maximum_prefix_overflow(struct peer *peer, afi_t afi, safi_t safi,
int always)
{
iana_afi_t pkt_afi;
- safi_t pkt_safi;
+ iana_safi_t pkt_safi;
if (!CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
return 0;
diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c
index 1a23a36e9..692db32fa 100644
--- a/bgpd/bgp_updgrp_packet.c
+++ b/bgpd/bgp_updgrp_packet.c
@@ -845,7 +845,7 @@ struct bpacket *subgroup_update_packet(struct update_subgroup *subgrp)
send_attr_str);
if (!stream_empty(snlri)) {
iana_afi_t pkt_afi;
- safi_t pkt_safi;
+ iana_safi_t pkt_safi;
pkt_afi = afi_int2iana(afi);
pkt_safi = safi_int2iana(safi);
@@ -989,7 +989,7 @@ struct bpacket *subgroup_withdraw_packet(struct update_subgroup *subgrp)
/* If first time, format the MP_UNREACH header */
if (first_time) {
iana_afi_t pkt_afi;
- safi_t pkt_safi;
+ iana_safi_t pkt_safi;
pkt_afi = afi_int2iana(afi);
pkt_safi = safi_int2iana(safi);
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index db503516d..0220a7e55 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -78,6 +78,10 @@ static enum node_type bgp_node_type(afi_t afi, safi_t safi)
case SAFI_MPLS_VPN:
return BGP_VPNV4_NODE;
break;
+ default:
+ /* not expected */
+ return BGP_IPV4_NODE;
+ break;
}
break;
case AFI_IP6:
@@ -94,6 +98,10 @@ static enum node_type bgp_node_type(afi_t afi, safi_t safi)
case SAFI_MPLS_VPN:
return BGP_VPNV6_NODE;
break;
+ default:
+ /* not expected */
+ return BGP_IPV4_NODE;
+ break;
}
break;
case AFI_L2VPN:
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index a078bdfd7..0729d0a1b 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -611,8 +611,8 @@ int bgp_listen_limit_unset(struct bgp *bgp)
return 0;
}
-int bgp_map_afi_safi_iana2int(iana_afi_t pkt_afi, safi_t pkt_safi, afi_t *afi,
- safi_t *safi)
+int bgp_map_afi_safi_iana2int(iana_afi_t pkt_afi, iana_safi_t pkt_safi,
+ afi_t *afi, safi_t *safi)
{
/* Map from IANA values to internal values, return error if
* values are unrecognized.
@@ -626,7 +626,7 @@ int bgp_map_afi_safi_iana2int(iana_afi_t pkt_afi, safi_t pkt_safi, afi_t *afi,
}
int bgp_map_afi_safi_int2iana(afi_t afi, safi_t safi, iana_afi_t *pkt_afi,
- safi_t *pkt_safi)
+ iana_safi_t *pkt_safi)
{
/* Map from internal values to IANA values, return error if
* internal values are bad (unexpected).
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 67b8289c7..ff15115e0 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -1381,10 +1381,10 @@ extern void bgp_route_map_terminate(void);
extern int peer_cmp(struct peer *p1, struct peer *p2);
-extern int bgp_map_afi_safi_iana2int(iana_afi_t pkt_afi, safi_t pkt_safi,
+extern int bgp_map_afi_safi_iana2int(iana_afi_t pkt_afi, iana_safi_t pkt_safi,
afi_t *afi, safi_t *safi);
extern int bgp_map_afi_safi_int2iana(afi_t afi, safi_t safi,
- iana_afi_t *pkt_afi, safi_t *pkt_safi);
+ iana_afi_t *pkt_afi, iana_safi_t *pkt_safi);
extern struct peer_af *peer_af_create(struct peer *, afi_t, safi_t);
extern struct peer_af *peer_af_find(struct peer *, afi_t, safi_t);
diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c
index 0bbbe12cc..61739d38a 100644
--- a/bgpd/rfapi/rfapi_import.c
+++ b/bgpd/rfapi/rfapi_import.c
@@ -3872,6 +3872,10 @@ rfapiBgpInfoFilteredImportFunction(safi_t safi)
case SAFI_ENCAP:
return rfapiBgpInfoFilteredImportEncap;
+
+ default:
+ /* not expected */
+ return NULL;
}
zlog_err("%s: bad safi %d", __func__, safi);
return NULL;