Skip to content

Commit

Permalink
nhrpd: cleaning netlink gre information
Browse files Browse the repository at this point in the history
flush netlink related dependencies with gre information.
Add some linux headers required to compile with it.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
  • Loading branch information
pguibert6WIND committed Apr 30, 2021
1 parent 7f48cfa commit aea6c49
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 182 deletions.
16 changes: 16 additions & 0 deletions include/linux/if_packet.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef __LINUX_IF_PACKET_H
#define __LINUX_IF_PACKET_H

#include <linux/types.h>

struct sockaddr_ll {
unsigned short sll_family;
__be16 sll_protocol;
int sll_ifindex;
unsigned short sll_hatype;
unsigned char sll_pkttype;
unsigned char sll_halen;
unsigned char sll_addr[8];
};

#endif
5 changes: 0 additions & 5 deletions lib/zclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -4262,8 +4262,6 @@ int zclient_send_zebra_gre_request(struct zclient *client,
struct interface *ifp)
{
struct stream *s;
ifindex_t idx_local;
int ret;

if (!client || client->sock < 0) {
zlog_err("%s : zclient not ready", __func__);
Expand All @@ -4278,7 +4276,4 @@ int zclient_send_zebra_gre_request(struct zclient *client,
stream_putw_at(s, 0, stream_get_endp(s));
zclient_send_message(client);
return 0;
stream_failure:
zlog_err("%s(): error reading response ..", __func__);
return 0;
}
6 changes: 1 addition & 5 deletions nhrpd/linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,12 @@
#include <sys/types.h>
#include <asm/types.h>
#include <arpa/inet.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <linux/ip.h>
#include <linux/if_packet.h>
#include <linux/if_arp.h>
#include <linux/if_tunnel.h>
#include <linux/limits.h>

#include "nhrp_protocol.h"
#include "os.h"
#include "netlink.h"

#ifndef HAVE_STRLCPY
size_t strlcpy(char *__restrict dest,
Expand Down
11 changes: 3 additions & 8 deletions nhrpd/netlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,16 @@
* (at your option) any later version.
*/

#include <stdint.h>
#include <zebra.h>
#include <vrf.h>
#include <if.h>

union sockunion;
struct interface;

extern int netlink_nflog_group;
extern int netlink_mcast_nflog_group;
extern int netlink_req_fd;

void netlink_init(void);
int netlink_configure_arp(unsigned int ifindex, int pf);
void netlink_update_binding(struct interface *ifp, union sockunion *proto,
union sockunion *nbma);
void netlink_set_nflog_group(int nlgroup);

void netlink_gre_get_info(unsigned int ifindex, uint32_t *gre_key,
unsigned int *link_index, struct in_addr *saddr);
void netlink_gre_set_link(unsigned int ifindex, unsigned int link_index);
8 changes: 0 additions & 8 deletions nhrpd/netlink_arp.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "netlink.h"
#include "znl.h"

int netlink_req_fd = -1;
int netlink_nflog_group;
static int netlink_log_fd = -1;
static struct thread *netlink_log_thread;
Expand Down Expand Up @@ -203,10 +202,3 @@ void nhrp_neighbor_operation(ZAPI_CALLBACK_ARGS)
nhrp_cache_set_used(c, state == ZEBRA_NEIGH_STATE_REACHABLE);
}
}

void netlink_init(void)
{
netlink_req_fd = znl_open(NETLINK_ROUTE, 0);
if (netlink_req_fd < 0)
return;
}
152 changes: 0 additions & 152 deletions nhrpd/netlink_gre.c

This file was deleted.

1 change: 0 additions & 1 deletion nhrpd/nhrp_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#include "nhrpd.h"
#include "os.h"
#include "netlink.h"
#include "hash.h"

DEFINE_MTYPE_STATIC(NHRPD, NHRP_IF, "NHRP interface");
Expand Down
2 changes: 0 additions & 2 deletions nhrpd/nhrp_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "filter.h"

#include "nhrpd.h"
#include "netlink.h"
#include "nhrp_errors.h"

DEFINE_MGROUP(NHRPD, "NHRP");
Expand Down Expand Up @@ -154,7 +153,6 @@ int main(int argc, char **argv)
assert(nhrpd_privs.change);
nhrpd_privs.change(ZPRIVS_RAISE);

netlink_init();
evmgr_init();
nhrp_vc_init();
nhrp_packet_init();
Expand Down
1 change: 0 additions & 1 deletion nhrpd/subdir.am
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ nhrpd_nhrpd_LDADD = lib/libfrr.la lib/libfrrcares.la $(LIBCAP)
nhrpd_nhrpd_SOURCES = \
nhrpd/linux.c \
nhrpd/netlink_arp.c \
nhrpd/netlink_gre.c \
nhrpd/nhrp_cache.c \
nhrpd/nhrp_errors.c \
nhrpd/nhrp_event.c \
Expand Down

0 comments on commit aea6c49

Please sign in to comment.