mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-30 17:22:33 +00:00
netmon: Fix bug in how routes are converted
The agent expects a IP CIDR for the route destination rather than an IP address. netmon was incorrectly converting route dest to an IP address and hence exiting with an error. We did not have an integration test for netmon with tcfilter mode. macvtap mode did not uncover this, as with macvtap routes are not really passed to the agent. We delete the IP on the veth device, and netmon looks at the routes after the IP is deleted with macvtap. Fixes #1523 Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
This commit is contained in:
parent
da08b3afc9
commit
8abd2ec53f
@ -309,7 +309,7 @@ func convertRoutes(netRoutes []netlink.Route) []vcTypes.Route {
|
|||||||
dst := ""
|
dst := ""
|
||||||
if netRoute.Dst != nil {
|
if netRoute.Dst != nil {
|
||||||
if netRoute.Dst.IP.To4() != nil {
|
if netRoute.Dst.IP.To4() != nil {
|
||||||
dst = netRoute.Dst.IP.String()
|
dst = netRoute.Dst.String()
|
||||||
} else {
|
} else {
|
||||||
netmonLog.WithField("destination", netRoute.Dst.IP.String()).Warn("Not IPv4 format")
|
netmonLog.WithField("destination", netRoute.Dst.IP.String()).Warn("Not IPv4 format")
|
||||||
}
|
}
|
||||||
|
@ -213,7 +213,7 @@ func TestConvertRoutes(t *testing.T) {
|
|||||||
|
|
||||||
expected := []vcTypes.Route{
|
expected := []vcTypes.Route{
|
||||||
{
|
{
|
||||||
Dest: testIPAddress,
|
Dest: testIPAddressWithMask,
|
||||||
Gateway: testIPAddress,
|
Gateway: testIPAddress,
|
||||||
Source: testIPAddress,
|
Source: testIPAddress,
|
||||||
Scope: uint32(testScope),
|
Scope: uint32(testScope),
|
||||||
|
Loading…
Reference in New Issue
Block a user