Skip to content

Commit 345626b

Browse files
jafingerhutjafinger
andauthored
Basic tunnel exercise fixes (#625)
* Support negative-valued action parameters by converting them in the Python helper code into a positive value whose bit pattern is the 2's complement representation of the negative value. * Change send.py for exercise basic_tunnel so its README is correct The README said to expect a packet with a TCP header at the receiver, but send.py was not adding a TCP header to the packet when the `--dst_id` command line option was specified. --------- Co-authored-by: jafinger <jafinger@cisco.com>
1 parent ead3871 commit 345626b

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

exercises/basic_tunnel/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ to hosts. For this step you will need to add your forwarding rules to the
112112
./send.py 10.0.2.2 "P4 is cool"
113113
```
114114
The packet should be received at `h2`. If you examine the received packet
115-
you should see that is consists of an Ethernet header, an IP header, a TCP
115+
you should see that it consists of an Ethernet header, an IP header, a TCP
116116
header, and the message. If you change the destination IP address (e.g. try
117117
to send to `10.0.3.3`) then the message should not be received by `h2`, and
118118
will instead be received by `h3`.

exercises/basic_tunnel/send.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def main():
3333
if (dst_id is not None):
3434
print("sending on interface {} to dst_id {}".format(iface, str(dst_id)))
3535
pkt = Ether(src=get_if_hwaddr(iface), dst='ff:ff:ff:ff:ff:ff')
36-
pkt = pkt / MyTunnel(dst_id=dst_id) / IP(dst=addr) / args.message
36+
pkt = pkt / MyTunnel(dst_id=dst_id) / IP(dst=addr) / TCP(dport=1234, sport=random.randint(49152,65535)) / args.message
3737
else:
3838
print("sending on interface {} to IP addr {}".format(iface, str(addr)))
3939
pkt = Ether(src=get_if_hwaddr(iface), dst='ff:ff:ff:ff:ff:ff')

0 commit comments

Comments
 (0)