I am trying to implement a basic Mininet scenario for testing purposes, where I’d like demonstrate how a switch would encapsulate macsec frames for a legacy device that is incapable doing so on their own. I originated my project using p4lang’s ‘basic’ excercise
For now, I don’t want to use an RPC controller for Macsec, and would like to take advantage of iproute2’s macsec implementation on switch s1.
Here is a drawing of the network setup that i’m trying to achieve: Imgur
My issue is, that the packets coming from h1 don’t reach the macsec1 interface.
macsec1 is set up by a script that i currently run manually once Mininet is up and running, using xterm s1
then ./scripts/s1_macsec.sh
.
This is my ./scripts/s1_macsec.sh
file:
#!/bin/sh
ip link add link s1-eth2 macsec1 type macsec validate strict
ip macsec add macsec1 tx sa 0 pn 1 on key 01 12345678901234567890123456789012
ip link set dev macsec1 up
ifconfig macsec1 10.0.1.3
Trying the set the switch up with setting the egress port in runtime.json to port#2 is successful, and forwards the incoming frame to s1-eth2.
Below is the corresponding part of my s1-topology.json file:
{
"table": "MyIngress.mac_exact",
"match": {
"hdr.ethernet.dstAddr": "01:0c:cd:04:00:01"
},
"action_name": "MyIngress.mac_forward",
"action_params": {
"dstAddr": "01:0c:cd:04:00:01",
"port": 2
}
The p4 program running on thsi switch is simply forwarding ethernet frames based on their dstAddr.
I can’t seem find the port number associated with the macsec port of the mininet host which is created by the script after mininet is up and running.
I’ve tried changing the egress port number to different numbers, but none of them worked.
I confirmed that the Macsec port is working by sending forged frames from s1 mininet host through it’s macsec1 interface.
Is there any way of solving this? Does p4 have to have an interface already set up when the configuration data is recieved from the Controller in order for the interface to recieve a port number? Can ports that are later added to the switch recieve an egress port number too?
Thank you for your help in advance!