Extend packet-dump system to DHCP and TFTP.

This commit is contained in:
Simon Kelley
2022-01-29 15:55:04 +00:00
parent c6d4c33d61
commit fc664d114d
8 changed files with 120 additions and 52 deletions

View File

@@ -79,7 +79,8 @@ void dump_init(void)
}
}
void dump_packet(int mask, void *packet, size_t len, union mysockaddr *src, union mysockaddr *dst)
void dump_packet(int mask, void *packet, size_t len,
union mysockaddr *src, union mysockaddr *dst, unsigned short port)
{
struct ip ip;
struct ip6_hdr ip6;
@@ -101,7 +102,7 @@ void dump_packet(int mask, void *packet, size_t len, union mysockaddr *src, unio
return;
/* So wireshark can Id the packet. */
udp.uh_sport = udp.uh_dport = htons(NAMESERVER_PORT);
udp.uh_sport = udp.uh_dport = htons(port);
if (src)
family = src->sa.sa_family;