diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2021-04-22 02:34:02 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2021-04-22 02:34:02 +0200 |
commit | 5f21a7773777124a60343a0e3b83dbf3b3ddd59f (patch) | |
tree | 22fc55ebb54e3d6da82aabe8fc54c469bceb0c2c | |
parent | 49c766398d47846bd837f5aa83b8bec930e3cf0e (diff) | |
download | passt-5f21a7773777124a60343a0e3b83dbf3b3ddd59f.tar passt-5f21a7773777124a60343a0e3b83dbf3b3ddd59f.tar.gz passt-5f21a7773777124a60343a0e3b83dbf3b3ddd59f.tar.bz2 passt-5f21a7773777124a60343a0e3b83dbf3b3ddd59f.tar.lz passt-5f21a7773777124a60343a0e3b83dbf3b3ddd59f.tar.xz passt-5f21a7773777124a60343a0e3b83dbf3b3ddd59f.tar.zst passt-5f21a7773777124a60343a0e3b83dbf3b3ddd59f.zip |
passt: Print ports in debug messages only for protocols with ports
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r-- | passt.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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)) |