Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions netlink/librtnl/mapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
* limitations under the License.
*/

#include <librtnl/mapper.h>
#include <librtnl/netns.h>
#include "mapper.h"
#include "netns.h"

#include <vnet/ip/ip.h>
#include <vnet/ip/lookup.h>
Expand Down Expand Up @@ -42,7 +42,7 @@ static mapper_main_t mapper_main;
mapper_map_t *mapper_get_by_ifindex(mapper_ns_t *ns, int ifindex)
{
mapper_map_t *map;
pool_foreach(map, ns->mappings, {
pool_foreach_old(map, ns->mappings, {
if (ifindex == map->linux_ifindex)
return map;
});
Expand Down Expand Up @@ -127,7 +127,7 @@ mapper_delmap(mapper_ns_t*ns, mapper_map_t *map)
{
ns_route_t *route;
netns_t *netns = netns_getns(ns->netns_handle);
pool_foreach(route, netns->routes, {
pool_foreach_old(route, netns->routes, {
if (route->oif == map->linux_ifindex)
mapper_add_del_route(ns, route, 1);
});
Expand All @@ -139,7 +139,7 @@ mapper_getmap(mapper_ns_t*ns, u32 sw_if_index,
int linux_ifindex, int create)
{
mapper_map_t *map;
pool_foreach(map, ns->mappings, {
pool_foreach_old(map, ns->mappings, {
if (linux_ifindex == map->linux_ifindex) {
if (sw_if_index != map->sw_if_index)
return NULL; //Cannot have multiple mapping with the same ifindex
Expand All @@ -160,7 +160,7 @@ mapper_getmap(mapper_ns_t*ns, u32 sw_if_index,
//Load available routes
ns_route_t *route;
netns_t *netns = netns_getns(ns->netns_handle);
pool_foreach(route, netns->routes, {
pool_foreach_old(route, netns->routes, {
if (route->oif == map->linux_ifindex)
mapper_add_del_route(ns, route, 0);
});
Expand All @@ -172,7 +172,7 @@ mapper_get_ns(char *nsname)
{
mapper_main_t *mm = &mapper_main;
mapper_ns_t *ns;
pool_foreach(ns, mm->namespaces, {
pool_foreach_old(ns, mm->namespaces, {
if (!strcmp(nsname, ns->nsname))
return ns - mm->namespaces;
});
Expand Down Expand Up @@ -246,7 +246,7 @@ mapper_del_ns(u32 nsindex)

//Remove all existing mappings
int i, *indexes = 0;
pool_foreach_index(i, ns->mappings, {
pool_foreach_index_old(i, ns->mappings, {
vec_add1(indexes, i);
});
vec_foreach_index(i, indexes) {
Expand Down
2 changes: 1 addition & 1 deletion netlink/librtnl/mapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#ifndef MAPPER_H_
#define MAPPER_H_

#include <librtnl/netns.h>
#include "netns.h"

/*
* Automatically map linux network routes to VPP.
Expand Down
18 changes: 9 additions & 9 deletions netlink/librtnl/netns.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

#include <librtnl/netns.h>
#include "netns.h"

#include <vnet/ip/format.h>
#include <vnet/ethernet/ethernet.h>
Expand Down Expand Up @@ -315,7 +315,7 @@ netns_notify(netns_p *ns, void *obj, netns_type_t type, u32 flags)
{
netns_main_t *nm = &netns_main;
netns_handle_t *h;
pool_foreach(h, nm->handles, {
pool_foreach_old(h, nm->handles, {
if (h->netns_index == (ns - nm->netnss) && h->notify)
h->notify(obj, type, flags, h->opaque);
});
Expand All @@ -338,7 +338,7 @@ static ns_link_t *
ns_get_link(netns_p *ns, struct ifinfomsg *ifi, struct rtattr *rtas[])
{
ns_link_t *link;
pool_foreach(link, ns->netns.links, {
pool_foreach_old(link, ns->netns.links, {
if(ifi->ifi_index == link->ifi.ifi_index)
return link;
});
Expand Down Expand Up @@ -404,7 +404,7 @@ ns_get_route(netns_p *ns, struct rtmsg *rtm, struct rtattr *rtas[])
.rtm_type = 0xff
};

pool_foreach(route, ns->netns.routes, {
pool_foreach_old(route, ns->netns.routes, {
if(mask_match(&route->rtm, rtm, &msg, sizeof(struct rtmsg)) &&
rtnl_entry_match(route, rtas, ns_routemap))
return route;
Expand Down Expand Up @@ -467,7 +467,7 @@ ns_get_addr(netns_p *ns, struct ifaddrmsg *ifaddr, struct rtattr *rtas[])
.ifa_prefixlen = 0xff,
};

pool_foreach(addr, ns->netns.addresses, {
pool_foreach_old(addr, ns->netns.addresses, {
if(mask_match(&addr->ifaddr, ifaddr, &msg, sizeof(struct ifaddrmsg)) &&
rtnl_entry_match(addr, rtas, ns_addrmap))
return addr;
Expand Down Expand Up @@ -530,7 +530,7 @@ ns_get_neigh(netns_p *ns, struct ndmsg *nd, struct rtattr *rtas[])
.ndm_ifindex = 0xff,
};

pool_foreach(neigh, ns->netns.neighbors, {
pool_foreach_old(neigh, ns->netns.neighbors, {
if(mask_match(&neigh->nd, nd, &msg, sizeof(&msg)) &&
rtnl_entry_match(neigh, rtas, ns_neighmap))
return neigh;
Expand Down Expand Up @@ -597,7 +597,7 @@ ns_recv_error(rtnl_error_t err, uword o)
u32 *i = 0;

#define _(pool, type) \
pool_foreach_index(*i, ns->netns.pool, { \
pool_foreach_index_old(*i, ns->netns.pool, { \
vec_add1(indexes, *i); \
}) \
vec_foreach(i, indexes) { \
Expand Down Expand Up @@ -656,7 +656,7 @@ netns_get(char *name)
{
netns_main_t *nm = &netns_main;
netns_p *ns;
pool_foreach(ns, nm->netnss, {
pool_foreach_old(ns, nm->netnss, {
if (!strcmp(name, ns->netns.name))
return ns;
});
Expand Down Expand Up @@ -733,7 +733,7 @@ void netns_callme(u32 handle, char del)
return;

#define _(pool, type) \
pool_foreach_index(i, ns->netns.pool, { \
pool_foreach_index_old(i, ns->netns.pool, { \
h->notify(&ns->netns.pool[i], type, \
del?NETNS_F_DEL:NETNS_F_ADD, h->opaque); \
});
Expand Down
2 changes: 1 addition & 1 deletion netlink/librtnl/netns.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <linux/netlink.h>
#include <net/if.h>

#include <librtnl/rtnl.h>
#include "rtnl.h"

/*include it for 'struct mpls_label'*/
#include <linux/mpls.h>
Expand Down
10 changes: 5 additions & 5 deletions netlink/librtnl/rtnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#define _GNU_SOURCE
#include <sched.h>

#include <librtnl/rtnl.h>
#include <librtnl/netns.h>
#include "rtnl.h"
#include "netns.h"

#include <vlib/vlib.h>
#include <vlib/unix/unix.h>
Expand Down Expand Up @@ -266,7 +266,7 @@ static int rtnl_socket_open(rtnl_ns_t *ns)
.nl_groups = grpmask(RTNLGRP_LINK)| grpmask(RTNLGRP_IPV6_IFADDR) |
grpmask(RTNLGRP_IPV4_IFADDR) | grpmask(RTNLGRP_IPV4_ROUTE) |
grpmask(RTNLGRP_IPV6_ROUTE) | grpmask(RTNLGRP_NEIGH) |
grpmask(RTNLGRP_NOTIFY) | grpmask(RTNLGRP_MPLS_ROUTE),
grpmask(RTNLGRP_NOTIFY),
};

if (bind(ns->rtnl_socket, (struct sockaddr*) &addr, sizeof(addr))) {
Expand Down Expand Up @@ -516,7 +516,7 @@ rtnl_process (vlib_main_t * vm,
rm->now = vlib_time_now(vm);

if (event_type == ~0) { //Clock event or no event
pool_foreach(ns, rm->streams, {
pool_foreach_old(ns, rm->streams, {
if (ns->timeout < rm->now) {
ns->timeout = DBL_MAX;
rtnl_process_timeout(ns);
Expand Down Expand Up @@ -545,7 +545,7 @@ rtnl_process (vlib_main_t * vm,
vec_reset_length (event_data);

timeout = DBL_MAX;
pool_foreach(ns, rm->streams, {
pool_foreach_old(ns, rm->streams, {
if (ns->timeout < timeout)
timeout = ns->timeout;
});
Expand Down
13 changes: 10 additions & 3 deletions router/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,18 @@

add_vpp_plugin(router
SOURCES
../netlink/librtnl/mapper.c
../netlink/librtnl/netns.c
../netlink/librtnl/rtnl.c
librtnl/mapper.c
librtnl/netns.c
librtnl/rtnl.c
router/tap_inject.c
router/tap_inject_netlink.c
router/tap_inject_node.c
router/tap_inject_tap.c

INSTALL_HEADERS
librtnl/mapper.h
librtnl/netns.h
librtnl/rtnl.h
router/tap_inject.h

)
2 changes: 1 addition & 1 deletion router/router/tap_inject.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ tap_inject_enable_disable_all_interfaces (int enable)
/* Collect all the interface indices. */
interfaces = vnet_main->interface_main.hw_interfaces;
indices = enable ? &im->interfaces_to_enable : &im->interfaces_to_disable;
pool_foreach (hw, interfaces, vec_add1 (*indices, hw - interfaces));
pool_foreach_old (hw, interfaces, vec_add1 (*indices, hw - interfaces));

if (tap_inject_iface_isr (vlib_get_main (), 0, 0))
return clib_error_return (0, "tap-inject interface add del isr failed");
Expand Down
4 changes: 3 additions & 1 deletion router/router/tap_inject_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include <librtnl/netns.h>
#include <router/librtnl/netns.h>
#include <vlibmemory/api.h>
#include <vnet/ip-neighbor/ip6_neighbor.h>
#include <vnet/ip/lookup.h>
Expand Down Expand Up @@ -227,6 +227,7 @@ add_del_route (ns_route_t * r, int is_del)
0 /* weight */, NULL,
FIB_ROUTE_PATH_FLAG_NONE);
}
#if 0
else if (r->rtm.rtm_family == AF_MPLS)
{
u32 dst_label;
Expand All @@ -252,6 +253,7 @@ add_del_route (ns_route_t * r, int is_del)
FIB_ENTRY_FLAG_NONE,
rpaths);
}
#endif
}


Expand Down
1 change: 1 addition & 0 deletions router/router/tap_inject_tap.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ tap_inject_tap_connect (vnet_hw_interface_t * hw)
/* Get notified when the tap needs to be read. */
template.read_function = tap_inject_tap_read;
template.file_descriptor = tap_fd;
template.description = name;

clib_file_add (&file_main, &template);

Expand Down
5 changes: 5 additions & 0 deletions vpp_21.06_help
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@



ln -sf ../netlink/librtnl router/librtnl
ln -sf ../../../vppsb/router vpp/src/plugins/router