File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -313,11 +313,12 @@ int kprobe__udpv6_sendmsg(struct pt_regs *ctx)
313313 bpf_probe_read (& udpv6_key .sport , sizeof (udpv6_key .sport ), & sk -> __sk_common .skc_num );
314314 bpf_probe_read (& udpv6_key .saddr , sizeof (udpv6_key .saddr ), & sk -> __sk_common .skc_v6_rcv_saddr .in6_u .u6_addr32 );
315315
316- // TODO: obtain IPs from ancillary messages if daddr == 0 || saddr == 0
317- // https://elixir.bootlin.com/linux/v4.4.60/source/net/ipv4/ip_sockglue.c#L224
318- //
319- // IPV6_PKTINFO, in6_pktinfo
320-
316+ if (udpv6_key .saddr .part1 == 0 ){
317+ u64 cmsg = 0 ;
318+ bpf_probe_read (& cmsg , sizeof (cmsg ), & msg -> msg_control );
319+ struct in6_pktinfo * inpkt = (struct in6_pktinfo * )CMSG_DATA (cmsg );
320+ bpf_probe_read (& udpv6_key .saddr , sizeof (udpv6_key .saddr ), & inpkt -> ipi6_addr .s6_addr32 );
321+ }
321322
322323#if defined(__i386__ )
323324 struct sock_on_x86_32_t sock ;
You can’t perform that action at this time.
0 commit comments