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
baf553db
Commit
baf553db
authored
Jan 29, 2018
by
Simon Kelley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Default min-port to 1024 to avoid reserved ports.
parent
486bcd5a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
5 additions
and
8 deletions
+5
-8
man/dnsmasq.8
man/dnsmasq.8
+2
-1
src/dns-protocol.h
src/dns-protocol.h
+1
-0
src/dnsmasq.c
src/dnsmasq.c
+0
-3
src/network.c
src/network.c
+1
-4
src/option.c
src/option.c
+1
-0
No files found.
man/dnsmasq.8
View file @
baf553db
...
...
@@ -182,7 +182,8 @@ OS: this was the default behaviour in versions prior to 2.43.
Do not use ports less than that given as source for outbound DNS
queries. Dnsmasq picks random ports as source for outbound queries:
when this option is given, the ports used will always to larger
than that specified. Useful for systems behind firewalls.
than that specified. Useful for systems behind firewalls. If not specified,
defaults to 1024.
.TP
.B --max-port=<port>
Use ports lower than that given as source for outbound DNS queries.
...
...
src/dns-protocol.h
View file @
baf553db
...
...
@@ -16,6 +16,7 @@
#define NAMESERVER_PORT 53
#define TFTP_PORT 69
#define MIN_PORT 1024
/* first non-reserved port */
#define MAX_PORT 65535u
#define IN6ADDRSZ 16
...
...
src/dnsmasq.c
View file @
baf553db
...
...
@@ -224,9 +224,6 @@ int main (int argc, char **argv)
die
(
_
(
"loop detection not available: set HAVE_LOOP in src/config.h"
),
NULL
,
EC_BADCONF
);
#endif
if
(
daemon
->
max_port
!=
MAX_PORT
&&
daemon
->
min_port
==
0
)
daemon
->
min_port
=
1024u
;
if
(
daemon
->
max_port
<
daemon
->
min_port
)
die
(
_
(
"max_port cannot be smaller than min_port"
),
NULL
,
EC_BADCONF
);
...
...
src/network.c
View file @
baf553db
...
...
@@ -1149,10 +1149,7 @@ int random_sock(int family)
if
(
fix_fd
(
fd
))
while
(
tries
--
)
{
unsigned
short
port
=
rand16
();
if
(
daemon
->
min_port
!=
0
||
daemon
->
max_port
!=
MAX_PORT
)
port
=
htons
(
daemon
->
min_port
+
(
port
%
((
unsigned
short
)
ports_avail
)));
unsigned
short
port
=
htons
(
daemon
->
min_port
+
(
rand16
()
%
((
unsigned
short
)
ports_avail
)));
if
(
family
==
AF_INET
)
{
...
...
src/option.c
View file @
baf553db
...
...
@@ -4653,6 +4653,7 @@ void read_opts(int argc, char **argv, char *compile_opts)
daemon
->
soa_retry
=
SOA_RETRY
;
daemon
->
soa_expiry
=
SOA_EXPIRY
;
daemon
->
max_port
=
MAX_PORT
;
daemon
->
min_port
=
MIN_PORT
;
#ifndef NO_ID
add_txt
(
"version.bind"
,
"dnsmasq-"
VERSION
,
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