From: Stephen Hemminger Date: Fri, 14 Apr 2023 19:40:56 +0000 (-0700) Subject: iproute_tunnel: use uint16 for tunnel encap type X-Git-Tag: v6.3.0~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f5db8310e9391b8768f9452f8e6ed34065f1af5e;p=thirdparty%2Fiproute2.git iproute_tunnel: use uint16 for tunnel encap type The tunnel encap type is passed as unsigned 16 bit value in/out of kernel. Keep it unsigned in the encode/decode logic. Signed-off-by: Stephen Hemminger --- diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c index 52221c697..8b7f3742b 100644 --- a/ip/iproute_lwtunnel.c +++ b/ip/iproute_lwtunnel.c @@ -32,7 +32,7 @@ #include #include -static const char *format_encap_type(int type) +static const char *format_encap_type(uint16_t type) { switch (type) { case LWTUNNEL_ENCAP_MPLS: @@ -62,7 +62,7 @@ static const char *format_encap_type(int type) static void encap_type_usage(void) { - int i; + uint16_t i; fprintf(stderr, "Usage: ip route ... encap TYPE [ OPTIONS ] [...]\n"); @@ -73,7 +73,7 @@ static void encap_type_usage(void) exit(-1); } -static int read_encap_type(const char *name) +static uint16_t read_encap_type(const char *name) { if (strcmp(name, "mpls") == 0) return LWTUNNEL_ENCAP_MPLS; @@ -834,7 +834,7 @@ static void print_encap_xfrm(FILE *fp, struct rtattr *encap) void lwt_print_encap(FILE *fp, struct rtattr *encap_type, struct rtattr *encap) { - int et; + uint16_t et; if (!encap_type) return;