Skip to content

Commit

Permalink
*: Remove netlink headers from lib/zebra.h
Browse files Browse the repository at this point in the history
The headers associated with netlink code
really only belong in those that need it.
Move these headers out of lib/zebra.h and
into more appropriate places.  bgp's usage
of the RT_TABLE_XXX defines are probably not
appropriate and will be cleaned up in future
commits.

Signed-off-by: Donald Sharp <[email protected]>
  • Loading branch information
donaldsharp committed Nov 6, 2023
1 parent 5752340 commit 3930af0
Show file tree
Hide file tree
Showing 20 changed files with 63 additions and 5 deletions.
4 changes: 4 additions & 0 deletions bfdd/bfd_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@

#include <zebra.h>

#ifdef GNU_LINUX
#include <linux/filter.h>
#endif

#ifdef BFD_LINUX
#include <linux/if_packet.h>
#endif /* BFD_LINUX */
Expand Down
4 changes: 4 additions & 0 deletions bgpd/bgp_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

#include <zebra.h>

#ifdef GNU_LINUX
#include <linux/rtnetlink.h> //RT_TABLE_XXX
#endif

#include "command.h"
#include "lib/json.h"
#include "lib/sockopt.h"
Expand Down
6 changes: 1 addition & 5 deletions lib/zebra.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,7 @@

#include <net/route.h>

#ifdef HAVE_NETLINK
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <linux/filter.h>
#else
#ifndef HAVE_NETLINK
#define RT_TABLE_MAIN 0
#define RT_TABLE_LOCAL RT_TABLE_MAIN
#endif /* HAVE_NETLINK */
Expand Down
4 changes: 4 additions & 0 deletions nhrpd/netlink_arp.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
#include "config.h"
#endif

#ifdef GNU_LINUX
#include <linux/rtnetlink.h>
#endif

#include <fcntl.h>
#include <net/if.h>
#include <netinet/if_ether.h>
Expand Down
4 changes: 4 additions & 0 deletions nhrpd/nhrp_multicast.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
#include "config.h"
#endif

#ifdef GNU_LINUX
#include <linux/rtnetlink.h>
#endif

#include <fcntl.h>
#include <net/if.h>
#include <net/ethernet.h>
Expand Down
3 changes: 3 additions & 0 deletions zebra/dplane_fpm_nl.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
#include <string.h>

#include "lib/zebra.h"

#include <linux/rtnetlink.h>

#include "lib/json.h"
#include "lib/libfrr.h"
#include "lib/frratomic.h"
Expand Down
2 changes: 2 additions & 0 deletions zebra/if_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#define _LINUX_IF_H
#define _LINUX_IP_H

#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <netinet/if_ether.h>
#include <linux/if_bridge.h>
#include <linux/if_link.h>
Expand Down
3 changes: 3 additions & 0 deletions zebra/kernel_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
#include <zebra.h>

#ifdef HAVE_NETLINK
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <linux/filter.h>

#include "linklist.h"
#include "if.h"
Expand Down
4 changes: 4 additions & 0 deletions zebra/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

#include <zebra.h>

#ifdef GNU_LINUX
#include <linux/rtnetlink.h>
#endif

#include <lib/version.h>
#include "getopt.h"
#include "command.h"
Expand Down
2 changes: 2 additions & 0 deletions zebra/netconf_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

#include <ns.h>

#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include "linux/netconf.h"

#include "lib/lib_errors.h"
Expand Down
3 changes: 3 additions & 0 deletions zebra/rule_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

#ifdef HAVE_NETLINK

#include <linux/netlink.h>
#include <linux/rtnetlink.h>

#include "if.h"
#include "prefix.h"
#include "vrf.h"
Expand Down
1 change: 1 addition & 0 deletions zebra/tc_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#ifdef HAVE_NETLINK

#include <linux/rtnetlink.h>
#include <linux/pkt_cls.h>
#include <linux/pkt_sched.h>
#include <netinet/if_ether.h>
Expand Down
4 changes: 4 additions & 0 deletions zebra/zebra_evpn_neigh.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

#include <zebra.h>

#ifdef GNU_LINUX
#include <linux/neighbour.h>
#endif

#include "hash.h"
#include "interface.h"
#include "jhash.h"
Expand Down
4 changes: 4 additions & 0 deletions zebra/zebra_fpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

#include <zebra.h>

#ifdef GNU_LINUX
#include <linux/rtnetlink.h>
#endif

#include "log.h"
#include "libfrr.h"
#include "stream.h"
Expand Down
4 changes: 4 additions & 0 deletions zebra/zebra_fpm_dt.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
*/

#include <zebra.h>

#ifdef GNU_LINUX
#include <linux/rtnetlink.h>
#endif
#include "log.h"
#include "vrf.h"

Expand Down
3 changes: 3 additions & 0 deletions zebra/zebra_fpm_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

#ifdef HAVE_NETLINK

#include <linux/rtnetlink.h>
#include <linux/neighbour.h>

#include "log.h"
#include "rib.h"
#include "vty.h"
Expand Down
3 changes: 3 additions & 0 deletions zebra/zebra_mpls_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

#ifdef HAVE_NETLINK

#include <linux/netlink.h>
#include <linux/rtnetlink.h>

#include "zebra/debug.h"
#include "zebra/rt.h"
#include "zebra/rt_netlink.h"
Expand Down
4 changes: 4 additions & 0 deletions zebra/zebra_netns_id.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

#include <zebra.h>

#ifdef GNU_LINUX
#include <linux/if_link.h>
#endif

#include "ns.h"
#include "vrf.h"
#include "log.h"
Expand Down
2 changes: 2 additions & 0 deletions zebra/zebra_ns.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ extern "C" {
#endif

#ifdef HAVE_NETLINK
#include <linux/netlink.h>

/* Socket interface to kernel */
struct nlsock {
int sock;
Expand Down
4 changes: 4 additions & 0 deletions zebra/zebra_rib.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

#include <zebra.h>

#ifdef GNU_LINUX
#include <linux/rtnetlink.h>
#endif

#include "command.h"
#include "if.h"
#include "linklist.h"
Expand Down

0 comments on commit 3930af0

Please sign in to comment.