]> git.proxmox.com Git - mirror_frr.git/commit - bgpd/bgp_open.h
bgpd: don't make any assumptions about the size of an enum
authorRenato Westphal <renato@opensourcerouting.org>
Tue, 1 Aug 2017 00:37:46 +0000 (21:37 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Tue, 1 Aug 2017 02:45:03 +0000 (23:45 -0300)
commita46a2e9b4e8de782ac07e01429a80ed7ec167dcb
tree84b1ce49ab8502fa0c4ee8a97f7976cc94b3c76d
parent085347cfadbca04a7dfee175971c23e266becc6b
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>
bgpd/bgp_open.h
bgpd/bgpd.h