From d0867a3968e400f265f85b5d71a212762bbeda82 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 9 Mar 2009 15:39:46 -0700 Subject: [PATCH] vconn: Delete fd-based vconns. These vconns were only a crappy kluge for communication between vswitchd and its subordinate secchans. We are better off rid of them. --- lib/automake.mk | 1 - lib/rconn.c | 3 -- lib/vconn-fd.c | 77 -------------------------------------------- lib/vconn-provider.h | 1 - lib/vconn.c | 15 --------- lib/vconn.h | 1 - lib/vlog-modules.def | 1 - 7 files changed, 99 deletions(-) delete mode 100644 lib/vconn-fd.c diff --git a/lib/automake.mk b/lib/automake.mk index 0b3738e1..704e0e75 100644 --- a/lib/automake.mk +++ b/lib/automake.mk @@ -84,7 +84,6 @@ lib_libopenflow_a_SOURCES = \ lib/type-props.h \ lib/util.c \ lib/util.h \ - lib/vconn-fd.c \ lib/vconn-provider.h \ lib/vconn-ssl.h \ lib/vconn-stream.c \ diff --git a/lib/rconn.c b/lib/rconn.c index 9b4ae551..f7a5e4b5 100644 --- a/lib/rconn.c +++ b/lib/rconn.c @@ -339,9 +339,6 @@ reconnect(struct rconn *rc) rc->n_attempted_connections++; retval = vconn_open(rc->name, OFP_VERSION, &rc->vconn); if (!retval) { - if (!vconn_is_reconnectable(rc->vconn)) { - rc->reliable = false; - } rc->backoff_deadline = time_now() + rc->backoff; state_transition(rc, S_CONNECTING); } else { diff --git a/lib/vconn-fd.c b/lib/vconn-fd.c deleted file mode 100644 index ccc67685..00000000 --- a/lib/vconn-fd.c +++ /dev/null @@ -1,77 +0,0 @@ -/* Copyright (c) 2008 The Board of Trustees of The Leland Stanford - * Junior University - * - * We are making the OpenFlow specification and associated documentation - * (Software) available for public use and benefit with the expectation - * that others will use, modify and enhance the Software and contribute - * those enhancements back to the community. However, since we would - * like to make the Software available for broadest use, with as few - * restrictions as possible permission is hereby granted, free of - * charge, to any person obtaining a copy of this Software to deal in - * the Software under the copyrights without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * The name and trademarks of copyright holder(s) may NOT be used in - * advertising or publicity pertaining to the Software or any - * derivatives without specific, written prior permission. - */ - -#include -#include "vconn.h" -#include -#include -#include -#include -#include "util.h" -#include "vconn-provider.h" -#include "vconn-stream.h" - -#include "vlog.h" -#define THIS_MODULE VLM_vconn_fd - -/* File descriptor. */ - -static int -fd_open(const char *name, char *suffix, struct vconn **vconnp) -{ - int fd = atoi(suffix); - struct stat s; - - /* Check that 'fd' is really open and is really the right type of fd. */ - if (fstat(fd, &s) < 0) { - VLOG_ERR("%s: failed to stat file descriptor %d: %s", - name, fd, strerror(errno)); - return errno; - } - if (!S_ISSOCK(s.st_mode)) { - VLOG_ERR("%s: file descriptor %d is not a socket", name, fd); - return errno; - } - - return new_stream_vconn(name, fd, 0, 0, false, vconnp); -} - -struct vconn_class fd_vconn_class = { - "fd", /* name */ - fd_open, /* open */ - NULL, /* close */ - NULL, /* connect */ - NULL, /* recv */ - NULL, /* send */ - NULL, /* wait */ -}; diff --git a/lib/vconn-provider.h b/lib/vconn-provider.h index 8098c15b..abf20559 100644 --- a/lib/vconn-provider.h +++ b/lib/vconn-provider.h @@ -179,7 +179,6 @@ extern struct vconn_class tcp_vconn_class; extern struct pvconn_class ptcp_pvconn_class; extern struct vconn_class unix_vconn_class; extern struct pvconn_class punix_pvconn_class; -extern struct vconn_class fd_vconn_class; #ifdef HAVE_OPENSSL extern struct vconn_class ssl_vconn_class; extern struct pvconn_class pssl_pvconn_class; diff --git a/lib/vconn.c b/lib/vconn.c index 4dd25a67..adadf890 100644 --- a/lib/vconn.c +++ b/lib/vconn.c @@ -73,7 +73,6 @@ static struct vconn_class *vconn_classes[] = { #ifdef HAVE_OPENSSL &ssl_vconn_class, #endif - &fd_vconn_class, }; static struct pvconn_class *pvconn_classes[] = { @@ -156,7 +155,6 @@ vconn_usage(bool active, bool passive, bool bootstrap UNUSED) "SSL PORT (default: %d) on remote HOST\n", OFP_SSL_PORT); #endif printf(" unix:FILE Unix domain socket named FILE\n"); - printf(" fd:N File descriptor N\n"); } if (passive) { @@ -277,19 +275,6 @@ vconn_get_ip(const struct vconn *vconn) return vconn->ip; } -/* Returns true if, when 'vconn' is closed, it is possible to try to reconnect - * to it using the name that was originally used. This is ordinarily the case. - * - * Returns false if reconnecting under the same name will never work in the way - * that you would expect. This is the case if 'vconn' represents a "fd:N" type - * vconn; one can never connect to such a vconn more than once, because closing - * it closes the file descriptor. */ -bool -vconn_is_reconnectable(const struct vconn *vconn) -{ - return vconn->reconnectable; -} - static void vcs_connecting(struct vconn *vconn) { diff --git a/lib/vconn.h b/lib/vconn.h index 192962c4..54893e06 100644 --- a/lib/vconn.h +++ b/lib/vconn.h @@ -56,7 +56,6 @@ int vconn_open(const char *name, int min_version, struct vconn **); void vconn_close(struct vconn *); const char *vconn_get_name(const struct vconn *); uint32_t vconn_get_ip(const struct vconn *); -bool vconn_is_reconnectable(const struct vconn *); int vconn_connect(struct vconn *); int vconn_recv(struct vconn *, struct ofpbuf **); int vconn_send(struct vconn *, struct ofpbuf *); diff --git a/lib/vlog-modules.def b/lib/vlog-modules.def index b8aa1d35..4e3f6e4c 100644 --- a/lib/vlog-modules.def +++ b/lib/vlog-modules.def @@ -42,7 +42,6 @@ VLOG_MODULE(svec) VLOG_MODULE(switch) VLOG_MODULE(terminal) VLOG_MODULE(socket_util) -VLOG_MODULE(vconn_fd) VLOG_MODULE(vconn_tcp) VLOG_MODULE(vconn_ssl) VLOG_MODULE(vconn_stream) -- 2.30.2