On 3/7/18 9:03 PM, Roopa Prabhu wrote:
> @@ -802,6 +836,39 @@ static int iprule_modify(int cmd, int argc, char **argv)
> addattr32(&req.n, sizeof(req), RTA_GATEWAY,
> get_addr32(*argv));
> req.frh.action = RTN_NAT;
> + } else if (strcmp(*argv, "ip_proto") == 0) {
> + __u8 ip_proto;
> +
> + NEXT_ARG();
> + ip_proto = inet_proto_a2n(*argv);
> + if (ip_proto < 0)
> + invarg("Invalid \"ip_proto\" value\n",
> + *argv);
as a __u8 ip_proto is never < 0 which means you are not catching invalid
protocol names and the rules get installed as 255:
$ ip -6 ru add pref 999 ip_proto ndisc table 13
$ ip -6 ru ls
999: from all ip_proto ipproto-255 lookup 13
...