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

NewRouteInfo does take in account IPv6 route #60

Open
kunalmahajan07 opened this issue Aug 13, 2024 · 0 comments
Open

NewRouteInfo does take in account IPv6 route #60

kunalmahajan07 opened this issue Aug 13, 2024 · 0 comments

Comments

@kunalmahajan07
Copy link

I was using the plugin to get the default route through NewRouteInfo on my IPv6 deployment and seems like the method doesn't take in account IPv6 and only provides default route for IPv4

here is the snippet of the NewRouteInfo under route_info_linux.go

func NewRouteInfo() (routeInfo, error) {
	// CoreOS Container Linux moved ip to /usr/bin/ip, so look it up on
	// $PATH and fallback to /sbin/ip on error.
	path, _ := exec.LookPath("ip")
	if path == "" {
		path = "/sbin/ip"
	}

	return routeInfo{
		cmds: map[string][]string{"ip": {path, "route"}},
	}, nil
}

Technically it path should take in account ip -6 for ipv6 as running above command on the IPv6 box returns

[root@console-kunal ~]# /sbin/ip route show default <--- returns nothing on IPv6

[root@console-kunal ~]# ip -6 addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
    inet6 fd0c:80bd:192:0:250:56ff:fe9e:c72/64 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::250:56ff:fe9e:c72/64 scope link
       valid_lft forever preferred_lft forever

Expected result would be something like this

root@console-kunal ~]# /sbin/ip -6 route show default
default via ip dev ens192 metric 1 pref medium
[root@console-kunal ~]#
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

No branches or pull requests

1 participant