Tag: traceroute

从带有MSG_ERRQUEUE标志的recvmsg读取ICMP有效负载

我正在使用BSD套接字来构建一个不需要root权限的高级traceroute程序(如tracepath)。 使用UDP和绑定套接字,我调用: recvmsg(socket, header, MSG_ERRQUEUE) 我收到有关先前发送的数据包已触发的假定ICMP通知的信息。 您知道是否可以访问ICMP有效负载(应该是先前发送的数据包)? 我从recvmsg手册页中读到: [..] The payload of the original packet that caused the error is passed as normal data via msg_iovec. [..] 但是我找不到任何有用的东西,它只是随机数据(我用wireshark来交叉检查数据)。