iproute_lwtunnel: csum_mode value checking was ineffective
ila_csum_name2mode() returning -1 on error but being declared as returning __u8 doesn't make much sense. Change the code to correctly detect this issue. Checking for __u8 overruns shouldn't be necessary though since ila_csum_name2mode() return values are well-defined. Signed-off-by: Phil Sutter <phil@nwl.cc>
This commit is contained in:
parent
58a15e6c7e
commit
08806fb019
|
|
@ -171,7 +171,7 @@ static char *ila_csum_mode2name(__u8 csum_mode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static __u8 ila_csum_name2mode(char *name)
|
static int ila_csum_name2mode(char *name)
|
||||||
{
|
{
|
||||||
if (strcmp(name, "adj-transport") == 0)
|
if (strcmp(name, "adj-transport") == 0)
|
||||||
return ILA_CSUM_ADJUST_TRANSPORT;
|
return ILA_CSUM_ADJUST_TRANSPORT;
|
||||||
|
|
@ -517,7 +517,7 @@ static int parse_encap_ila(struct rtattr *rta, size_t len,
|
||||||
|
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
if (strcmp(*argv, "csum-mode") == 0) {
|
if (strcmp(*argv, "csum-mode") == 0) {
|
||||||
__u8 csum_mode;
|
int csum_mode;
|
||||||
|
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
|
|
||||||
|
|
@ -526,7 +526,8 @@ static int parse_encap_ila(struct rtattr *rta, size_t len,
|
||||||
invarg("\"csum-mode\" value is invalid\n",
|
invarg("\"csum-mode\" value is invalid\n",
|
||||||
*argv);
|
*argv);
|
||||||
|
|
||||||
rta_addattr8(rta, 1024, ILA_ATTR_CSUM_MODE, csum_mode);
|
rta_addattr8(rta, 1024, ILA_ATTR_CSUM_MODE,
|
||||||
|
(__u8)csum_mode);
|
||||||
|
|
||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue