summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-11-14 09:12:03 +0300
committerDavid S. Miller <davem@davemloft.net>2017-11-14 22:00:13 +0900
commitfae45363ae4bac980b1d7451233c7bf3d66d9300 (patch)
tree5cd6e8af675cee67e450029ef8fe5199ff4f782a
parent4e6759be28e4e69c397ab58c1e780b0a15d8a6fd (diff)
downloadop-kernel-dev-fae45363ae4bac980b1d7451233c7bf3d66d9300.zip
op-kernel-dev-fae45363ae4bac980b1d7451233c7bf3d66d9300.tar.gz
xdp: sample: Missing curly braces in read_route()
The assert statement is supposed to be part of the else branch but the curly braces were accidentally left off. Fixes: 3e29cd0e6563 ("xdp: Sample xdp program implementing ip forward") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--samples/bpf/xdp_router_ipv4_user.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/samples/bpf/xdp_router_ipv4_user.c b/samples/bpf/xdp_router_ipv4_user.c
index 2c1fe3f..9164621 100644
--- a/samples/bpf/xdp_router_ipv4_user.c
+++ b/samples/bpf/xdp_router_ipv4_user.c
@@ -206,12 +206,13 @@ static void read_route(struct nlmsghdr *nh, int nll)
direct_entry.arp.mac = 0;
direct_entry.arp.dst = 0;
if (route.dst_len == 32) {
- if (nh->nlmsg_type == RTM_DELROUTE)
+ if (nh->nlmsg_type == RTM_DELROUTE) {
assert(bpf_map_delete_elem(map_fd[3], &route.dst) == 0);
- else
+ } else {
if (bpf_map_lookup_elem(map_fd[2], &route.dst, &direct_entry.arp.mac) == 0)
direct_entry.arp.dst = route.dst;
assert(bpf_map_update_elem(map_fd[3], &route.dst, &direct_entry, 0) == 0);
+ }
}
for (i = 0; i < 4; i++)
prefix_key->data[i] = (route.dst >> i * 8) & 0xff;
OpenPOWER on IntegriCloud