Skip to content
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

Srv6 #151

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Srv6 #151

wants to merge 6 commits into from

Conversation

ogournet
Copy link
Contributor

@ogournet ogournet commented Feb 7, 2025

no interface are created, instead a hook is added in ip/ip6_input to visit our node.
need inputs on core grout modification before going further.

grcli trace from smoke-test srv6:

--------- 23:06:34.382273411 cpu 1 ---------
port_rx: port=0 queue=0
eth_input: d2:ad:ca:fe:b4:10 > d2:f0:0c:ba:a5:10 type=IP(0x0800) iface=p0
ip_input: 192.168.61.2 > 192.168.60.1 ttl=64 proto=ICMP(1)
srv6_steer: match=192.168.0.0/16
ip6_output: fd00:102::1 > fd00:202::2 ttl=64 proto=IPIP(4)
eth_output: d2:f0:0c:ba:a5:11 > d2:ad:ca:fe:b4:11 type=IPv6(0x86dd) iface=p1
port_tx: port=1 queue=0

--------- 23:06:34.382273411 cpu 1 ---------
port_rx: port=1 queue=0
eth_input: d2:ad:ca:fe:b4:11 > d2:f0:0c:ba:a5:11 type=IPv6(0x86dd) iface=p1
ip6_input: fd00:102::2 > fd00:202::100 ttl=64 proto=RouteOpts(43)
srv6_local: action=end.dt4
ip_input: 192.168.60.1 > 192.168.61.2 ttl=64 proto=ICMP(1)
ip_forward:
ip_output: 192.168.60.1 > 192.168.61.2 ttl=63 proto=ICMP(1)
eth_output: d2:f0:0c:ba:a5:10 > d2:ad:ca:fe:b4:10 type=IP(0x0800) iface=p0
port_tx: port=0 queue=0

Add helper to retrieve and parse ip6 address from cli node.

Signed-off-by: Olivier Gournet <[email protected]>
It will be needed by other modules that manipulate routes.

Fixes: 1e80bd6 ("ip: make route_lookup_exact private")
Signed-off-by: Olivier Gournet <[email protected]>
It will be needed by other modules that manipulate routes.

Fixes: 4c5ccc8 ("ip6: make route_lookup_exact private")
Signed-off-by: Olivier Gournet <[email protected]>
This is a fast and simple way of entering module's nodes,
right after route_lookup() in ip_input or ip6_input.

The nexthop object inserted in rib4/rib6 should set the
input_node field to its node. For example:

nh = nexthop_new(...);
nh->input_node = gr_node_attach_parent("ip6_input", "my_input_node");
rib6_insert(..., nh);

Signed-off-by: Olivier Gournet <[email protected]>
Make nexthop_incref() return itself, as a common design pattern.

Signed-off-by: Olivier Gournet <[email protected]>
Add srv6 module.

WIP

Trace for smoke-test srv6:

--------- 23:06:34.382273411 cpu 1 ---------
port_rx: port=0 queue=0
eth_input: d2:ad:ca:fe:b4:10 > d2:f0:0c:ba:a5:10 type=IP(0x0800) iface=p0
ip_input: 192.168.61.2 > 192.168.60.1 ttl=64 proto=ICMP(1)
srv6_steer: match=192.168.0.0/16
ip6_output: fd00:102::1 > fd00:202::2 ttl=64 proto=IPIP(4)
eth_output: d2:f0:0c:ba:a5:11 > d2:ad:ca:fe:b4:11 type=IPv6(0x86dd) iface=p1
port_tx: port=1 queue=0

--------- 23:06:34.382273411 cpu 1 ---------
port_rx: port=1 queue=0
eth_input: d2:ad:ca:fe:b4:11 > d2:f0:0c:ba:a5:11 type=IPv6(0x86dd) iface=p1
ip6_input: fd00:102::2 > fd00:202::100 ttl=64 proto=RouteOpts(43)
srv6_local: action=end.dt4
ip_input: 192.168.60.1 > 192.168.61.2 ttl=64 proto=ICMP(1)
ip_forward:
ip_output: 192.168.60.1 > 192.168.61.2 ttl=63 proto=ICMP(1)
eth_output: d2:f0:0c:ba:a5:10 > d2:ad:ca:fe:b4:10 type=IP(0x0800) iface=p0
port_tx: port=0 queue=0

Signed-off-by: Olivier Gournet <[email protected]>

if ((str = arg_str(p, "DEST6")) != NULL) {
if (ip6_net_parse(str, &req->s.dest6, true) < 0)
return CMD_ERROR;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't you need a free(req) for both error cases DEST6 and DEST4 here after ?

I feel that all the cases:

free(req);
return CMD_ERROR;

should be replaced by a goto cmd_error;

then the end of this function becomes:

free(req);
free(resp_ptr);
return CMD_SUCCESS;

cmd_error:
  free(req);
  return CMD_ERROR;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants