Reported-by: Arne Goetje <arne_goe...@accton.com>
Signed-off-by: Minoru TAKAHASHI <takahashi.mino...@gmail.com>
---
 ryu/lib/packet/tcp.py                |  2 +-
 ryu/tests/unit/packet/test_packet.py | 10 +++++-----
 ryu/tests/unit/packet/test_tcp.py    | 12 ++++++------
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/ryu/lib/packet/tcp.py b/ryu/lib/packet/tcp.py
index a6f0167..f0e8645 100644
--- a/ryu/lib/packet/tcp.py
+++ b/ryu/lib/packet/tcp.py
@@ -48,7 +48,7 @@ class tcp(packet_base.PacketBase):
     _PACK_STR = '!HHIIBBHHH'
     _MIN_LEN = struct.calcsize(_PACK_STR)
 
-    def __init__(self, src_port=0, dst_port=0, seq=0, ack=0, offset=0,
+    def __init__(self, src_port=1, dst_port=1, seq=0, ack=0, offset=0,
                  bits=0, window_size=0, csum=0, urgent=0, option=None):
         super(tcp, self).__init__()
         self.src_port = src_port
diff --git a/ryu/tests/unit/packet/test_packet.py 
b/ryu/tests/unit/packet/test_packet.py
index 09bb307..9c9ceff 100644
--- a/ryu/tests/unit/packet/test_packet.py
+++ b/ryu/tests/unit/packet/test_packet.py
@@ -1038,8 +1038,8 @@ class TestPacket(unittest.TestCase):
 
         # tcp
         ok_(p_tcp)
-        eq_(0, p_tcp.src_port)
-        eq_(0, p_tcp.dst_port)
+        eq_(1, p_tcp.src_port)
+        eq_(1, p_tcp.dst_port)
         eq_(0, p_tcp.seq)
         eq_(0, p_tcp.ack)
         eq_(6, p_tcp.offset)
@@ -1052,7 +1052,7 @@ class TestPacket(unittest.TestCase):
         ph = struct.pack('!16s16sI3xB', ipaddr, ipaddr,
                          len(t_buf) + len(self.payload), 6)
         t = ph + t + self.payload
-        eq_(packet_utils.checksum(t), 0x60)
+        eq_(packet_utils.checksum(t), 0x62)
 
         # payload
         ok_('payload' in protocols)
@@ -1081,8 +1081,8 @@ class TestPacket(unittest.TestCase):
                               if k in ipv6_values])
         ipv6_str = '%s(%s)' % (ipv6.ipv6.__name__, _ipv6_str)
 
-        tcp_values = {'src_port': 0,
-                      'dst_port': 0,
+        tcp_values = {'src_port': 1,
+                      'dst_port': 1,
                       'seq': 0,
                       'ack': 0,
                       'offset': 6,
diff --git a/ryu/tests/unit/packet/test_tcp.py 
b/ryu/tests/unit/packet/test_tcp.py
index 900d420..3cc5777 100644
--- a/ryu/tests/unit/packet/test_tcp.py
+++ b/ryu/tests/unit/packet/test_tcp.py
@@ -145,8 +145,8 @@ class Test_tcp(unittest.TestCase):
         buf = t.serialize(bytearray(), prev)
         res = struct.unpack(tcp._PACK_STR, buf)
 
-        eq_(res[0], 0)
-        eq_(res[1], 0)
+        eq_(res[0], 1)
+        eq_(res[1], 1)
         eq_(res[2], 0)
         eq_(res[3], 0)
         eq_(res[4], 5 << 4)
@@ -159,8 +159,8 @@ class Test_tcp(unittest.TestCase):
         buf = t.serialize(bytearray(), prev)
         res = struct.unpack(tcp._PACK_STR + '4s', buf)
 
-        eq_(res[0], 0)
-        eq_(res[1], 0)
+        eq_(res[0], 1)
+        eq_(res[1], 1)
         eq_(res[2], 0)
         eq_(res[3], 0)
         eq_(res[4], 6 << 4)
@@ -174,8 +174,8 @@ class Test_tcp(unittest.TestCase):
         buf = t.serialize(bytearray(), prev)
         res = struct.unpack(tcp._PACK_STR + '8s', buf)
 
-        eq_(res[0], 0)
-        eq_(res[1], 0)
+        eq_(res[0], 1)
+        eq_(res[1], 1)
         eq_(res[2], 0)
         eq_(res[3], 0)
         eq_(res[4], 7 << 4)
-- 
1.9.1


------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to