diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2017-09-06 17:38:48 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2017-09-06 17:38:48 +0200 |
commit | 943478b00f585725c3e7406909ee867dcfac5f87 (patch) | |
tree | 749b4b807d1da59d38e0c5ae2794ac52c8cd0507 /nest/proto.c | |
parent | 98bb80a243b58c43453e9be69d19d0350286549c (diff) |
Basic VRF support
Add basic VRF (virtual routing and forwarding) support. Protocols can be
associated with VRFs, such protocols will be restricted to interfaces
assigned to the VRF (as reported by Linux kernel) and will use sockets
bound to the VRF. E.g., different multihop BGP instances can use diffent
kernel routing tables to handle BGP TCP connections.
The VRF support is preliminary, currently there are several limitations:
- Recent Linux kernels (4.11) do not handle correctly sockets bound
to interaces that are part of VRF, so most protocols other than multihop
BGP do not work. This will be fixed by future kernel versions.
- Neighbor cache ignores VRFs. Breaks config with the same prefix on
local interfaces in different VRFs. Not much problem as single hop
protocols do not work anyways.
- Olock code ignores VRFs. Breaks config with multiple BGP peers with the
same IP address in different VRFs.
- Incoming BGP connections are not dispatched according to VRFs.
Breaks config with multiple BGP peers with the same IP address in
different VRFs. Perhaps we would need some kernel API to read VRF of
incoming connection? Or probably use multiple listening sockets in
int-new branch.
- We should handle master VRF interface up/down events and perhaps
disable associated protocols when VRF goes down. Or at least disable
associated interfaces.
- Also we should check if the master iface is really VRF iface and
not some other kind of master iface.
- BFD session request dispatch should be aware of VRFs.
- Perhaps kernel protocol should read default kernel table ID from VRF
iface so it is not necessary to configure it.
- Perhaps we should have per-VRF default table.
Diffstat (limited to 'nest/proto.c')
-rw-r--r-- | nest/proto.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/nest/proto.c b/nest/proto.c index 1091b321..64422ee3 100644 --- a/nest/proto.c +++ b/nest/proto.c @@ -386,6 +386,7 @@ proto_init(struct proto_config *c) q->core_state = FS_HUNGRY; q->export_state = ES_DOWN; q->last_state_change = now; + q->vrf = c->vrf; add_tail(&initial_proto_list, &q->n); @@ -409,6 +410,7 @@ proto_reconfigure(struct proto *p, struct proto_config *oc, struct proto_config /* If there is a too big change in core attributes, ... */ if ((nc->protocol != oc->protocol) || (nc->disabled != p->disabled) || + (nc->vrf != oc->vrf) || (nc->table->table != oc->table->table)) return 0; @@ -1474,7 +1476,9 @@ proto_show_limit(struct proto_limit *l, const char *dsc) void proto_show_basic_info(struct proto *p) { - // cli_msg(-1006, " Table: %s", p->table->name); + if (p->vrf) + cli_msg(-1006, " VRF: %s", p->vrf->name); + cli_msg(-1006, " Preference: %d", p->preference); cli_msg(-1006, " Input filter: %s", filter_name(p->cf->in_filter)); cli_msg(-1006, " Output filter: %s", filter_name(p->cf->out_filter)); |