@@ -86,6 +86,11 @@ func testLinkAddDel(t *testing.T, link Link) {
8686 if resultPrimary .SupportsScrub () && resultPrimary .PeerScrub != inputPrimary .PeerScrub {
8787 t .Fatalf ("Peer Scrub is %d, should be %d" , int (resultPrimary .PeerScrub ), int (inputPrimary .PeerScrub ))
8888 }
89+ if inputPrimary .Mode == NETKIT_MODE_L2 && inputPrimary .HardwareAddr != nil {
90+ if inputPrimary .HardwareAddr .String () != resultPrimary .HardwareAddr .String () {
91+ t .Fatalf ("Hardware address is %s, should be %s" , resultPrimary .HardwareAddr .String (), inputPrimary .HardwareAddr .String ())
92+ }
93+ }
8994
9095 if inputPrimary .peerLinkAttrs .Name != "" {
9196 var resultPeer * Netkit
@@ -117,6 +122,11 @@ func testLinkAddDel(t *testing.T, link Link) {
117122 if resultPrimary .Scrub != resultPeer .PeerScrub {
118123 t .Fatalf ("PeerScrub from peer is %d, should be %d" , int (resultPeer .PeerScrub ), int (resultPrimary .Scrub ))
119124 }
125+ if inputPrimary .Mode == NETKIT_MODE_L2 && inputPrimary .peerLinkAttrs .HardwareAddr != nil {
126+ if inputPrimary .peerLinkAttrs .HardwareAddr .String () != resultPeer .HardwareAddr .String () {
127+ t .Fatalf ("Peer hardware address is %s, should be %s" , resultPeer .HardwareAddr .String (), inputPrimary .peerLinkAttrs .HardwareAddr .String ())
128+ }
129+ }
120130 }
121131 }
122132
@@ -1061,7 +1071,8 @@ func TestLinkAddDelNetkit(t *testing.T) {
10611071
10621072 netkit := & Netkit {
10631073 LinkAttrs : LinkAttrs {
1064- Name : "foo" ,
1074+ Name : "foo" ,
1075+ HardwareAddr : net.HardwareAddr {0x00 , 0x11 , 0x22 , 0x33 , 0x44 , 0x55 },
10651076 },
10661077 Mode : NETKIT_MODE_L2 ,
10671078 Policy : NETKIT_POLICY_FORWARD ,
@@ -1070,7 +1081,8 @@ func TestLinkAddDelNetkit(t *testing.T) {
10701081 PeerScrub : NETKIT_SCRUB_NONE ,
10711082 }
10721083 peerAttr := & LinkAttrs {
1073- Name : "bar" ,
1084+ Name : "bar" ,
1085+ HardwareAddr : net.HardwareAddr {0x66 , 0x77 , 0x88 , 0x99 , 0xAA , 0xBB },
10741086 }
10751087 netkit .SetPeerAttrs (peerAttr )
10761088 testLinkAddDel (t , netkit )
0 commit comments