Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
Dnsmasq
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
Dnsmasq
Commits
76dd75de
Commit
76dd75de
authored
May 23, 2013
by
Simon Kelley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix hang from new interface-name code, when using TCP.
parent
63fd27e3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
50 deletions
+60
-50
src/dnsmasq.c
src/dnsmasq.c
+57
-49
src/network.c
src/network.c
+3
-1
No files found.
src/dnsmasq.c
View file @
76dd75de
...
...
@@ -1355,63 +1355,71 @@ static void check_dns_listeners(fd_set *set, time_t now)
if
(
confd
==
-
1
)
continue
;
if
(
getsockname
(
confd
,
(
struct
sockaddr
*
)
&
tcp_addr
,
&
tcp_len
)
==
-
1
)
{
close
(
confd
);
continue
;
}
if
(
option_bool
(
OPT_NOWILD
))
iface
=
listener
->
iface
;
/* May be NULL */
else
{
int
if_index
;
char
intr_name
[
IF_NAMESIZE
];
/* Make sure that the interface list is up-to-date.
We do this here as we may need the results below, and
the DNS code needs them for --interface-name stuff.
Multiple calls to enumerate_interfaces() per select loop are
inhibited, so calls to it in the child process (which doesn't select())
have no effect. This avoids two processes reading from the same
netlink fd and screwing the pooch entirely.
*/
/* In full wildcard mode, need to refresh interface list.
This happens automagically in CLEVERBIND */
if
(
!
option_bool
(
OPT_CLEVERBIND
))
enumerate_interfaces
(
0
);
/* if we can find the arrival interface, check it's one that's allowed */
if
((
if_index
=
tcp_interface
(
confd
,
tcp_addr
.
sa
.
sa_family
))
!=
0
&&
indextoname
(
listener
->
tcpfd
,
if_index
,
intr_name
))
{
struct
all_addr
addr
;
addr
.
addr
.
addr4
=
tcp_addr
.
in
.
sin_addr
;
enumerate_interfaces
(
0
);
if
(
option_bool
(
OPT_NOWILD
))
iface
=
listener
->
iface
;
/* May be NULL */
else
{
int
if_index
;
char
intr_name
[
IF_NAMESIZE
];
/* if we can find the arrival interface, check it's one that's allowed */
if
((
if_index
=
tcp_interface
(
confd
,
tcp_addr
.
sa
.
sa_family
))
!=
0
&&
indextoname
(
listener
->
tcpfd
,
if_index
,
intr_name
))
{
struct
all_addr
addr
;
addr
.
addr
.
addr4
=
tcp_addr
.
in
.
sin_addr
;
#ifdef HAVE_IPV6
if
(
tcp_addr
.
sa
.
sa_family
==
AF_INET6
)
addr
.
addr
.
addr6
=
tcp_addr
.
in6
.
sin6_addr
;
if
(
tcp_addr
.
sa
.
sa_family
==
AF_INET6
)
addr
.
addr
.
addr6
=
tcp_addr
.
in6
.
sin6_addr
;
#endif
for
(
iface
=
daemon
->
interfaces
;
iface
;
iface
=
iface
->
next
)
if
(
iface
->
index
==
if_index
)
break
;
if
(
!
iface
&&
!
loopback_exception
(
listener
->
tcpfd
,
tcp_addr
.
sa
.
sa_family
,
&
addr
,
intr_name
))
client_ok
=
0
;
}
if
(
option_bool
(
OPT_CLEVERBIND
))
iface
=
listener
->
iface
;
/* May be NULL */
else
{
/* Check for allowed interfaces when binding the wildcard address:
we do this by looking for an interface with the same address as
the local address of the TCP connection, then looking to see if that's
an allowed interface. As a side effect, we get the netmask of the
interface too, for localisation. */
for
(
iface
=
daemon
->
interfaces
;
iface
;
iface
=
iface
->
next
)
if
(
sockaddr_isequal
(
&
iface
->
addr
,
&
tcp_addr
))
break
;
if
(
!
iface
)
client_ok
=
0
;
}
}
for
(
iface
=
daemon
->
interfaces
;
iface
;
iface
=
iface
->
next
)
if
(
iface
->
index
==
if_index
)
break
;
if
(
!
iface
&&
!
loopback_exception
(
listener
->
tcpfd
,
tcp_addr
.
sa
.
sa_family
,
&
addr
,
intr_name
))
client_ok
=
0
;
}
if
(
option_bool
(
OPT_CLEVERBIND
))
iface
=
listener
->
iface
;
/* May be NULL */
else
{
/* Check for allowed interfaces when binding the wildcard address:
we do this by looking for an interface with the same address as
the local address of the TCP connection, then looking to see if that's
an allowed interface. As a side effect, we get the netmask of the
interface too, for localisation. */
for
(
iface
=
daemon
->
interfaces
;
iface
;
iface
=
iface
->
next
)
if
(
sockaddr_isequal
(
&
iface
->
addr
,
&
tcp_addr
))
break
;
if
(
!
iface
)
client_ok
=
0
;
}
}
if
(
!
client_ok
)
{
shutdown
(
confd
,
SHUT_RDWR
);
...
...
src/network.c
View file @
76dd75de
...
...
@@ -438,7 +438,9 @@ int enumerate_interfaces(int reset)
struct
addrlist
*
addr
,
*
tmp
;
struct
interface_name
*
intname
;
/* DO this max once per select cycle */
/* Do this max once per select cycle - also inhibits netlink socket use
in TCP child processes. */
if
(
reset
)
{
done
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment