summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_open.h
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2017-08-01 02:37:46 +0200
committerRenato Westphal <renato@opensourcerouting.org>2017-08-01 04:45:03 +0200
commita46a2e9b4e8de782ac07e01429a80ed7ec167dcb (patch)
tree84b1ce49ab8502fa0c4ee8a97f7976cc94b3c76d /bgpd/bgp_open.h
parentlib: use switch statements in the AFI/SAFI conversion functions (diff)
downloadfrr-a46a2e9b4e8de782ac07e01429a80ed7ec167dcb.tar.xz
frr-a46a2e9b4e8de782ac07e01429a80ed7ec167dcb.zip
bgpd: don't make any assumptions about the size of an enum
The size of an enum is compiler dependent and thus we shouldn't use enums inside structures that represent fields of a packet. Problem detected by the 'test_capability' unit test. The problem was not apparent before because the 'iana_safi_t' enum didn't exist and 'safi_t' was a typedef to uint8_t. Now we have two different enums, 'iana_afi_t' and 'iana_safi_t', and both need to be encoded in different ways on the wire (2 bytes vs 1 byte). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_open.h')
-rw-r--r--bgpd/bgp_open.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/bgpd/bgp_open.h b/bgpd/bgp_open.h
index 6b92e6e38..83b79a589 100644
--- a/bgpd/bgp_open.h
+++ b/bgpd/bgp_open.h
@@ -29,9 +29,9 @@ struct capability_header {
/* Generic MP capability data */
struct capability_mp_data {
- iana_afi_t afi;
+ uint16_t afi; /* iana_afi_t */
u_char reserved;
- iana_safi_t safi;
+ uint8_t safi; /* iana_safi_t */
};
struct capability_as4 {