From: Eric Leblond Date: Sat, 23 Mar 2019 09:44:51 +0000 (+0100) Subject: ebpf: remove useless var in xdp_filter X-Git-Tag: suricata-5.0.0-rc1~330 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=455d78728ea478fbffe97910bc32db43993d99b2;p=thirdparty%2Fsuricata.git ebpf: remove useless var in xdp_filter --- diff --git a/ebpf/xdp_filter.c b/ebpf/xdp_filter.c index e8a6772e56..1ab54309fe 100644 --- a/ebpf/xdp_filter.c +++ b/ebpf/xdp_filter.c @@ -417,7 +417,6 @@ int SEC("xdp") xdp_hashfilter(struct xdp_md *ctx) void *data_end = (void *)(long)ctx->data_end; void *data = (void *)(long)ctx->data; struct ethhdr *eth = data; - int rc = XDP_PASS; __u16 h_proto; __u64 nh_off; __u16 vlan0 = 0; @@ -441,7 +440,7 @@ int SEC("xdp") xdp_hashfilter(struct xdp_md *ctx) nh_off = sizeof(*eth); if (data + nh_off > data_end) - return rc; + return XDP_PASS; h_proto = eth->h_proto; @@ -451,7 +450,7 @@ int SEC("xdp") xdp_hashfilter(struct xdp_md *ctx) vhdr = data + nh_off; nh_off += sizeof(struct vlan_hdr); if (data + nh_off > data_end) - return rc; + return XDP_PASS; h_proto = vhdr->h_vlan_encapsulated_proto; vlan0 = vhdr->h_vlan_TCI & 0x0fff; } @@ -461,7 +460,7 @@ int SEC("xdp") xdp_hashfilter(struct xdp_md *ctx) vhdr = data + nh_off; nh_off += sizeof(struct vlan_hdr); if (data + nh_off > data_end) - return rc; + return XDP_PASS; h_proto = vhdr->h_vlan_encapsulated_proto; vlan1 = vhdr->h_vlan_TCI & 0x0fff; } @@ -470,10 +469,8 @@ int SEC("xdp") xdp_hashfilter(struct xdp_md *ctx) return filter_ipv4(ctx, data, nh_off, data_end, vlan0, vlan1); else if (h_proto == __constant_htons(ETH_P_IPV6)) return filter_ipv6(ctx, data, nh_off, data_end, vlan0, vlan1); - else - rc = XDP_PASS; - return rc; + return XDP_PASS; } char __license[] SEC("license") = "GPL";