From: Ido Schimmel Date: Tue, 25 Feb 2025 09:09:15 +0000 (+0200) Subject: iprule: Allow specifying ports in hexadecimal notation X-Git-Tag: v6.15.0~6^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c7aa222948b21ebc926c27a35963871fb774def5;p=thirdparty%2Fiproute2.git iprule: Allow specifying ports in hexadecimal notation This will be useful when enabling port masks in the next patch. Before: # ip rule add sport 0x1 table 100 Invalid "sport" After: # ip rule add sport 0x1 table 100 $ ip rule show sport 0x1 32765: from all sport 1 lookup 100 Signed-off-by: Ido Schimmel Reviewed-by: Petr Machata Signed-off-by: David Ahern --- diff --git a/ip/iprule.c b/ip/iprule.c index 61e092bc..64d389be 100644 --- a/ip/iprule.c +++ b/ip/iprule.c @@ -608,16 +608,16 @@ static void iprule_port_parse(char *arg, struct fib_rule_port_range *r) if (sep) { *sep = '\0'; - if (get_u16(&r->start, arg, 10)) + if (get_u16(&r->start, arg, 0)) invarg("invalid port range start", arg); - if (get_u16(&r->end, sep + 1, 10)) + if (get_u16(&r->end, sep + 1, 0)) invarg("invalid port range end", sep + 1); return; } - if (get_u16(&r->start, arg, 10)) + if (get_u16(&r->start, arg, 0)) invarg("invalid port", arg); r->end = r->start;