acassen / keepalived

Keepalived
https://www.keepalived.org
GNU General Public License v2.0
3.96k stars 737 forks source link

Fix lack macro for find_rttables_group() #2397

Closed jimying closed 6 months ago

jimying commented 6 months ago

lack macro HAVE_DECL_FRA_SUPPRESS_IFGROUP, which is similar with get_rttables_group().

This fix build error when macro HAVE_DECL_FRA_SUPPRESS_IFGROUP=0 (on centos 7 kernel 3.10.0)

rttables.c:328:31: error: use of undeclared identifier 'rt_groups'
  328 |         return find_entry(name, id, &rt_groups, RT_GROUPS_FILE, NULL, INT32_MAX);
      |                                      ^
rttables.c:328:42: error: use of undeclared identifier 'RT_GROUPS_FILE'
  328 |         return find_entry(name, id, &rt_groups, RT_GROUPS_FILE, NULL, INT32_MAX);
pqarmitage commented 6 months ago

@jimying Many thanks for this patch, which I have now merged. There was one slight problem with it, since it would not build if SNMP support was disabled, but commit f035191 resolves that.

jimying commented 6 months ago

@pqarmitage

I copied the logic from get_rttables_group() in lib/rttables.h

#if HAVE_DECL_FRA_SUPPRESS_IFGROUP && defined _WITH_SNMP_VRRP_
extern const char *get_rttables_group(uint32_t);
#endif

is it also need modify get_rttables_group()?

pqarmitage commented 6 months ago

@jimying No, it is not needed to modify get_rttables_group(). get_rttables_group() is only used for responding to SNMP requests, whereas find_rttables_group() is used for ip rules and for vmac and ipvlan config parsing.