> > [Resending as the previous reply got rejected by the mailing list]. > Thanks for the explanation. I intend to add the following stylistic and needed changes and apply this to master after some time. diff --git a/AUTHORS b/AUTHORS index 3f05a02..5290ef5 100644 --- a/AUTHORS +++ b/AUTHORS @@ -211,6 +211,7 @@ Steffen Gebert steffen.geb...@informatik.uni-wuerzburg.de Sten Spans s...@blinkenlights.nl Stephane A. Sezer s...@cd80.net Stephen Finucane stephen.finuc...@intel.com +Steve Ruan rua...@cn.ibm.com SUGYO Kazushi sugyo....@gmail.com Tadaaki Nagao na...@stratosphere.co.jp Terry Wilson twil...@redhat.com diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c index ad9684b..673f52d 100644 --- a/ovn/northd/ovn-northd.c +++ b/ovn/northd/ovn-northd.c @@ -1828,74 +1828,65 @@ add_route(struct hmap *lflows, const struct ovn_port *op,
static void build_static_route_flow(struct hmap *lflows, struct ovn_datapath *od, - struct hmap *ports, - const struct nbrec_logical_router_static_route *route) + struct hmap *ports, + const struct nbrec_logical_router_static_route *route) { ovs_be32 prefix, next_hop, mask; - /* Verify that next hop is an IP address with 32 bits mask */ + /* Verify that next hop is an IP address with 32 bits mask. */ char *error = ip_parse_masked(route->nexthop, &next_hop, &mask); if (error || mask != OVS_BE32_MAX) { - static struct vlog_rate_limit rl - = VLOG_RATE_LIMIT_INIT(5, 1); - VLOG_WARN_RL(&rl, "bad next hop ip address %s", - route->nexthop); + static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1); + VLOG_WARN_RL(&rl, "bad next hop ip address %s", route->nexthop); free(error); return; } - /* Verify that ip prefix is a valid CIDR address */ + /* Verify that ip prefix is a valid CIDR address. */ error = ip_parse_masked(route->ip_prefix, &prefix, &mask); if (error || !ip_is_cidr(mask)) { - static struct vlog_rate_limit rl - = VLOG_RATE_LIMIT_INIT(5, 1); + static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1); VLOG_WARN_RL(&rl, "bad 'network' in static routes %s", - route->ip_prefix); + route->ip_prefix); free(error); return; } - /* Find the outgoing port */ + /* Find the outgoing port. */ struct ovn_port *out_port = NULL; if (route->output_port) { out_port = ovn_port_find(ports, route->output_port); if (!out_port) { - static struct vlog_rate_limit rl - = VLOG_RATE_LIMIT_INIT(5, 1); + static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1); VLOG_WARN_RL(&rl, "Bad out port %s for static route %s", - route->output_port, route->ip_prefix); + route->output_port, route->ip_prefix); return; } } else { - - /* output_port is not specified, then find the - * router port match next hop */ - + /* output_port is not specified, find the + * router port matching the next hop. */ int i; for (i = 0; i < od->nbr->n_ports; i++) { - struct nbrec_logical_router_port *lrp = od->nbr->ports[i]; out_port = ovn_port_find(ports, lrp->name); if (!out_port) { - /* This should not happen */ + /* This should not happen. */ continue; } if (out_port->network && !((out_port->network ^ next_hop) & out_port->mask)) { - /* There should have ONLY 1 interface match the next hop, - * or it's a configuration error, because subnets of router's - * interfaces should NOT be overlapped */ + /* There should be only 1 interface that matches the next hop. + * Otherwise, it's a configuration error, because subnets of + * router's interfaces should NOT overlap. */ break; break; } } if (i == od->nbr->n_ports) { - - /* There is no matched out port */ - static struct vlog_rate_limit rl - = VLOG_RATE_LIMIT_INIT(5, 1); + /* There is no matched out port. */ + static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1); VLOG_WARN_RL(&rl, "No path for static route %s; next hop %s", - route->ip_prefix, route->nexthop); + route->ip_prefix, route->nexthop); return; } } @@ -2072,7 +2063,7 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, continue; } - /* convert the routing table to flow */ + /* Convert the static routes to flows. */ for (int i = 0; i < od->nbr->n_static_routes; i++) { const struct nbrec_logical_router_static_route *route; diff --git a/ovn/ovn-nb.xml b/ovn/ovn-nb.xml index f0dc65d..c01455d 100644 --- a/ovn/ovn-nb.xml +++ b/ovn/ovn-nb.xml @@ -624,7 +624,7 @@ </column> <column name="static_routes"> - One or more static routes, refer to Logical_Router_Static_Route table. + One or more static routes for the router. </column> <column name="default_gw"> @@ -729,28 +729,30 @@ </group> </table> - <table name="Logical_Router_Static_Route" title="logical router static routes"> + <table name="Logical_Router_Static_Route" title="Logical router static routes"> <p> - Each route represents a static route. + Each record represents a static route. </p> <column name="ip_prefix"> <p> - Prefix of this route, example 192.168.100.0/24. + IP prefix of this route (e.g. 192.168.100.0/24). </p> </column> - + <column name="nexthop"> <p> - Nexthop of this route, nexthop can be a IP address of logical router - port, or IP address which has been learnt by dynamic ARP. + Nexthop IP address for this route. Nexthop IP address should be the IP + address of a connected router port or the IP address of a logical port. </p> </column> - + <column name="output_port"> <p> - Port name of the logical router port table. It may be configured or may - not be configured. + The name of the <ref table="Logical_router_port"/> via which the packet + needs to be sent out. This is optional and when not specified, + OVN will automatically figure this out based on the + <ref column="nexthop"/>. </p> </column> </table> _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev