passt: Print ports in debug messages only for protocols with ports
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
49c766398d
commit
5f21a77737
1 changed files with 5 additions and 2 deletions
7
passt.c
7
passt.c
|
@ -330,7 +330,9 @@ static void tap4_handler(struct ctx *c, char *in, size_t len)
|
|||
debug("icmp from tap: %s -> %s",
|
||||
inet_ntop(AF_INET, &iph->saddr, buf_s, sizeof(buf_s)),
|
||||
inet_ntop(AF_INET, &iph->daddr, buf_d, sizeof(buf_d)));
|
||||
} else {
|
||||
} else if (iph->protocol == IPPROTO_TCP ||
|
||||
iph->protocol == IPPROTO_UDP ||
|
||||
iph->protocol == IPPROTO_SCTP) {
|
||||
struct tcphdr *th = (struct tcphdr *)l4h;
|
||||
|
||||
if (len < sizeof(*th) && len < sizeof(struct udphdr))
|
||||
|
@ -387,7 +389,8 @@ static void tap6_handler(struct ctx *c, char *in, size_t len)
|
|||
debug("icmpv6 from tap: %s ->\n\t%s",
|
||||
inet_ntop(AF_INET6, &ip6h->saddr, buf_s, sizeof(buf_s)),
|
||||
inet_ntop(AF_INET6, &ip6h->daddr, buf_d, sizeof(buf_d)));
|
||||
} else {
|
||||
} else if (proto == IPPROTO_TCP || proto == IPPROTO_UDP ||
|
||||
proto == IPPROTO_SCTP) {
|
||||
struct tcphdr *th = (struct tcphdr *)l4h;
|
||||
|
||||
if (len < sizeof(*th) && len < sizeof(struct udphdr))
|
||||
|
|
Loading…
Reference in a new issue