Skip to content

Commit

Permalink
Set IPv4 TOS and TTL when setting IPv6 TCLASS and HOPS to set accepte…
Browse files Browse the repository at this point in the history
…d IPv4 socket of IPv4mapped-IPv6 addresses.

Fixed some compiler warnings.
  • Loading branch information
jeandube authored and rndi committed May 16, 2019
1 parent 25d1dce commit ee311d6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions srtcore/channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ void CChannel::setUDPSockOpt()
{
if(0 != ::setsockopt(m_iSocket, IPPROTO_IPV6, IPV6_UNICAST_HOPS, (const char*)&m_iIpTTL, sizeof(m_iIpTTL)))
throw CUDTException(MJ_SETUP, MN_NORES, NET_ERROR);
//For IPv4mapped-IPv6 accepted connection also set the IPV4 socket.
if(0 != ::setsockopt(m_iSocket, IPPROTO_IP, IP_TTL, (const char*)&m_iIpTTL, sizeof(m_iIpTTL)))
throw CUDTException(MJ_SETUP, MN_NORES, NET_ERROR);
}
}
if (-1 != m_iIpToS)
Expand All @@ -228,6 +231,9 @@ void CChannel::setUDPSockOpt()
if(0 != ::setsockopt(m_iSocket, IPPROTO_IPV6, IPV6_TCLASS, (const char*)&m_iIpToS, sizeof(m_iIpToS)))
#endif
throw CUDTException(MJ_SETUP, MN_NORES, NET_ERROR);
//For IPv4mapped-IPv6 accepted connection also set the IPV4 socket.
if(0 != ::setsockopt(m_iSocket, IPPROTO_IP, IP_TOS, (const char*)&m_iIpToS, sizeof(m_iIpToS)))
throw CUDTException(MJ_SETUP, MN_NORES, NET_ERROR);
}
}
#endif
Expand Down
4 changes: 3 additions & 1 deletion srtcore/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6671,7 +6671,7 @@ void CUDT::processCtrl(CPacket& ctrlpkt)
int32_t* ackdata = (int32_t*)ctrlpkt.m_pcData;

// process a lite ACK
if (ctrlpkt.getLength() == SEND_LITE_ACK)
if (ctrlpkt.getLength() == (size_t)SEND_LITE_ACK)
{
ack = *ackdata;
if (CSeqNo::seqcmp(ack, m_iSndLastAck) >= 0)
Expand Down Expand Up @@ -7644,7 +7644,9 @@ int CUDT::processData(CUnit* unit)
}

int pktrexmitflag = m_bPeerRexmitFlag ? (int)packet.getRexmitFlag() : 2;
#if ENABLE_HEAVY_LOGGING
static const char* const rexmitstat [] = {"ORIGINAL", "REXMITTED", "RXS-UNKNOWN"};
#endif
string rexmit_reason;


Expand Down

0 comments on commit ee311d6

Please sign in to comment.