Guest's initial sequence number can be found in the SYN package that
guest send to us to intialize a TCP session.

Remote server's initial sequence number is faked. RFC 793 specifies
that the ISN should be viewed as a 32-bit counter that increments
by one every 4 microseconds. For simplicity's sake, current
implementation in uip just returns a constant.

Signed-off-by: Asias He <[email protected]>
---
 tools/kvm/include/kvm/uip.h |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/tools/kvm/include/kvm/uip.h b/tools/kvm/include/kvm/uip.h
index 5585680..46cec20 100644
--- a/tools/kvm/include/kvm/uip.h
+++ b/tools/kvm/include/kvm/uip.h
@@ -244,6 +244,19 @@ static inline bool uip_tcp_is_fin(struct uip_tcp *tcp)
        return (tcp->flg & UIP_TCP_FLAG_FIN) != 0;
 }
 
+static inline u32 uip_tcp_isn(struct uip_tcp *tcp)
+{
+       return ntohl(tcp->seq);
+}
+
+static inline u32 uip_tcp_isn_alloc(void)
+{
+       /*
+        * FIXME: should increase every 4ms
+        */
+       return 10000000;
+}
+
 static inline u16 uip_eth_hdrlen(struct uip_eth *eth)
 {
        return sizeof(*eth);
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to