Skip to content

Commit

Permalink
fix: Fix IPSec SA add/del in VPP 20.05 (#1664)
Browse files Browse the repository at this point in the history
  • Loading branch information
rastislavs authored Jun 4, 2020
1 parent ff63269 commit cde8f29
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
8 changes: 5 additions & 3 deletions plugins/vpp/ipsecplugin/vppcalls/vpp2005/ipsec_vppcalls.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,11 @@ func (h *IPSecVppHandler) sadAddDelEntry(sa *ipsec.SecurityAssociation, isAdd bo
Data: integKey,
Length: uint8(len(integKey)),
},
TunnelSrc: tunnelSrc,
TunnelDst: tunnelDst,
Flags: flags,
TunnelSrc: tunnelSrc,
TunnelDst: tunnelDst,
Flags: flags,
UDPSrcPort: ^uint16(0),
UDPDstPort: ^uint16(0),
},
}
reply := &vpp_ipsec.IpsecSadEntryAddDelReply{}
Expand Down
22 changes: 15 additions & 7 deletions plugins/vpp/ipsecplugin/vppcalls/vpp2005/ipsec_vppcalls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@ func TestVppAddSA(t *testing.T) {
Length: uint8(len(cryptoKey)),
Data: cryptoKey,
},
Flags: ipsec_types.IPSEC_API_SAD_FLAG_USE_ESN | ipsec_types.IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY,
Flags: ipsec_types.IPSEC_API_SAD_FLAG_USE_ESN | ipsec_types.IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY,
UDPSrcPort: ^uint16(0),
UDPDstPort: ^uint16(0),
},
}))
}
Expand Down Expand Up @@ -246,8 +248,10 @@ func TestVppDelSA(t *testing.T) {
Length: uint8(len(cryptoKey)),
Data: cryptoKey,
},
Flags: ipsec_types.IPSEC_API_SAD_FLAG_USE_ESN | ipsec_types.IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY,
Protocol: ipsec_types.IPSEC_API_PROTO_ESP,
Flags: ipsec_types.IPSEC_API_SAD_FLAG_USE_ESN | ipsec_types.IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY,
Protocol: ipsec_types.IPSEC_API_PROTO_ESP,
UDPSrcPort: ^uint16(0),
UDPDstPort: ^uint16(0),
},
}))
}
Expand Down Expand Up @@ -291,8 +295,10 @@ func TestVppAddSATunnelMode(t *testing.T) {
Af: ip_types.ADDRESS_IP4,
Un: ipsec_types.AddressUnion{XXX_UnionData: [16]byte{20, 1, 0, 1}},
},
Flags: ipsec_types.IPSEC_API_SAD_FLAG_IS_TUNNEL,
Protocol: ipsec_types.IPSEC_API_PROTO_ESP,
Flags: ipsec_types.IPSEC_API_SAD_FLAG_IS_TUNNEL,
Protocol: ipsec_types.IPSEC_API_PROTO_ESP,
UDPSrcPort: ^uint16(0),
UDPDstPort: ^uint16(0),
},
}))
}
Expand Down Expand Up @@ -336,8 +342,10 @@ func TestVppAddSATunnelModeIPv6(t *testing.T) {
Af: ip_types.ADDRESS_IP6,
Un: ipsec_types.AddressUnion{XXX_UnionData: [16]byte{171, 205}},
},
Flags: ipsec_types.IPSEC_API_SAD_FLAG_IS_TUNNEL | ipsec_types.IPSEC_API_SAD_FLAG_IS_TUNNEL_V6,
Protocol: ipsec_types.IPSEC_API_PROTO_ESP,
Flags: ipsec_types.IPSEC_API_SAD_FLAG_IS_TUNNEL | ipsec_types.IPSEC_API_SAD_FLAG_IS_TUNNEL_V6,
Protocol: ipsec_types.IPSEC_API_PROTO_ESP,
UDPSrcPort: ^uint16(0),
UDPDstPort: ^uint16(0),
},
}))
}
Expand Down

0 comments on commit cde8f29

Please sign in to comment.