[ovs-dev] [PATCH] stream-tcp, stream-ssl: Remove unneeded getsockname() calls.

Eitan Eliahu eliahue at vmware.com
Thu Oct 23 15:43:57 UTC 2014


Acked-by: Eitan Eliahu <eliahue at vmware.com>

Thanks,
Eitan

-----Original Message-----
From: Ben Pfaff [mailto:blp at nicira.com] 
Sent: Wednesday, October 22, 2014 4:06 PM
To: dev at openvswitch.org
Cc: Ben Pfaff; Eitan Eliahu
Subject: [PATCH] stream-tcp, stream-ssl: Remove unneeded getsockname() calls.

Commit a8d819675f3 (Remove stream, vconn, and rconn functions to get local/remote IPs/ports.) removed the code that used the local socket address but neglected to remove the code to fetch that address.  This commit removes the latter code also.

Reported-by: Eitan Eliahu <eliahue at vmware.com>
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 lib/stream-ssl.c |    8 --------
 lib/stream-tcp.c |    8 --------
 2 files changed, 16 deletions(-)

diff --git a/lib/stream-ssl.c b/lib/stream-ssl.c index dd40010..d1fa88a 100644
--- a/lib/stream-ssl.c
+++ b/lib/stream-ssl.c
@@ -236,8 +236,6 @@ static int
 new_ssl_stream(const char *name, int fd, enum session_type type,
                enum ssl_state state, struct stream **streamp)  {
-    struct sockaddr_storage local;
-    socklen_t local_len = sizeof local;
     struct ssl_stream *sslv;
     SSL *ssl = NULL;
     int retval;
@@ -265,12 +263,6 @@ new_ssl_stream(const char *name, int fd, enum session_type type,
         goto error;
     }
 
-    /* Get the local IP and port information */
-    retval = getsockname(fd, (struct sockaddr *) &local, &local_len);
-    if (retval) {
-        memset(&local, 0, sizeof local);
-    }
-
     /* Disable Nagle.
      * On windows platforms, this can only be called upon TCP connected.
      */
diff --git a/lib/stream-tcp.c b/lib/stream-tcp.c index ea6ef69..043a30b 100644
--- a/lib/stream-tcp.c
+++ b/lib/stream-tcp.c
@@ -42,17 +42,9 @@ static int
 new_tcp_stream(const char *name, int fd, int connect_status,
                struct stream **streamp)  {
-    struct sockaddr_storage local;
-    socklen_t local_len = sizeof local;
     int on = 1;
     int retval;
 
-    /* Get the local IP and port information */
-    retval = getsockname(fd, (struct sockaddr *) &local, &local_len);
-    if (retval) {
-        memset(&local, 0, sizeof local);
-    }
-
     retval = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof on);
     if (retval) {
         int error = sock_errno();
--
1.7.10.4




More information about the dev mailing list