Skip to content

Commit

Permalink
handle map fd not found
Browse files Browse the repository at this point in the history
Signed-off-by: Ric Li <[email protected]>
  • Loading branch information
ricmli committed Nov 3, 2023
1 parent 27dd729 commit 9bace79
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tools/ebpf/et.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ static int et_xdp_loop(struct et_ctx* ctx) {
continue;
}
char ifname[IFNAMSIZ];
int map_fd;
int map_fd = -1;
recv(conn, ifname, sizeof(ifname), 0);
printf("request xsk_map_fd for ifname %s\n", ifname);
int ifindex = if_nametoindex(ifname);
Expand All @@ -179,6 +179,10 @@ static int et_xdp_loop(struct et_ctx* ctx) {
break;
}
}
if (map_fd < 0) {
printf("xsk_map_fd not found for %s\n", ifname);
goto cleanup;
}
send_fd(conn, map_fd);
close(conn);
printf("map_fd %d sent, close conn\n", map_fd);
Expand Down

0 comments on commit 9bace79

Please sign in to comment.