Skip to content

Commit 4d6a7f0

Browse files
committed
packet03: comment out unused variable
Make failed due to following error: ``` xdp_prog_kern.c:60:8: error: variable 'echo_reply' set but not used [-Werror,-Wunused-but-set-variable] __u16 echo_reply; ^ 1 error generated. make[1]: *** [../common/common.mk:111: xdp_prog_kern.o] Error 1 make[1]: Leaving directory '/home/xdp-tutorial/packet03-redirecting' make: *** [Makefile:13: packet03-redirecting] Error 2 ``` Comment out relevant lines to fix. Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
1 parent d419031 commit 4d6a7f0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packet03-redirecting/xdp_prog_kern.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ int xdp_icmp_echo_func(struct xdp_md *ctx)
5757
int icmp_type;
5858
struct iphdr *iphdr;
5959
struct ipv6hdr *ipv6hdr;
60-
__u16 echo_reply;
60+
// __u16 echo_reply;
6161
struct icmphdr_common *icmphdr;
6262
__u32 action = XDP_PASS;
6363

@@ -88,12 +88,12 @@ int xdp_icmp_echo_func(struct xdp_md *ctx)
8888
if (eth_type == bpf_htons(ETH_P_IP) && icmp_type == ICMP_ECHO) {
8989
/* Swap IP source and destination */
9090
swap_src_dst_ipv4(iphdr);
91-
echo_reply = ICMP_ECHOREPLY;
91+
// echo_reply = ICMP_ECHOREPLY;
9292
} else if (eth_type == bpf_htons(ETH_P_IPV6)
9393
&& icmp_type == ICMPV6_ECHO_REQUEST) {
9494
/* Swap IPv6 source and destination */
9595
swap_src_dst_ipv6(ipv6hdr);
96-
echo_reply = ICMPV6_ECHO_REPLY;
96+
// echo_reply = ICMPV6_ECHO_REPLY;
9797
} else {
9898
goto out;
9999
}

0 commit comments

Comments
 (0)