clatd: rework buffer sizes
The function internal implementation details of the true
required number of bytes for these buffers doesn't really
belong in the header file.
Test: TreeHugger
Bug: 265591307
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I1aef7adc4c8af9b53d2c0b8da0eb2c1c6e6dd12a
diff --git a/clatd.h b/clatd.h
index cfcb253..59f78ab 100644
--- a/clatd.h
+++ b/clatd.h
@@ -38,14 +38,15 @@
//
// (since there's no jumbogram support in IPv4, IPv6 jumbograms cannot be meaningfully
// converted to IPv4 anyway, and are thus entirely unsupported)
-//
-// We bump it by one more, since it makes truncation more obvious.
-// ie. if we ever read >= MAXMTU bytes we should discard.
-#define MAXMTU (0xFFFF + 28 + 1)
-#define PACKETLEN (sizeof(struct tun_pi) + MAXMTU)
+#define MAXMTU (0xFFFF + 28)
-// logcat_hexdump() maximum binary data length
-#define MAXDUMPLEN PACKETLEN
+// logcat_hexdump() maximum binary data length, this is the maximum packet size
+// plus some extra space for various headers:
+// struct tun_pi (4 bytes)
+// struct virtio_net_hdr (10 bytes)
+// ethernet (14 bytes), potentially including vlan tag (4) or tags (8 or 12)
+// plus some extra just-in-case headroom, because it doesn't hurt.
+#define MAXDUMPLEN (64 + MAXMTU)
#define CLATD_VERSION "1.6"