]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
iproute_tunnel: use uint16 for tunnel encap type
authorStephen Hemminger <stephen@networkplumber.org>
Fri, 14 Apr 2023 19:40:56 +0000 (12:40 -0700)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 14 Apr 2023 19:40:56 +0000 (12:40 -0700)
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 <stephen@networkplumber.org>
ip/iproute_lwtunnel.c

index 52221c6976b36a8f256d8e0e1f088fa3ce821e7b..8b7f3742b71e33b90cb9df12cc8bc7cf45ed7b20 100644 (file)
@@ -32,7 +32,7 @@
 #include <linux/ioam6.h>
 #include <linux/ioam6_iptunnel.h>
 
-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;