mirror of
https://passt.top/passt
synced 2024-12-22 13:45:32 +00:00
passt: With -DDEBUG, also print protocol number for unsupported protocols
...otherwise, we have no idea what's going on if we receive something unexpected. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
7e3e36b2c2
commit
8754878fbf
10
passt.c
10
passt.c
@ -407,8 +407,8 @@ static int tap4_handler(struct ctx *c, struct tap_msg *msg, size_t count,
|
|||||||
if (msg[0].len < sizeof(*uh))
|
if (msg[0].len < sizeof(*uh))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
debug("%s from tap: %s:%i -> %s:%i (%i packet%s)",
|
debug("%s (%i) from tap: %s:%i -> %s:%i (%i packet%s)",
|
||||||
IP_PROTO_STR(iph->protocol),
|
IP_PROTO_STR(iph->protocol), iph->protocol,
|
||||||
inet_ntop(AF_INET, &iph->saddr, buf_s, sizeof(buf_s)),
|
inet_ntop(AF_INET, &iph->saddr, buf_s, sizeof(buf_s)),
|
||||||
ntohs(uh->source),
|
ntohs(uh->source),
|
||||||
inet_ntop(AF_INET, &iph->daddr, buf_d, sizeof(buf_d)),
|
inet_ntop(AF_INET, &iph->daddr, buf_d, sizeof(buf_d)),
|
||||||
@ -526,8 +526,8 @@ static int tap6_handler(struct ctx *c, struct tap_msg *msg, size_t count,
|
|||||||
if (msg[0].len < sizeof(*uh))
|
if (msg[0].len < sizeof(*uh))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
debug("%s from tap: [%s]:%i\n\t-> [%s]:%i (%i packet%s)",
|
debug("%s (%i) from tap: [%s]:%i\n\t-> [%s]:%i (%i packet%s)",
|
||||||
IP_PROTO_STR(proto),
|
IP_PROTO_STR(proto), proto,
|
||||||
inet_ntop(AF_INET6, &ip6h->saddr, buf_s, sizeof(buf_s)),
|
inet_ntop(AF_INET6, &ip6h->saddr, buf_s, sizeof(buf_s)),
|
||||||
ntohs(uh->source),
|
ntohs(uh->source),
|
||||||
inet_ntop(AF_INET6, &ip6h->daddr, buf_d, sizeof(buf_d)),
|
inet_ntop(AF_INET6, &ip6h->daddr, buf_d, sizeof(buf_d)),
|
||||||
@ -672,7 +672,7 @@ static void sock_handler(struct ctx *c, int s, uint32_t events,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
debug("%s: packet from socket %i", IP_PROTO_STR(proto), s);
|
debug("%s (%i): packet from socket %i", IP_PROTO_STR(proto), proto, s);
|
||||||
|
|
||||||
if (proto == IPPROTO_ICMP || proto == IPPROTO_ICMPV6)
|
if (proto == IPPROTO_ICMP || proto == IPPROTO_ICMPV6)
|
||||||
icmp_sock_handler(c, s, events, pkt_buf, now);
|
icmp_sock_handler(c, s, events, pkt_buf, now);
|
||||||
|
Loading…
Reference in New Issue
Block a user