Acked-by: Ethan Jackson <et...@nicira.com>
On Tue, Dec 17, 2013 at 4:53 PM, Ben Pfaff <b...@nicira.com> wrote: > These functions don't have any ultimate users. The in-band control code > used to use them, but not anymore, so we might as well delete them all. > > Signed-off-by: Ben Pfaff <b...@nicira.com> > --- > lib/rconn.c | 57 > ------------------------------------------------- > lib/rconn.h | 4 ---- > lib/stream-provider.h | 8 ------- > lib/stream-ssl.c | 14 ++++-------- > lib/stream-tcp.c | 19 +++++------------ > lib/stream.c | 56 ------------------------------------------------ > lib/vconn-provider.h | 9 -------- > lib/vconn-stream.c | 4 ---- > lib/vconn.c | 57 > ------------------------------------------------- > lib/vconn.h | 5 ----- > 10 files changed, 9 insertions(+), 224 deletions(-) > > diff --git a/lib/rconn.c b/lib/rconn.c > index 599347e..d339365 100644 > --- a/lib/rconn.c > +++ b/lib/rconn.c > @@ -115,17 +115,6 @@ struct rconn { > int probe_interval; /* Secs of inactivity before sending probe. > */ > time_t last_activity; /* Last time we saw some activity. */ > > - /* When we create a vconn we obtain these values, to save them past the > end > - * of the vconn's lifetime. Otherwise, in-band control will only allow > - * traffic when a vconn is actually open, but it is nice to allow ARP to > - * complete even between connection attempts, and it is also polite to > - * allow traffic from other switches to go through to the controller > - * whether or not we are connected. > - * > - * We don't cache the local port, because that changes from one > connection > - * attempt to the next. */ > - ovs_be32 local_ip, remote_ip; > - ovs_be16 remote_port; > uint8_t dscp; > > /* Messages sent or received are copied to the monitor connections. */ > @@ -456,9 +445,6 @@ reconnect(struct rconn *rc) > retval = vconn_open(rc->target, rc->allowed_versions, rc->dscp, > &rc->vconn); > if (!retval) { > - rc->remote_ip = vconn_get_remote_ip(rc->vconn); > - rc->local_ip = vconn_get_local_ip(rc->vconn); > - rc->remote_port = vconn_get_remote_port(rc->vconn); > rc->backoff_deadline = time_now() + rc->backoff; > state_transition(rc, S_CONNECTING); > } else { > @@ -911,46 +897,6 @@ rconn_failure_duration(const struct rconn *rconn) > return duration; > } > > -/* Returns the IP address of the peer, or 0 if the peer's IP address is not > - * known. */ > -ovs_be32 > -rconn_get_remote_ip(const struct rconn *rconn) > -{ > - return rconn->remote_ip; > -} > - > -/* Returns the transport port of the peer, or 0 if the peer's port is not > - * known. */ > -ovs_be16 > -rconn_get_remote_port(const struct rconn *rconn) > -{ > - return rconn->remote_port; > -} > - > -/* Returns the IP address used to connect to the peer, or 0 if the > - * connection is not an IP-based protocol or if its IP address is not > - * known. */ > -ovs_be32 > -rconn_get_local_ip(const struct rconn *rconn) > -{ > - return rconn->local_ip; > -} > - > -/* Returns the transport port used to connect to the peer, or 0 if the > - * connection does not contain a port or if the port is not known. */ > -ovs_be16 > -rconn_get_local_port(const struct rconn *rconn) > - OVS_EXCLUDED(rconn->mutex) > -{ > - ovs_be16 port; > - > - ovs_mutex_lock(&rconn->mutex); > - port = rconn->vconn ? vconn_get_local_port(rconn->vconn) : 0; > - ovs_mutex_unlock(&rconn->mutex); > - > - return port; > -} > - > static int > rconn_get_version__(const struct rconn *rconn) > OVS_REQUIRES(rconn->mutex) > @@ -1139,9 +1085,6 @@ rconn_set_target__(struct rconn *rc, const char > *target, const char *name) > rc->name = xstrdup(name ? name : target); > free(rc->target); > rc->target = xstrdup(target); > - rc->local_ip = 0; > - rc->remote_ip = 0; > - rc->remote_port = 0; > } > > /* Tries to send a packet from 'rc''s send buffer. Returns 0 if successful, > diff --git a/lib/rconn.h b/lib/rconn.h > index 408cec9..2cb43f7 100644 > --- a/lib/rconn.h > +++ b/lib/rconn.h > @@ -83,10 +83,6 @@ bool rconn_is_connected(const struct rconn *); > bool rconn_is_admitted(const struct rconn *); > int rconn_failure_duration(const struct rconn *); > > -ovs_be32 rconn_get_remote_ip(const struct rconn *); > -ovs_be16 rconn_get_remote_port(const struct rconn *); > -ovs_be32 rconn_get_local_ip(const struct rconn *); > -ovs_be16 rconn_get_local_port(const struct rconn *); > int rconn_get_version(const struct rconn *); > > const char *rconn_get_state(const struct rconn *); > diff --git a/lib/stream-provider.h b/lib/stream-provider.h > index 43c63e8..44d75d3 100644 > --- a/lib/stream-provider.h > +++ b/lib/stream-provider.h > @@ -29,19 +29,11 @@ struct stream { > const struct stream_class *class; > int state; > int error; > - ovs_be32 remote_ip; > - ovs_be16 remote_port; > - ovs_be32 local_ip; > - ovs_be16 local_port; > char *name; > }; > > void stream_init(struct stream *, const struct stream_class *, > int connect_status, const char *name); > -void stream_set_remote_ip(struct stream *, ovs_be32 remote_ip); > -void stream_set_remote_port(struct stream *, ovs_be16 remote_port); > -void stream_set_local_ip(struct stream *, ovs_be32 local_ip); > -void stream_set_local_port(struct stream *, ovs_be16 local_port); > static inline void stream_assert_class(const struct stream *stream, > const struct stream_class *class) > { > diff --git a/lib/stream-ssl.c b/lib/stream-ssl.c > index 5ef70f8..2ed5282 100644 > --- a/lib/stream-ssl.c > +++ b/lib/stream-ssl.c > @@ -204,8 +204,7 @@ want_to_poll_events(int want) > > static int > new_ssl_stream(const char *name, int fd, enum session_type type, > - enum ssl_state state, const struct sockaddr_in *remote, > - struct stream **streamp) > + enum ssl_state state, struct stream **streamp) > { > struct sockaddr_in local; > socklen_t local_len = sizeof local; > @@ -270,10 +269,6 @@ new_ssl_stream(const char *name, int fd, enum > session_type type, > /* Create and return the ssl_stream. */ > sslv = xmalloc(sizeof *sslv); > stream_init(&sslv->stream, &ssl_stream_class, EAGAIN, name); > - stream_set_remote_ip(&sslv->stream, remote->sin_addr.s_addr); > - stream_set_remote_port(&sslv->stream, remote->sin_port); > - stream_set_local_ip(&sslv->stream, local.sin_addr.s_addr); > - stream_set_local_port(&sslv->stream, local.sin_port); > sslv->state = state; > sslv->type = type; > sslv->fd = fd; > @@ -309,7 +304,6 @@ ssl_stream_cast(struct stream *stream) > static int > ssl_open(const char *name, char *suffix, struct stream **streamp, uint8_t > dscp) > { > - struct sockaddr_in sin; > int error, fd; > > error = ssl_init(); > @@ -317,11 +311,11 @@ ssl_open(const char *name, char *suffix, struct stream > **streamp, uint8_t dscp) > return error; > } > > - error = inet_open_active(SOCK_STREAM, suffix, OFP_OLD_PORT, &sin, &fd, > + error = inet_open_active(SOCK_STREAM, suffix, OFP_OLD_PORT, NULL, &fd, > dscp); > if (fd >= 0) { > int state = error ? STATE_TCP_CONNECTING : STATE_SSL_CONNECTING; > - return new_ssl_stream(name, fd, CLIENT, state, &sin, streamp); > + return new_ssl_stream(name, fd, CLIENT, state, streamp); > } else { > VLOG_ERR("%s: connect: %s", name, ovs_strerror(error)); > return error; > @@ -849,7 +843,7 @@ pssl_accept(struct pstream *pstream, struct stream > **new_streamp) > if (sin.sin_port != htons(OFP_OLD_PORT)) { > sprintf(strchr(name, '\0'), ":%"PRIu16, ntohs(sin.sin_port)); > } > - return new_ssl_stream(name, new_fd, SERVER, STATE_SSL_CONNECTING, &sin, > + return new_ssl_stream(name, new_fd, SERVER, STATE_SSL_CONNECTING, > new_streamp); > } > > diff --git a/lib/stream-tcp.c b/lib/stream-tcp.c > index a4cdf45..b3237d6 100644 > --- a/lib/stream-tcp.c > +++ b/lib/stream-tcp.c > @@ -38,7 +38,7 @@ VLOG_DEFINE_THIS_MODULE(stream_tcp); > > static int > new_tcp_stream(const char *name, int fd, int connect_status, > - const struct sockaddr_in *remote, struct stream **streamp) > + struct stream **streamp) > { > struct sockaddr_in local; > socklen_t local_len = sizeof local; > @@ -58,26 +58,17 @@ new_tcp_stream(const char *name, int fd, int > connect_status, > return errno; > } > > - retval = new_fd_stream(name, fd, connect_status, streamp); > - if (!retval) { > - struct stream *stream = *streamp; > - stream_set_remote_ip(stream, remote->sin_addr.s_addr); > - stream_set_remote_port(stream, remote->sin_port); > - stream_set_local_ip(stream, local.sin_addr.s_addr); > - stream_set_local_port(stream, local.sin_port); > - } > - return retval; > + return new_fd_stream(name, fd, connect_status, streamp); > } > > static int > tcp_open(const char *name, char *suffix, struct stream **streamp, uint8_t > dscp) > { > - struct sockaddr_in sin; > int fd, error; > > - error = inet_open_active(SOCK_STREAM, suffix, 0, &sin, &fd, dscp); > + error = inet_open_active(SOCK_STREAM, suffix, 0, NULL, &fd, dscp); > if (fd >= 0) { > - return new_tcp_stream(name, fd, error, &sin, streamp); > + return new_tcp_stream(name, fd, error, streamp); > } else { > VLOG_ERR("%s: connect: %s", name, ovs_strerror(error)); > return error; > @@ -140,7 +131,7 @@ ptcp_accept(int fd, const struct sockaddr *sa, size_t > sa_len, > } else { > strcpy(name, "tcp"); > } > - return new_tcp_stream(name, fd, 0, sin, streamp); > + return new_tcp_stream(name, fd, 0, streamp); > } > > const struct pstream_class ptcp_pstream_class = { > diff --git a/lib/stream.c b/lib/stream.c > index e47b00b..3542455 100644 > --- a/lib/stream.c > +++ b/lib/stream.c > @@ -281,38 +281,6 @@ stream_get_name(const struct stream *stream) > return stream ? stream->name : "(null)"; > } > > -/* Returns the IP address of the peer, or 0 if the peer is not connected over > - * an IP-based protocol or if its IP address is not yet known. */ > -ovs_be32 > -stream_get_remote_ip(const struct stream *stream) > -{ > - return stream->remote_ip; > -} > - > -/* Returns the transport port of the peer, or 0 if the connection does not > - * contain a port or if the port is not yet known. */ > -ovs_be16 > -stream_get_remote_port(const struct stream *stream) > -{ > - return stream->remote_port; > -} > - > -/* Returns the IP address used to connect to the peer, or 0 if the connection > - * is not an IP-based protocol or if its IP address is not yet known. */ > -ovs_be32 > -stream_get_local_ip(const struct stream *stream) > -{ > - return stream->local_ip; > -} > - > -/* Returns the transport port used to connect to the peer, or 0 if the > - * connection does not contain a port or if the port is not yet known. */ > -ovs_be16 > -stream_get_local_port(const struct stream *stream) > -{ > - return stream->local_port; > -} > - > static void > scs_connecting(struct stream *stream) > { > @@ -663,30 +631,6 @@ stream_init(struct stream *stream, const struct > stream_class *class, > } > > void > -stream_set_remote_ip(struct stream *stream, ovs_be32 ip) > -{ > - stream->remote_ip = ip; > -} > - > -void > -stream_set_remote_port(struct stream *stream, ovs_be16 port) > -{ > - stream->remote_port = port; > -} > - > -void > -stream_set_local_ip(struct stream *stream, ovs_be32 ip) > -{ > - stream->local_ip = ip; > -} > - > -void > -stream_set_local_port(struct stream *stream, ovs_be16 port) > -{ > - stream->local_port = port; > -} > - > -void > pstream_init(struct pstream *pstream, const struct pstream_class *class, > const char *name) > { > diff --git a/lib/vconn-provider.h b/lib/vconn-provider.h > index 640c5b6..b05bb45 100644 > --- a/lib/vconn-provider.h > +++ b/lib/vconn-provider.h > @@ -40,21 +40,12 @@ struct vconn { > enum ofp_version version; /* Negotiated version (or 0). */ > bool recv_any_version; /* True to receive a message of any version. > */ > > - ovs_be32 remote_ip; > - ovs_be16 remote_port; > - ovs_be32 local_ip; > - ovs_be16 local_port; > - > char *name; > }; > > void vconn_init(struct vconn *, const struct vconn_class *, int > connect_status, > const char *name, uint32_t allowed_versions); > void vconn_free_data(struct vconn *vconn); > -void vconn_set_remote_ip(struct vconn *, ovs_be32 remote_ip); > -void vconn_set_remote_port(struct vconn *, ovs_be16 remote_port); > -void vconn_set_local_ip(struct vconn *, ovs_be32 local_ip); > -void vconn_set_local_port(struct vconn *, ovs_be16 local_port); > static inline void vconn_assert_class(const struct vconn *vconn, > const struct vconn_class *class) > { > diff --git a/lib/vconn-stream.c b/lib/vconn-stream.c > index 9363712..d169840 100644 > --- a/lib/vconn-stream.c > +++ b/lib/vconn-stream.c > @@ -64,10 +64,6 @@ vconn_stream_new(struct stream *stream, int connect_status, > s->txbuf = NULL; > s->rxbuf = NULL; > s->n_packets = 0; > - s->vconn.remote_ip = stream_get_remote_ip(stream); > - s->vconn.remote_port = stream_get_remote_port(stream); > - s->vconn.local_ip = stream_get_local_ip(stream); > - s->vconn.local_port = stream_get_local_port(stream); > return &s->vconn; > } > > diff --git a/lib/vconn.c b/lib/vconn.c > index 0dc8561..f0549d5 100644 > --- a/lib/vconn.c > +++ b/lib/vconn.c > @@ -350,39 +350,6 @@ vconn_set_allowed_versions(struct vconn *vconn, uint32_t > allowed_versions) > vconn->allowed_versions = allowed_versions; > } > > -/* Returns the IP address of the peer, or 0 if the peer is not connected over > - * an IP-based protocol or if its IP address is not yet known. */ > -ovs_be32 > -vconn_get_remote_ip(const struct vconn *vconn) > -{ > - return vconn->remote_ip; > -} > - > -/* Returns the transport port of the peer, or 0 if the connection does not > - * contain a port or if the port is not yet known. */ > -ovs_be16 > -vconn_get_remote_port(const struct vconn *vconn) > -{ > - return vconn->remote_port; > -} > - > -/* Returns the IP address used to connect to the peer, or 0 if the > - * connection is not an IP-based protocol or if its IP address is not > - * yet known. */ > -ovs_be32 > -vconn_get_local_ip(const struct vconn *vconn) > -{ > - return vconn->local_ip; > -} > - > -/* Returns the transport port used to connect to the peer, or 0 if the > - * connection does not contain a port or if the port is not yet known. */ > -ovs_be16 > -vconn_get_local_port(const struct vconn *vconn) > -{ > - return vconn->local_port; > -} > - > /* Returns the OpenFlow version negotiated with the peer, or -1 if version > * negotiation is not yet complete. > * > @@ -1138,30 +1105,6 @@ vconn_init(struct vconn *vconn, const struct > vconn_class *class, > } > > void > -vconn_set_remote_ip(struct vconn *vconn, ovs_be32 ip) > -{ > - vconn->remote_ip = ip; > -} > - > -void > -vconn_set_remote_port(struct vconn *vconn, ovs_be16 port) > -{ > - vconn->remote_port = port; > -} > - > -void > -vconn_set_local_ip(struct vconn *vconn, ovs_be32 ip) > -{ > - vconn->local_ip = ip; > -} > - > -void > -vconn_set_local_port(struct vconn *vconn, ovs_be16 port) > -{ > - vconn->local_port = port; > -} > - > -void > pvconn_init(struct pvconn *pvconn, const struct pvconn_class *class, > const char *name, uint32_t allowed_versions) > { > diff --git a/lib/vconn.h b/lib/vconn.h > index b15388c..8678581 100644 > --- a/lib/vconn.h > +++ b/lib/vconn.h > @@ -45,11 +45,6 @@ void vconn_set_allowed_versions(struct vconn *vconn, > int vconn_get_version(const struct vconn *); > void vconn_set_recv_any_version(struct vconn *); > > -ovs_be32 vconn_get_remote_ip(const struct vconn *); > -ovs_be16 vconn_get_remote_port(const struct vconn *); > -ovs_be32 vconn_get_local_ip(const struct vconn *); > -ovs_be16 vconn_get_local_port(const struct vconn *); > - > int vconn_connect(struct vconn *); > int vconn_recv(struct vconn *, struct ofpbuf **); > int vconn_send(struct vconn *, struct ofpbuf *); > -- > 1.7.10.4 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev