Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
gaoxingwang
dhcp
Commits
4ad524bd
Commit
4ad524bd
authored
Jan 10, 2020
by
Thomas Markwalder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[#75] Added target interface name to socket init failure logs
modified: RELNOTES common/socket.c
parent
5c23b618
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
11 deletions
+21
-11
RELNOTES
RELNOTES
+6
-1
common/socket.c
common/socket.c
+15
-10
No files found.
RELNOTES
View file @
4ad524bd
...
...
@@ -104,7 +104,7 @@ ISC DHCP is open source software maintained by Internet Systems
Consortium
.
This
product
includes
cryptographic
software
written
by
Eric
Young
(
eay
@
cryptsoft
.
com
).
Changes
since
4.4.2
b1
Changes
since
4.4.2
b1
(
Bug
Fixes
)
-
Added
a
clarification
on
DHCPINFORMs
and
server
authority
to
dhcpd
.
conf
.5
...
...
@@ -114,6 +114,11 @@ by Eric Young (eay@cryptsoft.com).
is
defined
.
[
Gitlab
#
72
]
-
Added
the
interface
name
to
socket
initialization
failure
log
messages
.
Prior
to
this
the
log
messages
stated
only
the
error
reason
without
stating
the
target
interface
.
[
Gitlab
#
75
]
Changes
since
4.4.1
(
New
Features
)
-
A
new
configuration
parameter
,
ping
-
cltt
-
secs
(
v4
operation
only
),
has
...
...
common/socket.c
View file @
4ad524bd
...
...
@@ -3,7 +3,7 @@
BSD socket interface code... */
/*
* Copyright (c) 2004-20
19
by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004-20
20
by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium
*
* This Source Code Form is subject to the terms of the Mozilla Public
...
...
@@ -211,7 +211,7 @@ if_register_socket(struct interface_info *info, int family,
/* Make a socket... */
sock
=
socket
(
domain
,
SOCK_DGRAM
,
IPPROTO_UDP
);
if
(
sock
<
0
)
{
log_fatal
(
"Can't create dhcp socket
: %m"
);
log_fatal
(
"Can't create dhcp socket
for %s: %m"
,
info
->
name
);
}
/* Set the REUSEADDR option so that we don't fail to start if
...
...
@@ -219,7 +219,8 @@ if_register_socket(struct interface_info *info, int family,
flag
=
1
;
if
(
setsockopt
(
sock
,
SOL_SOCKET
,
SO_REUSEADDR
,
(
char
*
)
&
flag
,
sizeof
(
flag
))
<
0
)
{
log_fatal
(
"Can't set SO_REUSEADDR option on dhcp socket: %m"
);
log_fatal
(
"Can't set SO_REUSEADDR on dhcp socket for"
" %s: %m"
,
info
->
name
);
}
/* Set the BROADCAST option so that we can broadcast DHCP responses.
...
...
@@ -228,7 +229,8 @@ if_register_socket(struct interface_info *info, int family,
if
(
info
->
ifp
&&
(
setsockopt
(
sock
,
SOL_SOCKET
,
SO_BROADCAST
,
(
char
*
)
&
flag
,
sizeof
(
flag
))
<
0
))
{
log_fatal
(
"Can't set SO_BROADCAST option on dhcp socket: %m"
);
log_fatal
(
"Can't set SO_BROADCAST on dhcp socket for"
" %s: %m"
,
info
->
name
);
}
#if defined(DHCPv6) && defined(SO_REUSEPORT)
...
...
@@ -246,8 +248,8 @@ if_register_socket(struct interface_info *info, int family,
if
((
setsockopt
(
sock
,
SOL_SOCKET
,
SO_REUSEPORT
,
(
char
*
)
&
flag
,
sizeof
(
flag
))
<
0
)
&&
(
errno
!=
ENOPROTOOPT
))
{
log_fatal
(
"Can't set SO_REUSEPORT o
ption o
n dhcp "
"
socket: %m"
);
log_fatal
(
"Can't set SO_REUSEPORT on dhcp
socket for
"
"
%s: %m"
,
info
->
name
);
}
}
#endif
...
...
@@ -266,8 +268,9 @@ if_register_socket(struct interface_info *info, int family,
/* Bind this socket to this interface. */
if
((
local_family
!=
AF_INET6
)
&&
(
info
->
ifp
!=
NULL
)
&&
setsockopt
(
sock
,
SOL_SOCKET
,
SO_BINDTODEVICE
,
(
char
*
)(
info
->
ifp
),
sizeof
(
*
(
info
->
ifp
)))
<
0
)
{
log_fatal
(
"setsockopt: SO_BINDTODEVICE: %m"
);
(
char
*
)(
info
->
ifp
),
sizeof
(
*
(
info
->
ifp
)))
<
0
)
{
log_fatal
(
"Can't set SO_BINDTODEVICE on dhcp socket for"
" %s : %m"
,
(
char
*
)(
info
->
ifp
));
}
#endif
...
...
@@ -282,7 +285,8 @@ if_register_socket(struct interface_info *info, int family,
if
(
info
->
address_count
&&
setsockopt
(
sock
,
IPPROTO_IP
,
IP_BROADCAST_IF
,
&
info
->
addresses
[
0
],
sizeof
(
info
->
addresses
[
0
]))
<
0
)
log_fatal
(
"Can't set IP_BROADCAST_IF on dhcp socket: %m"
);
log_fatal
(
"Can't set IP_BROADCAST_IF on dhcp socket for"
" %s: %m"
,
info
->
name
);
#endif
#if defined(IP_PKTINFO) && defined(IP_RECVPKTINFO) && defined(USE_V4_PKTINFO)
...
...
@@ -294,7 +298,8 @@ if_register_socket(struct interface_info *info, int family,
int
on
=
1
;
if
(
setsockopt
(
sock
,
IPPROTO_IP
,
IP_RECVPKTINFO
,
&
on
,
sizeof
(
on
))
!=
0
)
{
log_fatal
(
"setsockopt: IPV_RECVPKTINFO: %m"
);
log_fatal
(
"Can't set IP_RECVPTKINFO on dhcp socket for"
" %s: %m"
,
info
->
name
);
}
}
#endif
...
...
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