aboutsummaryrefslogtreecommitdiffstats
path: root/router
diff options
context:
space:
mode:
Diffstat (limited to 'router')
-rw-r--r--router/Makefile.am13
-rw-r--r--router/router/tap_inject.c36
-rw-r--r--router/router/tap_inject.h1
-rw-r--r--router/router/tap_inject_netlink.c40
4 files changed, 12 insertions, 78 deletions
diff --git a/router/Makefile.am b/router/Makefile.am
index b9de6a1..a4387dd 100644
--- a/router/Makefile.am
+++ b/router/Makefile.am
@@ -3,10 +3,15 @@ AUTOMAKE_OPTIONS = foreign subdir-objects
AM_CFLAGS = -Wall -I@TOOLKIT_INCLUDE@
lib_LTLIBRARIES = router.la
-router_la_SOURCES = router/tap_inject.c \
- router/tap_inject_netlink.c \
- router/tap_inject_node.c \
- router/tap_inject_tap.c
+router_la_SOURCES = \
+ router/tap_inject.c \
+ router/tap_inject_netlink.c \
+ router/tap_inject_node.c \
+ router/tap_inject_tap.c
+
+nobase_include_HEADERS = \
+ router/tap_inject.h
+
router_la_LDFLAGS = -module
router_la_LIBADD = -lrtnl
diff --git a/router/router/tap_inject.c b/router/router/tap_inject.c
index e8d3f98..f41ae86 100644
--- a/router/router/tap_inject.c
+++ b/router/router/tap_inject.c
@@ -19,12 +19,7 @@
#include <vnet/mfib/mfib_table.h>
#include <vnet/ip/ip.h>
#include <vnet/ip/lookup.h>
-#ifdef ip6_add_del_route_next_hop
-#define FIB_VERSION 1
-#else
#include <vnet/fib/fib.h>
-#define FIB_VERSION 2
-#endif
static tap_inject_main_t tap_inject_main;
extern dpo_type_t tap_inject_dpo_type;
@@ -146,36 +141,6 @@ tap_inject_enable (void)
ip6_register_protocol (IP_PROTOCOL_TCP, im->tx_node_index);
ip6_register_protocol (IP_PROTOCOL_UDP, im->tx_node_index);
-#if FIB_VERSION == 1
- /* Add IPv4 multicast route. */
- {
- ip4_add_del_route_args_t a;
- ip_adjacency_t add_adj;
- u32 next_node_index;
-
- memset (&a, 0, sizeof (a));
- memset (&add_adj, 0, sizeof (add_adj));
-
- a.add_adj = &add_adj;
- a.n_add_adj = 1;
-
- a.flags = IP4_ROUTE_FLAG_TABLE_ID | IP4_ROUTE_FLAG_ADD;
- a.table_index_or_table_id = 0;
- a.dst_address.as_u32 = 0x000000E0; /* 224.0.0.0 */
- a.dst_address_length = 24;
- a.adj_index = ~0;
-
- next_node_index = vlib_node_add_next (vm, ip4_lookup_node.index,
- im->tx_node_index);
-
- add_adj.explicit_fib_index = ~0;
- add_adj.rewrite_header.node_index = ip4_rewrite_node.index;
- add_adj.lookup_next_index = next_node_index;
- add_adj.if_address_index = ~0;
-
- ip4_add_del_route (&ip4_main, &a);
- }
-#else
{
dpo_id_t dpo = DPO_INVALID;
@@ -203,7 +168,6 @@ tap_inject_enable (void)
dpo_reset(&dpo);
}
-#endif /* FIB_VERSION == 1 */
im->flags |= TAP_INJECT_F_ENABLED;
diff --git a/router/router/tap_inject.h b/router/router/tap_inject.h
index 001ab52..ec5121a 100644
--- a/router/router/tap_inject.h
+++ b/router/router/tap_inject.h
@@ -20,7 +20,6 @@
#include <vnet/plugin/plugin.h>
#include <vnet/ip/ip.h>
-
#ifndef ETHER_ADDR_LEN
#define ETHER_ADDR_LEN 6
#endif
diff --git a/router/router/tap_inject_netlink.c b/router/router/tap_inject_netlink.c
index 3dca013..bd5da49 100644
--- a/router/router/tap_inject_netlink.c
+++ b/router/router/tap_inject_netlink.c
@@ -14,25 +14,18 @@
* limitations under the License.
*/
-#include "tap_inject.h"
#include <librtnl/netns.h>
#include <vlibmemory/api.h>
-#include <vnet/ethernet/arp_packet.h>
#include <vnet/ip/ip6_neighbor.h>
-
-#include <vnet/ip/ip.h>
#include <vnet/ip/lookup.h>
-#ifdef ip6_add_del_route_next_hop
-#define FIB_VERSION 1
-#else
#include <vnet/fib/fib.h>
-#define FIB_VERSION 2
-#endif
-
+#include <vnet/ethernet/arp.h>
#include <arpa/inet.h>
#include <linux/mpls.h>
#include <vnet/mpls/packet.h>
+#include "tap_inject.h"
+
static void
add_del_addr (ns_addr_t * a, int is_del)
{
@@ -124,37 +117,24 @@ add_del_neigh (ns_neigh_t * n, int is_del)
if (n->nd.ndm_state & NUD_REACHABLE)
{
-#if FIB_VERSION == 1
- vnet_arp_set_ip4_over_ethernet (vnet_main, sw_if_index, ~0, &a, 0);
-#else
vnet_arp_set_ip4_over_ethernet (vnet_main, sw_if_index,
&a, 0 /* static */ ,
0 /* no fib entry */);
-#endif /* FIB_VERSION == 1 */
}
else if (n->nd.ndm_state & NUD_FAILED)
{
-#if FIB_VERSION == 1
- vnet_arp_unset_ip4_over_ethernet (vnet_main, sw_if_index, ~0, &a);
-#else
vnet_arp_unset_ip4_over_ethernet (vnet_main, sw_if_index, &a);
-#endif /* FIB_VERSION == 1 */
}
}
else if (n->nd.ndm_family == AF_INET6)
{
if (n->nd.ndm_state & NUD_REACHABLE)
{
-#if FIB_VERSION == 1
- vnet_set_ip6_ethernet_neighbor (vm, sw_if_index,
- (ip6_address_t *) n->dst, n->lladdr, ETHER_ADDR_LEN, 0);
-#else
vnet_set_ip6_ethernet_neighbor (vm, sw_if_index,
(ip6_address_t *) n->dst, n->lladdr, ETHER_ADDR_LEN,
0 /* static */,
0 /* no fib entry */);
-#endif /* FIB_VERSION == 1 */
}
else
vnet_unset_ip6_ethernet_neighbor (vm, sw_if_index,
@@ -194,12 +174,6 @@ add_del_route (ns_route_t * r, int is_del)
{
u32 stack[MPLS_STACK_DEPTH] = {0};
-#if FIB_VERSION == 1
- ip4_add_del_route_next_hop (&ip4_main,
- is_del ? IP4_ROUTE_FLAG_DEL : IP4_ROUTE_FLAG_ADD,
- (ip4_address_t *) r->dst, r->rtm.rtm_dst_len,
- (ip4_address_t *) r->gateway, sw_if_index, 0, ~0, 0);
-#else
fib_prefix_t prefix;
ip46_address_t nh;
@@ -234,16 +208,9 @@ add_del_route (ns_route_t * r, int is_del)
FIB_ENTRY_FLAG_NONE,
rpaths);
}
-#endif /* FIB_VERSION == 1 */
}
else if (r->rtm.rtm_family == AF_INET6)
{
-#if FIB_VERSION == 1
- ip6_add_del_route_next_hop (&ip6_main,
- is_del ? IP6_ROUTE_FLAG_DEL : IP6_ROUTE_FLAG_ADD,
- (ip6_address_t *) r->dst, r->rtm.rtm_dst_len,
- (ip6_address_t *) r->gateway, sw_if_index, 0, ~0, 0);
-#else
fib_prefix_t prefix;
ip46_address_t nh;
memset (&prefix, 0, sizeof (prefix));
@@ -257,7 +224,6 @@ add_del_route (ns_route_t * r, int is_del)
&nh, sw_if_index, 0,
0 /* weight */, NULL,
FIB_ROUTE_PATH_FLAG_NONE);
-#endif /* FIB_VERSION == 1 */
}
else if (r->rtm.rtm_family == AF_MPLS)
{