I just realized that I forgot to limit line length for the commit message as Ethan suggested. I did that in my local repo.
On Mon, Dec 19, 2011 at 4:01 PM, Ansis Atteka <[email protected]> wrote: > In current implementation vswitchd adds Controller in-band rules only if > there is a route in > kernel routing table that might route traffic to the Controller. But, when > executing > force-reload-kmod command, network configuration (e.g. assigned IP > addresses, routes) are flushed > away, hence Controller in-band rules are not added. > > This commit fixes this limitation and allows vswitchd to add Controller > in-band rules > even if there are no routes in the kernel routing table. > > Issue: #8625 > > Signed-off-by: Ansis Atteka <[email protected]> > --- > lib/stream.c | 22 +++++++++++++++++++++- > lib/stream.h | 7 ++++++- > ofproto/connmgr.c | 8 +++++--- > vswitchd/bridge.c | 8 ++++---- > 4 files changed, 36 insertions(+), 9 deletions(-) > > diff --git a/lib/stream.c b/lib/stream.c > index 9ba4c51..4c3583c 100644 > --- a/lib/stream.c > +++ b/lib/stream.c > @@ -724,7 +724,27 @@ pstream_open_with_default_ports(const char *name_, > > return error; > } > - > + > +/* > + * This function extracts IP address and port from the target string. > + * > + * - On success, function returns true and fills *sin structure with > port > + * and IP address. If port was absent in target string then it will > use > + * corresponding default port value. > + * - On error, function returns false and *sin contains garbage. > + */ > +bool > +stream_parse_target_with_default_ports(const char *target, > + uint16_t default_tcp_port, > + uint16_t default_ssl_port, > + struct sockaddr_in *sin) > +{ > + return (!strncmp(target, "tcp:", 4) > + && inet_parse_active(target + 4, default_tcp_port, sin)) || > + (!strncmp(target, "ssl:", 4) > + && inet_parse_active(target + 4, default_ssl_port, sin)); > +} > + > /* Attempts to guess the content type of a stream whose first few bytes > were > * the 'size' bytes of 'data'. */ > static enum stream_content_type > diff --git a/lib/stream.h b/lib/stream.h > index 51a7656..5c111f9 100644 > --- a/lib/stream.h > +++ b/lib/stream.h > @@ -23,6 +23,7 @@ > #include <sys/types.h> > #include "openvswitch/types.h" > #include "vlog.h" > +#include "socket-util.h" > > struct pstream; > struct stream; > @@ -75,7 +76,11 @@ int pstream_open_with_default_ports(const char *name, > uint16_t default_ptcp_port, > uint16_t default_pssl_port, > struct pstream **); > - > +bool stream_parse_target_with_default_ports(const char *target, > + uint16_t default_tcp_port, > + uint16_t default_ssl_port, > + struct sockaddr_in *sin); > + > /* Error reporting. */ > > enum stream_content_type { > diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c > index 6432ba6..1c55b67 100644 > --- a/ofproto/connmgr.c > +++ b/ofproto/connmgr.c > @@ -587,14 +587,16 @@ update_in_band_remotes(struct connmgr *mgr) > /* Add all the remotes. */ > HMAP_FOR_EACH (ofconn, hmap_node, &mgr->controllers) { > struct sockaddr_in *sin = &addrs[n_addrs]; > + const char *target = rconn_get_target(ofconn->rconn); > > if (ofconn->band == OFPROTO_OUT_OF_BAND) { > continue; > } > > - sin->sin_addr.s_addr = rconn_get_remote_ip(ofconn->rconn); > - if (sin->sin_addr.s_addr) { > - sin->sin_port = rconn_get_remote_port(ofconn->rconn); > + if (stream_parse_target_with_default_ports(target, > + OFP_TCP_PORT, > + OFP_SSL_PORT, > + sin)) { > n_addrs++; > } > } > diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c > index f79b69c..99ba9ff 100644 > --- a/vswitchd/bridge.c > +++ b/vswitchd/bridge.c > @@ -372,10 +372,10 @@ collect_in_band_managers(const struct > ovsrec_open_vswitch *ovs_cfg, > SSET_FOR_EACH (target, &targets) { > struct sockaddr_in *sin = &managers[n_managers]; > > - if ((!strncmp(target, "tcp:", 4) > - && inet_parse_active(target + 4, JSONRPC_TCP_PORT, sin)) > || > - (!strncmp(target, "ssl:", 4) > - && inet_parse_active(target + 4, JSONRPC_SSL_PORT, > sin))) { > + if (stream_parse_target_with_default_ports(target, > + JSONRPC_TCP_PORT, > + JSONRPC_SSL_PORT, > + sin)) { > n_managers++; > } > } > -- > 1.7.4.1 > >
_______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
