Send a canonical IPv4 prefix in table 60 routing rules
authorEric Multanen <eric.w.multanen@intel.com>
Fri, 2 Oct 2015 13:43:04 +0000 (06:43 -0700)
committerSam Hague <shague@redhat.com>
Tue, 6 Oct 2015 18:45:44 +0000 (18:45 +0000)
Testing with userspace OVS with DPDK uncovered that the routing
rules that go into table 60 were getting rejected.

Messages from ovs-vswitchd.log:

... |nx_match|WARN|Rejecting NXM/OXM entry
    0:32768:12:1:8 with 1-bits in value for bits wildcarded by the mask.

... |connmgr|INFO|br-int<->tcp:10.11.21.7:6653:
    sending OFPBMC_BAD_WILDCARDS error reply to OFPT_FLOW_MOD message

Clearing the non-prefix bits resolved the problem and the flows were
successfully added.

v2 - split up long line into two more readable lines

Change-Id: I42a0c63e6e837197d29bb8333f12e822a5f15d91
Signed-off-by: Eric Multanen <eric.w.multanen@intel.com>
openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/RoutingService.java

index 38fc4702b73ce823047fd82d7b3131761fda313b..a8acadd9ede22d87a244fa8502d9caa4a1c8b9b0 100644 (file)
@@ -13,6 +13,7 @@ import java.net.Inet6Address;
 import java.net.InetAddress;
 import java.util.List;
 
+import org.apache.commons.net.util.SubnetUtils;
 import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
 import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
 import org.opendaylight.ovsdb.openstack.netvirt.api.RoutingProvider;
@@ -90,7 +91,8 @@ public class RoutingService extends AbstractServiceInstance implements RoutingPr
                       address);
             return new Status(StatusCode.NOTIMPLEMENTED);
         }
-        final String prefixString = address.getHostAddress() + "/" + mask;
+        SubnetUtils addressSubnetInfo = new SubnetUtils(address.getHostAddress() + "/" + mask);
+        final String prefixString = addressSubnetInfo.getInfo().getNetworkAddress() + "/" + mask;
         MatchUtils.createDstL3IPv4Match(matchBuilder, new Ipv4Prefix(prefixString));
 
         // Set source Mac address