diff --git a/P4D2_2017/exercises/arp/README.md b/P4D2_2017/exercises/arp/README.md index 1a71dac..1160e3d 100644 --- a/P4D2_2017/exercises/arp/README.md +++ b/P4D2_2017/exercises/arp/README.md @@ -117,11 +117,11 @@ well as a hard-coded MAC address for the switch. 1. An action for `drop`. - 1. An action (named `ipv4_forward`) to store information in the metadata + 1. An action (named `set_dst_info`) to store information in the metadata structure, rather than immediately writing to the packet header. 1. A table (named `ipv4_lpm`) that will match on the destination IP address - and invoke the `ipv4_forward` action. + and invoke the `set_dst_info` action. 1. An action to send an ICMP reply. diff --git a/P4D2_2017/exercises/arp/arp.p4 b/P4D2_2017/exercises/arp/arp.p4 index 5c80530..0193407 100644 --- a/P4D2_2017/exercises/arp/arp.p4 +++ b/P4D2_2017/exercises/arp/arp.p4 @@ -173,10 +173,21 @@ control MyIngress( /* TODO: Define actions and tables here */ + + action set_dst_info(mac_addr_t mac_da, + mac_addr_t mac_sa, + port_id_t egress_port) + { + /* + * TODO: add logic to store mac addresses and + * egress ports in meta data + */ + } + table ipv4_lpm { key = { meta.dst_ipv4 : lpm; } - actions = { /* TODO: add actions */ drop; } + actions = { set_dst_info; drop; } default_action = drop(); }