From f961026fc0dd4645e5bcf1e819b8de99a7c3f95a Mon Sep 17 00:00:00 2001 From: Gurucharan Shetty Date: Wed, 15 Jun 2016 06:26:54 -0700 Subject: [PATCH] ovn-northd: Ability to loop-back in a router. Signed-off-by: Gurucharan Shetty --- ovn/northd/ovn-northd.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c index dd3e1e22475..2d2bd5a2ae5 100644 --- a/ovn/northd/ovn-northd.c +++ b/ovn/northd/ovn-northd.c @@ -2278,6 +2278,16 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, ovn_lflow_add(lflows, op->od, S_ROUTER_IN_IP_INPUT, 60, match, "drop;"); free(match); + + /* When destination IP address is in the same subnet as the + * router port, the packet may need to be eventually sent + * back the same port. For cases like that, allow sending + * out the inport. */ + match = xasprintf("ip4.dst == "IP_FMT"/"IP_FMT, + IP_ARGS(op->network), IP_ARGS(op->mask)); + ovn_lflow_add(lflows, op->od, S_ROUTER_IN_IP_INPUT, 20, + match, "inport = \"\"; next;"); + free(match); } /* NAT in Gateway routers. */