]> git.puffer.fish Git - matthieu/frr.git/commit
zebra: consolidate how we indentify address-families in the NHT code
authorRenato Westphal <renato@opensourcerouting.org>
Mon, 21 Jan 2019 14:30:36 +0000 (12:30 -0200)
committerRenato Westphal <renato@opensourcerouting.org>
Mon, 21 Jan 2019 15:26:36 +0000 (13:26 -0200)
commit73bf60a06b2d798a06e408fb37ffa2e8e574f611
treeec418411179b57f57de88a6c8c59294f904ba361
parent6f95d11a172aca23e7fda492988567c944bd4553
zebra: consolidate how we indentify address-families in the NHT code

Favor usage of the afi_t enumeration to identify address-families
over using the classic AF_INET[6] constants for that. The choice to
use either of the two seems to be mostly arbitrary throughout our
code base, which leads to confusion and bugs like the one fixed by
commit 6f95d11a1. To address this problem, favor usage of the afi_t
enumeration whenever possible, since 1) it's an enumeration (helps
the compilers to catch some bugs), 2) has a safi_t sibling and 3)
can be used to index static arrays. AF_INET[6] should then be used
only when interfacing with the kernel or external libraries like
libc. The family2afi() and afi2family() functions can be used to
convert between the two different representations back and forth.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
zebra/zapi_msg.c
zebra/zebra_rib.c
zebra/zebra_rnh.c
zebra/zebra_rnh.h
zebra/zebra_routemap.c
zebra/zebra_routemap.h
zebra/zebra_vty.c