Detect 6rd kernel missing support / 6rd tunnel scope
This patch fix two issues:
* If kernel is not supporting 6rd then ioctl() call
will return EINVAL, if so just skip perror call.
* 6rd scope is ipv6/ip tunnels. Dont try to fetch
6rd tunnel parms if tunnel protocol != IPPROTO_IPV6.
Signed-off-by: Alexandre Cassen <acassen@freebox.fr>
diff --git a/ip/iptunnel.c b/ip/iptunnel.c
index 1cd9fbd..3525fbb 100644
--- a/ip/iptunnel.c
+++ b/ip/iptunnel.c
@@ -365,7 +365,7 @@
if (!(p->iph.frag_off&htons(IP_DF)))
printf(" nopmtudisc");
- if (!tnl_ioctl_get_6rd(p->name, &ip6rd) && ip6rd.prefixlen) {
+ if (p->iph.protocol == IPPROTO_IPV6 && !tnl_ioctl_get_6rd(p->name, &ip6rd) && ip6rd.prefixlen) {
printf(" 6rd-prefix %s/%u ",
inet_ntop(AF_INET6, &ip6rd.prefix, s1, sizeof(s1)),
ip6rd.prefixlen);