mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-01-20 21:52:55 -05:00
- Set SO_REUSEADDR on outgoing tcp connections to fix the bind before
connect limited tcp connections. With the option tcp connections can share the same source port (for different destinations). git-svn-id: file:///svn/unbound/trunk@4151 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
ad2e157763
commit
4e502fd624
2 changed files with 13 additions and 0 deletions
|
|
@ -1,5 +1,8 @@
|
|||
8 May 2017: Wouter
|
||||
- Fix tcp-mss failure printout text.
|
||||
- Set SO_REUSEADDR on outgoing tcp connections to fix the bind before
|
||||
connect limited tcp connections. With the option tcp connections
|
||||
can share the same source port (for different destinations).
|
||||
|
||||
2 May 2017: Ralph
|
||||
- Added mesh_add_sub to add detached mesh entries.
|
||||
|
|
|
|||
|
|
@ -204,6 +204,9 @@ outnet_tcp_take_into_use(struct waiting_tcp* w, uint8_t* pkt, size_t pkt_len)
|
|||
{
|
||||
struct pending_tcp* pend = w->outnet->tcp_free;
|
||||
int s;
|
||||
#ifdef SO_REUSEADDR
|
||||
int on = 1;
|
||||
#endif
|
||||
log_assert(pend);
|
||||
log_assert(pkt);
|
||||
log_assert(w->addrlen > 0);
|
||||
|
|
@ -225,6 +228,13 @@ outnet_tcp_take_into_use(struct waiting_tcp* w, uint8_t* pkt, size_t pkt_len)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef SO_REUSEADDR
|
||||
if(setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (void*)&on,
|
||||
(socklen_t)sizeof(on)) < 0) {
|
||||
verbose(VERB_ALGO, "outgoing tcp:"
|
||||
" setsockopt(.. SO_REUSEADDR ..) failed");
|
||||
}
|
||||
#endif
|
||||
if (w->outnet->tcp_mss > 0) {
|
||||
#if defined(IPPROTO_TCP) && defined(TCP_MAXSEG)
|
||||
if(setsockopt(s, IPPROTO_TCP, TCP_MAXSEG,
|
||||
|
|
|
|||
Loading…
Reference in a new issue