We need to set it to 0 briefly for the xsum.  When we're done, change it
back.  Interestly enough, TCPv6 and UDP did this already.

You'd see this as packets with a TTL of 0 arriving at the guest VM.

Signed-off-by: Barret Rhoden <[email protected]>
---
 kern/src/net/tcp.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/kern/src/net/tcp.c b/kern/src/net/tcp.c
index d544fd9bda66..3fc7059b108e 100644
--- a/kern/src/net/tcp.c
+++ b/kern/src/net/tcp.c
@@ -1972,11 +1972,15 @@ void tcpiput(struct Proto *tcp, struct Ipifc *unused, 
struct block *bp)
        h6 = (Tcp6hdr *) (bp->rp);
 
        if ((h4->vihl & 0xF0) == IP_VER4) {
+               uint8_t ttl;
+
                version = V4;
                length = nhgets(h4->length);
                v4tov6(dest, h4->tcpdst);
                v4tov6(source, h4->tcpsrc);
 
+               /* ttl isn't part of the xsum pseudo header, but bypass needs 
it. */
+               ttl = h4->Unused;
                h4->Unused = 0;
                hnputs(h4->tcplen, length - TCP4_PKT);
                if (!(bp->flag & Btcpck) && (h4->tcpcksum[0] || 
h4->tcpcksum[1]) &&
@@ -1987,6 +1991,7 @@ void tcpiput(struct Proto *tcp, struct Ipifc *unused, 
struct block *bp)
                        freeblist(bp);
                        return;
                }
+               h4->Unused = ttl;
 
                hdrlen = ntohtcp4(&seg, &bp);
                if (hdrlen < 0) {
-- 
2.11.0.483.g087da7b7c-goog

-- 
You received this message because you are subscribed to the Google Groups 
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to