You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by sh...@apache.org on 2021/07/22 15:41:14 UTC

[trafficserver] branch master updated: Remove unused multicast functions (#8158)

This is an automated email from the ASF dual-hosted git repository.

shinrich pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new d6b8ce0  Remove unused multicast functions (#8158)
d6b8ce0 is described below

commit d6b8ce009ea5fad785ee7d8c056635c28caf5484
Author: Susan Hinrichs <sh...@verizonmedia.com>
AuthorDate: Thu Jul 22 10:41:02 2021 -0500

    Remove unused multicast functions (#8158)
---
 iocore/net/P_Connection.h    |   6 ---
 iocore/net/UnixConnection.cc | 124 -------------------------------------------
 2 files changed, 130 deletions(-)

diff --git a/iocore/net/P_Connection.h b/iocore/net/P_Connection.h
index 4df1cc0..135a2b0 100644
--- a/iocore/net/P_Connection.h
+++ b/iocore/net/P_Connection.h
@@ -120,12 +120,6 @@ struct Connection {
     ats_ip_copy(&addr, remote_addr);
   }
 
-  int setup_mc_send(sockaddr const *mc_addr, sockaddr const *my_addr, bool non_blocking = NON_BLOCKING, unsigned char mc_ttl = 1,
-                    bool mc_loopback = DISABLE_MC_LOOPBACK, Continuation *c = nullptr);
-
-  int setup_mc_receive(sockaddr const *from, sockaddr const *my_addr, bool non_blocking = NON_BLOCKING,
-                       Connection *sendchan = nullptr, Continuation *c = nullptr);
-
   int close(); // 0 on success, -errno on failure
 
   void apply_options(NetVCOptions const &opt);
diff --git a/iocore/net/UnixConnection.cc b/iocore/net/UnixConnection.cc
index 5657dc5..7be4de6 100644
--- a/iocore/net/UnixConnection.cc
+++ b/iocore/net/UnixConnection.cc
@@ -41,130 +41,6 @@ unsigned int const IP_TRANSPARENT = 19;
 #endif
 #endif
 
-//
-// Functions
-//
-int
-Connection::setup_mc_send(sockaddr const *mc_addr, sockaddr const *my_addr, bool non_blocking, unsigned char mc_ttl,
-                          bool mc_loopback, Continuation *c)
-{
-  (void)c;
-  ink_assert(fd == NO_FD);
-  int res              = 0;
-  int enable_reuseaddr = 1;
-  in_addr_t mc_if      = ats_ip4_addr_cast(my_addr);
-
-  if ((res = socketManager.socket(my_addr->sa_family, SOCK_DGRAM, 0)) < 0) {
-    goto Lerror;
-  }
-
-  fd = res;
-
-  if ((res = safe_setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast<char *>(&enable_reuseaddr), sizeof(enable_reuseaddr)) <
-             0)) {
-    goto Lerror;
-  }
-
-  if ((res = socketManager.ink_bind(fd, my_addr, ats_ip_size(my_addr), IPPROTO_UDP)) < 0) {
-    goto Lerror;
-  }
-
-  ats_ip_copy(&addr, mc_addr);
-
-  if ((res = safe_fcntl(fd, F_SETFD, FD_CLOEXEC)) < 0) {
-    goto Lerror;
-  }
-
-  if (non_blocking) {
-    if ((res = safe_nonblocking(fd)) < 0) {
-      goto Lerror;
-    }
-  }
-
-  // Set MultiCast TTL to specified value
-  if ((res = safe_setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, reinterpret_cast<char *>(&mc_ttl), sizeof(mc_ttl)) < 0)) {
-    goto Lerror;
-  }
-
-  // Set MultiCast Interface to specified value
-  if ((res = safe_setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, reinterpret_cast<char *>(&mc_if), sizeof(mc_if)) < 0)) {
-    goto Lerror;
-  }
-
-  // Disable MultiCast loopback if requested
-  if (!mc_loopback) {
-    char loop = 0;
-
-    if ((res = safe_setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, &loop, sizeof(loop)) < 0)) {
-      goto Lerror;
-    }
-  }
-  return 0;
-
-Lerror:
-  if (fd != NO_FD) {
-    close();
-  }
-  return res;
-}
-
-int
-Connection::setup_mc_receive(sockaddr const *mc_addr, sockaddr const *my_addr, bool non_blocking, Connection *sendChan,
-                             Continuation *c)
-{
-  ink_assert(fd == NO_FD);
-  (void)sendChan;
-  (void)c;
-  int res              = 0;
-  int enable_reuseaddr = 1;
-  IpAddr inaddr_any(INADDR_ANY);
-
-  if ((res = socketManager.socket(mc_addr->sa_family, SOCK_DGRAM, 0)) < 0) {
-    goto Lerror;
-  }
-
-  fd = res;
-
-  if ((res = safe_fcntl(fd, F_SETFD, FD_CLOEXEC)) < 0) {
-    goto Lerror;
-  }
-
-  if ((res = safe_setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast<char *>(&enable_reuseaddr), sizeof(enable_reuseaddr)) <
-             0)) {
-    goto Lerror;
-  }
-
-  addr.assign(inaddr_any, ats_ip_port_cast(mc_addr));
-
-  if ((res = socketManager.ink_bind(fd, &addr.sa, ats_ip_size(&addr.sa), IPPROTO_TCP)) < 0) {
-    goto Lerror;
-  }
-
-  if (non_blocking) {
-    if ((res = safe_nonblocking(fd)) < 0) {
-      goto Lerror;
-    }
-  }
-
-  if (ats_is_ip4(&addr)) {
-    struct ip_mreq mc_request;
-    // Add ourselves to the MultiCast group
-    mc_request.imr_multiaddr.s_addr = ats_ip4_addr_cast(mc_addr);
-    mc_request.imr_interface.s_addr = ats_ip4_addr_cast(my_addr);
-
-    if ((res = safe_setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, reinterpret_cast<char *>(&mc_request), sizeof(mc_request)) < 0)) {
-      goto Lerror;
-    }
-  }
-  return 0;
-
-Lerror:
-  if (fd != NO_FD) {
-    close();
-  }
-  return res;
-}
-
 namespace
 {
 /** Struct to make cleaning up resources easier.