From: Phil Sutter <phil@nwl.cc> Date: 2017-08-17 17:12:39
This series collects those patches from v1 which are clear programming
flaws.
No changes to the actual patches, just splitting into smaller series.
Phil Sutter (3):
iproute_lwtunnel: csum_mode value checking was ineffective
iproute_lwtunnel: Argument to strerror must be positive
tipc/node: Fix socket fd check in cmd_node_get_addr()
ip/iproute_lwtunnel.c | 9 +++++----
tipc/node.c | 3 ++-
2 files changed, 7 insertions(+), 5 deletions(-)
--
2.13.1
From: Phil Sutter <phil@nwl.cc> Date: 2017-08-17 17:14:26
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>
---
ip/iproute_lwtunnel.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
@@ -526,7 +526,8 @@ static int parse_encap_ila(struct rtattr *rta, size_t len,invarg("\"csum-mode\" value is invalid\n",*argv);-rta_addattr8(rta,1024,ILA_ATTR_CSUM_MODE,csum_mode);+rta_addattr8(rta,1024,ILA_ATTR_CSUM_MODE,+(__u8)csum_mode);argc--;argv++;}else{
@@ -643,7 +643,7 @@ static int lwt_parse_bpf(struct rtattr *rta, size_t len,err=bpf_parse_common(bpf_type,&cfg,&bpf_cb_ops,&x);if(err<0){fprintf(stderr,"Failed to parse eBPF program: %s\n",-strerror(err));+strerror(-err));
If we are in userspace I'd expect errno values to be +ve.
Returning a -ve errno is very non-standard.
This is because bpf_parse() returns the number of instructions parsed or
a negative return code. We could change it to return instructions * -1
or a positive return code, but that's even more insane than calling
strerror(-err), isn't it?
Cheers, Phil
From: Stephen Hemminger <stephen@networkplumber.org> Date: 2017-08-18 16:15:43
On Thu, 17 Aug 2017 19:09:29 +0200
Phil Sutter [off-list ref] wrote:
This series collects those patches from v1 which are clear programming
flaws.
No changes to the actual patches, just splitting into smaller series.
Phil Sutter (3):
iproute_lwtunnel: csum_mode value checking was ineffective
iproute_lwtunnel: Argument to strerror must be positive
tipc/node: Fix socket fd check in cmd_node_get_addr()
ip/iproute_lwtunnel.c | 9 +++++----
tipc/node.c | 3 ++-
2 files changed, 7 insertions(+), 5 deletions(-)