You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zy...@apache.org on 2013/12/29 11:50:45 UTC
[1/4] git commit: TS-32: minimum FIX to let ICP work
Updated Branches:
refs/heads/master c04946933 -> c905388f2
TS-32: minimum FIX to let ICP work
Fixed an error on access to class member that was not initialized and
restored former implementation based on a change in TS-320.
And commented out the forced termination code in
UDPReadContinuation::readPollEvent().
Please tell me if you know what seems to be the problem in this
implementation.
Signed-off-by: Zhao Yongming <mi...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/05f7bfb5
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/05f7bfb5
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/05f7bfb5
Branch: refs/heads/master
Commit: 05f7bfb57517e60a364a62dd171e5cc65824aa4a
Parents: c049469
Author: Gota Adachi <ad...@iij.ad.jp>
Authored: Tue Dec 24 15:15:38 2013 +0800
Committer: Zhao Yongming <mi...@gmail.com>
Committed: Sun Dec 29 18:39:20 2013 +0800
----------------------------------------------------------------------
iocore/net/UnixNet.cc | 7 +++++--
iocore/net/UnixUDPNet.cc | 6 +++++-
proxy/ICP.cc | 21 ++++++++++++++++++---
proxy/ICP.h | 1 +
proxy/ICPConfig.cc | 7 +++++++
5 files changed, 36 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/05f7bfb5/iocore/net/UnixNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNet.cc b/iocore/net/UnixNet.cc
index 5e72b0c..69b620f 100644
--- a/iocore/net/UnixNet.cc
+++ b/iocore/net/UnixNet.cc
@@ -71,13 +71,13 @@ struct InactivityCop : public Continuation {
};
#endif
-PollCont::PollCont(ProxyMutex *m, int pt):Continuation(m), net_handler(NULL), poll_timeout(pt) {
+PollCont::PollCont(ProxyMutex *m, int pt):Continuation(m), net_handler(NULL), nextPollDescriptor(NULL), poll_timeout(pt) {
pollDescriptor = NEW(new PollDescriptor);
pollDescriptor->init();
SET_HANDLER(&PollCont::pollEvent);
}
-PollCont::PollCont(ProxyMutex *m, NetHandler *nh, int pt):Continuation(m), net_handler(nh), poll_timeout(pt)
+PollCont::PollCont(ProxyMutex *m, NetHandler *nh, int pt):Continuation(m), net_handler(nh), nextPollDescriptor(NULL), poll_timeout(pt)
{
pollDescriptor = NEW(new PollDescriptor);
pollDescriptor->init();
@@ -86,6 +86,9 @@ PollCont::PollCont(ProxyMutex *m, NetHandler *nh, int pt):Continuation(m), net_h
PollCont::~PollCont() {
delete pollDescriptor;
+ if (nextPollDescriptor != NULL) {
+ delete nextPollDescriptor;
+ }
}
//
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/05f7bfb5/iocore/net/UnixUDPNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index 0237e9c..ee9c6f9 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -298,6 +298,10 @@ UDPReadContinuation::setupPollDescriptor()
Pollfd *pfd;
EThread *et = (EThread *) this_thread();
PollCont *pc = get_PollCont(et);
+ if (pc->nextPollDescriptor == NULL) {
+ pc->nextPollDescriptor = NEW(new PollDescriptor);
+ pc->nextPollDescriptor->init();
+ }
pfd = pc->nextPollDescriptor->alloc();
pfd->fd = fd;
ifd = pfd - pc->nextPollDescriptor->pfd;
@@ -337,7 +341,7 @@ UDPReadContinuation::readPollEvent(int event_, Event * e)
}
//ink_assert(ifd < 0 || event_ == EVENT_INTERVAL || (event_ == EVENT_POLL && pc->pollDescriptor->nfds > ifd && pc->pollDescriptor->pfd[ifd].fd == fd));
//if (ifd < 0 || event_ == EVENT_INTERVAL || (pc->pollDescriptor->pfd[ifd].revents & POLLIN)) {
- ink_assert(!"incomplete");
+ //ink_assert(!"incomplete");
c = completionUtil::getContinuation(event);
// do read
socklen_t tmp_fromlen = *fromaddrlen;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/05f7bfb5/proxy/ICP.cc
----------------------------------------------------------------------
diff --git a/proxy/ICP.cc b/proxy/ICP.cc
index 4ed8e29..7e78925 100644
--- a/proxy/ICP.cc
+++ b/proxy/ICP.cc
@@ -2174,8 +2174,8 @@ ICPProcessor::SetupListenSockets()
Peer *P;
int status;
int index;
+ ip_port_text_buffer ipb, ipb2;
for (index = 0; index < (_nPeerList + 1); ++index) {
- ip_port_text_buffer ipb, ipb2;
if ((P = _PeerList[index])) {
@@ -2183,7 +2183,7 @@ ICPProcessor::SetupListenSockets()
|| (P->GetType() == PEER_SIBLING)) {
ParentSiblingPeer *pPS = (ParentSiblingPeer *) P;
- pPS->GetChan()->setRemote(pPS->GetIP());
+ pPS->GetChan()->setRemote(pPS->GetIP());
} else if (P->GetType() == PEER_MULTICAST) {
MultiCastPeer *pMC = (MultiCastPeer *) P;
@@ -2219,7 +2219,22 @@ ICPProcessor::SetupListenSockets()
//
ParentSiblingPeer *pPS = (ParentSiblingPeer *) ((Peer *) _LocalPeer);
- pPS->GetChan()->setRemote(pPS->GetIP());
+ NetVCOptions options;
+ options.local_ip.assign(pPS->GetIP());
+ options.local_port = pPS->GetICPPort();
+ options.ip_proto = NetVCOptions::USE_UDP;
+ options.addr_binding = NetVCOptions::INTF_ADDR;
+ status = pPS->GetChan()->open(options);
+ if (status) {
+ // coverity[uninit_use_in_call] ?
+ Warning("ICP bind_connect failed, res=%d, ip=%s",
+ status,
+ ats_ip_nptop(pPS->GetIP(), ipb, sizeof(ipb))
+ );
+ REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "ICP bind_connect for localhost failed");
+ return 1; // Failed
+ }
+
return 0; // Success
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/05f7bfb5/proxy/ICP.h
----------------------------------------------------------------------
diff --git a/proxy/ICP.h b/proxy/ICP.h
index e44e6ea..5ccf7b4 100644
--- a/proxy/ICP.h
+++ b/proxy/ICP.h
@@ -613,6 +613,7 @@ public:
delete _pconfig;
}
int GetProxyPort();
+ int GetICPPort();
virtual sockaddr* GetIP();
virtual Action *SendMsg_re(Continuation *, void *, struct msghdr *, struct sockaddr const* to);
virtual Action *RecvFrom_re(Continuation *, void *, IOBufferBlock *, int, struct sockaddr *, socklen_t *);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/05f7bfb5/proxy/ICPConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/ICPConfig.cc b/proxy/ICPConfig.cc
index b5192d2..2463050 100644
--- a/proxy/ICPConfig.cc
+++ b/proxy/ICPConfig.cc
@@ -857,6 +857,13 @@ ParentSiblingPeer::GetProxyPort()
return _pconfig->GetProxyPort();
}
+int
+ParentSiblingPeer::GetICPPort()
+{
+ return _pconfig->GetICPPort();
+}
+
+
sockaddr*
ParentSiblingPeer::GetIP()
{
Re: [4/4] git commit: Add TS-32.
Posted by Igor Galić <i....@brainsware.org>.
----- Original Message -----
> Add TS-32.
>
>
> Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
> Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/c905388f
> Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/c905388f
> Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/c905388f
>
> Branch: refs/heads/master
> Commit: c905388f273efff34d4ccf79b0e41be3ef459ada
> Parents: 1d01716
> Author: Zhao Yongming <mi...@gmail.com>
> Authored: Sun Dec 29 18:50:00 2013 +0800
> Committer: Zhao Yongming <mi...@gmail.com>
> Committed: Sun Dec 29 18:50:00 2013 +0800
>
> ----------------------------------------------------------------------
> CHANGES | 3 +++
> 1 file changed, 3 insertions(+)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c905388f/CHANGES
> ----------------------------------------------------------------------
> diff --git a/CHANGES b/CHANGES
> index 69131c6..168a087 100644
> --- a/CHANGES
> +++ b/CHANGES
> @@ -1,6 +1,9 @@
> -*- coding: utf-8
> -*-
> Changes with Apache Traffic Server 4.2.0
>
> + *) [TS-32] Fix ICP.
> + Author: Gota Adachi <ad...@iij.ad.jp>
> +
> *) [TS-2248] Segmentation fault in HttpTunnel with flow control.
> Author: bettydramit <b1...@gmail.com>.
Currently, the entire ICP documentation is commented out in the documentation.
It will need review and needs to be re-instantiated.
--
Igor Galić
Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 8716 7A9F 989B ABD5 100F 4008 F266 55D6 2998 1641
[4/4] git commit: Add TS-32.
Posted by zy...@apache.org.
Add TS-32.
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/c905388f
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/c905388f
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/c905388f
Branch: refs/heads/master
Commit: c905388f273efff34d4ccf79b0e41be3ef459ada
Parents: 1d01716
Author: Zhao Yongming <mi...@gmail.com>
Authored: Sun Dec 29 18:50:00 2013 +0800
Committer: Zhao Yongming <mi...@gmail.com>
Committed: Sun Dec 29 18:50:00 2013 +0800
----------------------------------------------------------------------
CHANGES | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c905388f/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 69131c6..168a087 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
-*- coding: utf-8 -*-
Changes with Apache Traffic Server 4.2.0
+ *) [TS-32] Fix ICP.
+ Author: Gota Adachi <ad...@iij.ad.jp>
+
*) [TS-2248] Segmentation fault in HttpTunnel with flow control.
Author: bettydramit <b1...@gmail.com>.
[3/4] git commit: TS-32: temp fix the overrun problem in
PollDescriptor::alloc()
Posted by zy...@apache.org.
TS-32: temp fix the overrun problem in PollDescriptor::alloc()
may need better solution on pollfd.
Signed-off-by: Zhao Yongming <mi...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/1d01716c
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/1d01716c
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/1d01716c
Branch: refs/heads/master
Commit: 1d01716ceb2febf4fdcde2f2aae38f55e369d414
Parents: cf054cb
Author: Gota Adachi <ad...@iij.ad.jp>
Authored: Tue Dec 24 15:16:12 2013 +0800
Committer: Zhao Yongming <mi...@gmail.com>
Committed: Sun Dec 29 18:45:20 2013 +0800
----------------------------------------------------------------------
iocore/net/P_UnixPollDescriptor.h | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1d01716c/iocore/net/P_UnixPollDescriptor.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UnixPollDescriptor.h b/iocore/net/P_UnixPollDescriptor.h
index f694670..af3d9e7 100644
--- a/iocore/net/P_UnixPollDescriptor.h
+++ b/iocore/net/P_UnixPollDescriptor.h
@@ -106,6 +106,10 @@ struct PollDescriptor
Pollfd *alloc()
{
#if TS_USE_EPOLL
+ // XXX : We need restrict max size based on definition.
+ if (nfds >= POLL_DESCRIPTOR_SIZE) {
+ nfds = 0;
+ }
return &pfd[nfds++];
#else
return 0;
Re: [2/4] git commit: TS-32: FIX to perform multicast ICP
communication
Posted by Igor Galić <i....@brainsware.org>.
----- Original Message -----
> TS-32: FIX to perform multicast ICP communication
>
> Signed-off-by: Zhao Yongming <mi...@gmail.com>
>
>
> Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
> Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/cf054cb3
> Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/cf054cb3
> Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/cf054cb3
>
> Branch: refs/heads/master
> Commit: cf054cb3ad57157a05f0e4d37b5065950f6bcbc6
> Parents: 05f7bfb
> Author: Gota Adachi <ad...@iij.ad.jp>
> Authored: Tue Dec 24 15:15:55 2013 +0800
> Committer: Zhao Yongming <mi...@gmail.com>
> Committed: Sun Dec 29 18:42:01 2013 +0800
>
> ----------------------------------------------------------------------
> iocore/net/P_Connection.h | 1 +
> iocore/net/UnixConnection.cc | 10 ++++++++--
> lib/ts/ink_inet.cc | 2 +-
> proxy/ICP.cc | 1 +
> 4 files changed, 11 insertions(+), 3 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cf054cb3/iocore/net/P_Connection.h
> ----------------------------------------------------------------------
> diff --git a/iocore/net/P_Connection.h b/iocore/net/P_Connection.h
> index 7abaa8e..e2fed75 100644
> --- a/iocore/net/P_Connection.h
> +++ b/iocore/net/P_Connection.h
> @@ -131,6 +131,7 @@ struct Connection
> unsigned char mc_ttl = 1, bool mc_loopback =
> DISABLE_MC_LOOPBACK, Continuation * c = NULL);
>
> int setup_mc_receive(sockaddr const* from,
> + sockaddr const* my_addr,
> bool non_blocking = NON_BLOCKING, Connection *
> sendchan = NULL, Continuation * c = NULL);
>
> int close(); // 0 on success, -errno on failure
>
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cf054cb3/iocore/net/UnixConnection.cc
> ----------------------------------------------------------------------
> diff --git a/iocore/net/UnixConnection.cc b/iocore/net/UnixConnection.cc
> index 98b931a..9a03c0e 100644
> --- a/iocore/net/UnixConnection.cc
> +++ b/iocore/net/UnixConnection.cc
> @@ -53,6 +53,7 @@ Connection::setup_mc_send(
> ink_assert(fd == NO_FD);
> int res = 0;
> int enable_reuseaddr = 1;
> + in_addr_t mc_if = ats_ip4_addr_cast(my_addr);
Is there a way to make this work with either IPv4 or IPv6?
>
> if ((res = socketManager.mc_socket(my_addr->sa_family, SOCK_DGRAM, 0,
> non_blocking)) < 0)
> goto Lerror;
> @@ -82,6 +83,9 @@ Connection::setup_mc_send(
> if ((res = safe_setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, (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, (char *)
> &mc_if, sizeof(mc_if)) < 0))
> + goto Lerror;
>
> // Disable MultiCast loopback if requested
> if (!mc_loopback) {
> @@ -102,6 +106,7 @@ Lerror:
> 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);
> @@ -109,6 +114,7 @@ Connection::setup_mc_receive(
> (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;
> @@ -123,7 +129,7 @@ Connection::setup_mc_receive(
> if ((res = safe_setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)
> &enable_reuseaddr, sizeof(enable_reuseaddr)) < 0))
> goto Lerror;
>
> - ats_ip_copy(&addr, mc_addr);
> + 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;
> @@ -136,7 +142,7 @@ Connection::setup_mc_receive(
> 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 = INADDR_ANY;
> + mc_request.imr_interface.s_addr = ats_ip4_addr_cast(my_addr);
>
> if ((res = safe_setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)
> &mc_request, sizeof(mc_request)) < 0))
> goto Lerror;
>
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cf054cb3/lib/ts/ink_inet.cc
> ----------------------------------------------------------------------
> diff --git a/lib/ts/ink_inet.cc b/lib/ts/ink_inet.cc
> index 397e7da..3221ab2 100644
> --- a/lib/ts/ink_inet.cc
> +++ b/lib/ts/ink_inet.cc
> @@ -348,7 +348,7 @@ IpAddr::toString(char* dest, size_t len) const {
>
> bool
> IpAddr::isMulticast() const {
> - return (AF_INET == _family && 0xe == _addr._byte[0]) ||
> + return (AF_INET == _family && 0xe == (_addr._byte[0] >> 4)) ||
> (AF_INET6 == _family && IN6_IS_ADDR_MULTICAST(&_addr._ip6))
> ;
> }
>
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cf054cb3/proxy/ICP.cc
> ----------------------------------------------------------------------
> diff --git a/proxy/ICP.cc b/proxy/ICP.cc
> index 7e78925..8124a44 100644
> --- a/proxy/ICP.cc
> +++ b/proxy/ICP.cc
> @@ -2201,6 +2201,7 @@ ICPProcessor::SetupListenSockets()
> }
>
> status = pMC->GetRecvChan()->setup_mc_receive(pMC->GetIP(),
> + _LocalPeer->GetIP(),
> NON_BLOCKING,
> pMC->GetSendChan(),
> _mcastCB_handler);
> if (status) {
> // coverity[uninit_use_in_call]
>
>
--
Igor Galić
Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 8716 7A9F 989B ABD5 100F 4008 F266 55D6 2998 1641
[2/4] git commit: TS-32: FIX to perform multicast ICP communication
Posted by zy...@apache.org.
TS-32: FIX to perform multicast ICP communication
Signed-off-by: Zhao Yongming <mi...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/cf054cb3
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/cf054cb3
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/cf054cb3
Branch: refs/heads/master
Commit: cf054cb3ad57157a05f0e4d37b5065950f6bcbc6
Parents: 05f7bfb
Author: Gota Adachi <ad...@iij.ad.jp>
Authored: Tue Dec 24 15:15:55 2013 +0800
Committer: Zhao Yongming <mi...@gmail.com>
Committed: Sun Dec 29 18:42:01 2013 +0800
----------------------------------------------------------------------
iocore/net/P_Connection.h | 1 +
iocore/net/UnixConnection.cc | 10 ++++++++--
lib/ts/ink_inet.cc | 2 +-
proxy/ICP.cc | 1 +
4 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cf054cb3/iocore/net/P_Connection.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_Connection.h b/iocore/net/P_Connection.h
index 7abaa8e..e2fed75 100644
--- a/iocore/net/P_Connection.h
+++ b/iocore/net/P_Connection.h
@@ -131,6 +131,7 @@ struct Connection
unsigned char mc_ttl = 1, bool mc_loopback = DISABLE_MC_LOOPBACK, Continuation * c = NULL);
int setup_mc_receive(sockaddr const* from,
+ sockaddr const* my_addr,
bool non_blocking = NON_BLOCKING, Connection * sendchan = NULL, Continuation * c = NULL);
int close(); // 0 on success, -errno on failure
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cf054cb3/iocore/net/UnixConnection.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixConnection.cc b/iocore/net/UnixConnection.cc
index 98b931a..9a03c0e 100644
--- a/iocore/net/UnixConnection.cc
+++ b/iocore/net/UnixConnection.cc
@@ -53,6 +53,7 @@ Connection::setup_mc_send(
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.mc_socket(my_addr->sa_family, SOCK_DGRAM, 0, non_blocking)) < 0)
goto Lerror;
@@ -82,6 +83,9 @@ Connection::setup_mc_send(
if ((res = safe_setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, (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, (char *) &mc_if, sizeof(mc_if)) < 0))
+ goto Lerror;
// Disable MultiCast loopback if requested
if (!mc_loopback) {
@@ -102,6 +106,7 @@ Lerror:
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);
@@ -109,6 +114,7 @@ Connection::setup_mc_receive(
(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;
@@ -123,7 +129,7 @@ Connection::setup_mc_receive(
if ((res = safe_setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *) &enable_reuseaddr, sizeof(enable_reuseaddr)) < 0))
goto Lerror;
- ats_ip_copy(&addr, mc_addr);
+ 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;
@@ -136,7 +142,7 @@ Connection::setup_mc_receive(
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 = INADDR_ANY;
+ mc_request.imr_interface.s_addr = ats_ip4_addr_cast(my_addr);
if ((res = safe_setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *) &mc_request, sizeof(mc_request)) < 0))
goto Lerror;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cf054cb3/lib/ts/ink_inet.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_inet.cc b/lib/ts/ink_inet.cc
index 397e7da..3221ab2 100644
--- a/lib/ts/ink_inet.cc
+++ b/lib/ts/ink_inet.cc
@@ -348,7 +348,7 @@ IpAddr::toString(char* dest, size_t len) const {
bool
IpAddr::isMulticast() const {
- return (AF_INET == _family && 0xe == _addr._byte[0]) ||
+ return (AF_INET == _family && 0xe == (_addr._byte[0] >> 4)) ||
(AF_INET6 == _family && IN6_IS_ADDR_MULTICAST(&_addr._ip6))
;
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cf054cb3/proxy/ICP.cc
----------------------------------------------------------------------
diff --git a/proxy/ICP.cc b/proxy/ICP.cc
index 7e78925..8124a44 100644
--- a/proxy/ICP.cc
+++ b/proxy/ICP.cc
@@ -2201,6 +2201,7 @@ ICPProcessor::SetupListenSockets()
}
status = pMC->GetRecvChan()->setup_mc_receive(pMC->GetIP(),
+ _LocalPeer->GetIP(),
NON_BLOCKING, pMC->GetSendChan(), _mcastCB_handler);
if (status) {
// coverity[uninit_use_in_call]