-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Router advertisement & Router sollicitation #126
base: main
Are you sure you want to change the base?
Router advertisement & Router sollicitation #126
Conversation
@@ -5,4 +5,5 @@ cli_src += files( | |||
'address.c', | |||
'nexthop.c', | |||
'route.c', | |||
'router_advertisement.c', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe s/router_advertisement.c/ra.c/
or at least router_advert.c
?
|
||
ret = CLI_COMMAND( | ||
IP6_SHOW_CTX(root), | ||
"router-advertisment [IFACE]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/advertisment/advertisement/
But I think I prefer router-advert
. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even shorter ra
? Do you think it may be possible to have "short commands" in the CLI ?
So we could use both ra
and router-advertisement
? (or to even accept partial commands ?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you can have token alternatives separated by pipes (without spaces)
"ra|router-advert|... [IFACE]"
No partial marching though. You need to explicitly list all alternatives to allow libecoli to build a token graph.
} | ||
void ndp_router_sollicit_input_cb(struct rte_mbuf *m) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing empty line
@@ -89,6 +96,7 @@ static struct rte_node_register icmp6_input_node = { | |||
[ICMP6_OUTPUT] = "icmp6_output", | |||
[NEIGH_SOLICIT] = "ndp_ns_input", | |||
[NEIGH_ADVERT] = "ndp_na_input", | |||
[ROUTER_SOLICIT] = "control_output", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there no point in having an ndp_rs_input node for consistency with the other ndp types? You could perform sanity checks before sending the packet to slow path.
ev_base, -1, EV_PERSIST | EV_FINALIZE, send_ra_cb, iface | ||
); | ||
} else if (event == IFACE_EVENT_PRE_REMOVE) { | ||
event_free(ra_conf[iface->id].timer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about that but should you call event_free_finalize?
ra_conf[iface->id].timer = event_new( | ||
ev_base, -1, EV_PERSIST | EV_FINALIZE, send_ra_cb, iface | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I never recall this libevent api... Is this adding a 1s timer or do you need to "enable" it afterwards?
ra->cur_hoplim = IP6_DEFAULT_HOP_LIMIT; // Default TTL for this network | ||
ra->managed_addr = 0; // DHCPv6 is available | ||
ra->other_config = 0; // DNS available, ... | ||
ra->lifetime = rte_cpu_to_be_16(5); // Not a default router |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that in seconds? maybe worth a #define
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, while the lifetime is in seconds, the other parameters below are in milliseconds...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The defines are created in the next commit, when the configuration is settable by the user.
ra_conf[req->iface_id].interval = RA_DEFAULT_INTERVAL;
ra_conf[req->iface_id].lifetime = RA_DEFAULT_LIFETIME;
ra_conf[req->iface_id].preference = RA_DEFAULT_PREFERENCE;
I'll use them in this commit.
ra->reachable_time = rte_cpu_to_be_32(0); | ||
ra->retrans_timer = rte_cpu_to_be_32(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not essential, but RTE_BE32(0) would be better for constants.
return api_out(0, len); | ||
} | ||
void ndp_router_sollicit_input_cb(struct rte_mbuf *m) { | ||
uint16_t iface_id = mbuf_data(m)->iface->id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we're missing some RFC checks for router solicitations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll double check that.
We wrongly assumed that the data was still present when prepending an ip header. Rewrite the ip/ip6 header instead. Fixes: e27fab5 ("ip/ip6: post tcp/udp packets to loopback interface") Signed-off-by: Christophe Fontaine <[email protected]>
For VxLan tunnels, we need to register a specific destination udp port. Add a new node and api, and push all non-handled packets back to the management (loopback) interface, as done today. Signed-off-by: Christophe Fontaine <[email protected]>
BGP unnumbered relies on RA message to discover the local routers. Broadcast the simplest router advertisement message on ipv6 enabled interfaces. Additional options (DNS, ... ) may be added in the future. Signed-off-by: Christophe Fontaine <[email protected]>
Upon reception of a router sollicit message, trigger the existing timer to send immediately a router advertismement packet. Signed-off-by: Christophe Fontaine <[email protected]>
Add configuration knobs for RA messages. Instead of a hardcoded perdiodic message, allow a per-interface configuration. Signed-off-by: Christophe Fontaine <[email protected]>
The returned nexthop for a multicast route lookup doesn't have a defined iface. Yet, this nexthop is valid, and we can rely on the iface defined by the parent node to select the output iface. Signed-off-by: Christophe Fontaine <[email protected]>
957b425
to
78f1bb6
Compare
Add router advertisement support, with basic configuration (lifetime, priority, interval, but no DNS, etc.).
Also answer to router sollicitation messages.
Depends on PR #112