Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dhcp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
71
Issues
71
List
Boards
Labels
Service Desk
Milestones
Merge Requests
18
Merge Requests
18
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
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
ISC Open Source Projects
dhcp
Commits
8ae2d595
Commit
8ae2d595
authored
Feb 24, 1999
by
Ted Lemon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change names of error functions to be more consistent.
parent
c68d2a87
Changes
38
Hide whitespace changes
Inline
Side-by-side
Showing
38 changed files
with
623 additions
and
623 deletions
+623
-623
client/clparse.c
client/clparse.c
+19
-19
client/dhclient.c
client/dhclient.c
+59
-59
common/alloc.c
common/alloc.c
+13
-13
common/bpf.c
common/bpf.c
+15
-15
common/discover.c
common/discover.c
+18
-18
common/dispatch.c
common/dispatch.c
+6
-6
common/dlpi.c
common/dlpi.c
+17
-17
common/dns.c
common/dns.c
+8
-8
common/errwarn.c
common/errwarn.c
+6
-6
common/execute.c
common/execute.c
+10
-10
common/hash.c
common/hash.c
+2
-2
common/icmp.c
common/icmp.c
+7
-7
common/interact.c
common/interact.c
+11
-11
common/lpf.c
common/lpf.c
+7
-7
common/memory.c
common/memory.c
+19
-19
common/nit.c
common/nit.c
+14
-14
common/options.c
common/options.c
+19
-19
common/packet.c
common/packet.c
+11
-11
common/parse.c
common/parse.c
+36
-36
common/print.c
common/print.c
+24
-24
common/raw.c
common/raw.c
+6
-6
common/resolv.c
common/resolv.c
+5
-5
common/socket.c
common/socket.c
+9
-9
common/sysconf.c
common/sysconf.c
+9
-9
common/tables.c
common/tables.c
+4
-4
common/tree.c
common/tree.c
+56
-56
common/upf.c
common/upf.c
+12
-12
dhcpctl/dhcpctl.c
dhcpctl/dhcpctl.c
+6
-6
includes/dhcpd.h
includes/dhcpd.h
+4
-4
relay/dhcrelay.c
relay/dhcrelay.c
+23
-23
server/bootp.c
server/bootp.c
+9
-9
server/class.c
server/class.c
+11
-11
server/confpars.c
server/confpars.c
+26
-26
server/db.c
server/db.c
+9
-9
server/dhcp.c
server/dhcp.c
+68
-68
server/dhcpd.c
server/dhcpd.c
+20
-20
statmsg/main.c
statmsg/main.c
+9
-9
sysconfd/sysconfd.c
sysconfd/sysconfd.c
+16
-16
No files found.
client/clparse.c
View file @
8ae2d595
...
...
@@ -42,7 +42,7 @@
#ifndef lint
static
char
copyright
[]
=
"$Id: clparse.c,v 1.2
1 1998/11/11 07:48:23
mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.
\n
"
;
"$Id: clparse.c,v 1.2
2 1999/02/24 17:56:42
mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.
\n
"
;
#endif
/* not lint */
#include "dhcpd.h"
...
...
@@ -100,11 +100,11 @@ int read_client_conf ()
top_level_config
.
on_receipt
=
new_group
(
"read_client_conf"
);
if
(
!
top_level_config
.
on_receipt
)
error
(
"no memory for top-level on_receipt group"
);
log_fatal
(
"no memory for top-level on_receipt group"
);
top_level_config
.
on_transmission
=
new_group
(
"read_client_conf"
);
if
(
!
top_level_config
.
on_transmission
)
error
(
"no memory for top-level on_transmission group"
);
log_fatal
(
"no memory for top-level on_transmission group"
);
if
((
cfile
=
fopen
(
path_dhclient_conf
,
"r"
))
!=
NULL
)
{
do
{
...
...
@@ -127,7 +127,7 @@ int read_client_conf ()
ip
->
client
=
(
struct
client_state
*
)
malloc
(
sizeof
(
struct
client_state
));
if
(
!
ip
->
client
)
error
(
"no memory for client state."
);
log_fatal
(
"no memory for client state."
);
memset
(
ip
->
client
,
0
,
sizeof
*
(
ip
->
client
));
}
...
...
@@ -136,7 +136,7 @@ int read_client_conf ()
config
=
(
struct
client_config
*
)
malloc
(
sizeof
(
struct
client_config
));
if
(
!
config
)
error
(
"no memory for client config."
);
log_fatal
(
"no memory for client config."
);
memcpy
(
config
,
&
top_level_config
,
sizeof
top_level_config
);
}
...
...
@@ -168,7 +168,7 @@ void read_client_leases ()
if
(
token
==
EOF
)
break
;
if
(
token
!=
LEASE
)
{
warn
(
"Corrupt lease file - possible data loss!"
);
log_error
(
"Corrupt lease file - possible data loss!"
);
skip_to_semi
(
cfile
);
break
;
}
else
...
...
@@ -317,7 +317,7 @@ void parse_client_statement (cfile, ip, config)
token
=
next_token
(
&
val
,
cfile
);
name
=
dmalloc
(
strlen
(
val
)
+
1
,
"parse_client_statement"
);
if
(
!
name
)
error
(
"no memory for pseudo interface name"
);
log_fatal
(
"no memory for pseudo interface name"
);
strcpy
(
name
,
val
);
parse_interface_declaration
(
cfile
,
config
,
name
);
return
;
...
...
@@ -441,7 +441,7 @@ void parse_option_list (cfile, list)
}
r
=
new_pair
(
"parse_option_list"
);
if
(
!
r
)
error
(
"can't allocate pair for option code."
);
log_fatal
(
"can't allocate pair for option code."
);
r
->
car
=
(
caddr_t
)
i
;
r
->
cdr
=
(
pair
)
0
;
if
(
p
)
...
...
@@ -461,7 +461,7 @@ void parse_option_list (cfile, list)
dfree
(
*
list
,
"parse_option_list"
);
*
list
=
dmalloc
(
ix
*
sizeof
**
list
,
"parse_option_list"
);
if
(
!*
list
)
warn
(
"no memory for option list."
);
log_error
(
"no memory for option list."
);
else
{
ix
=
0
;
for
(
q
=
p
;
q
;
q
=
q
->
cdr
)
...
...
@@ -563,7 +563,7 @@ struct interface_info *interface_or_dummy (name)
if
(
!
ip
)
{
ip
=
((
struct
interface_info
*
)
malloc
(
sizeof
*
ip
));
if
(
!
ip
)
error
(
"Insufficient memory to record interface %s"
,
log_fatal
(
"Insufficient memory to record interface %s"
,
name
);
memset
(
ip
,
0
,
sizeof
*
ip
);
strcpy
(
ip
->
name
,
name
);
...
...
@@ -579,7 +579,7 @@ void make_client_state (state)
*
state
=
((
struct
client_state
*
)
dmalloc
(
sizeof
**
state
,
"make_client_state"
));
if
(
!*
state
)
error
(
"no memory for client state
\n
"
);
log_fatal
(
"no memory for client state
\n
"
);
memset
(
*
state
,
0
,
sizeof
**
state
);
}
...
...
@@ -591,7 +591,7 @@ void make_client_config (client, config)
dmalloc
(
sizeof
(
struct
client_config
),
"make_client_config"
)));
if
(
!
client
->
config
)
error
(
"no memory for client config
\n
"
);
log_fatal
(
"no memory for client config
\n
"
);
memcpy
(
client
->
config
,
config
,
sizeof
*
config
);
client
->
config
->
on_receipt
=
clone_group
(
config
->
on_receipt
,
"make_client_config"
);
...
...
@@ -627,7 +627,7 @@ void parse_client_lease_statement (cfile, is_static)
lease
=
(
struct
client_lease
*
)
malloc
(
sizeof
(
struct
client_lease
));
if
(
!
lease
)
error
(
"no memory for lease.
\n
"
);
log_fatal
(
"no memory for lease.
\n
"
);
memset
(
lease
,
0
,
sizeof
*
lease
);
lease
->
is_static
=
is_static
;
...
...
@@ -960,7 +960,7 @@ int parse_option_decl (oc, cfile)
goto
alloc
;
default:
warn
(
"Bad format %c in parse_option_param."
,
log_error
(
"Bad format %c in parse_option_param."
,
*
fmt
);
skip_to_semi
(
cfile
);
return
0
;
...
...
@@ -977,13 +977,13 @@ int parse_option_decl (oc, cfile)
bp
=
(
struct
buffer
*
)
0
;
if
(
!
buffer_allocate
(
&
bp
,
hunkix
+
nul_term
,
"parse_option_decl"
))
error
(
"no memory to store option declaration."
);
log_fatal
(
"no memory to store option declaration."
);
if
(
!
bp
->
data
)
error
(
"out of memory allocating option data."
);
log_fatal
(
"out of memory allocating option data."
);
memcpy
(
bp
->
data
,
hunkbuf
,
hunkix
+
nul_term
);
if
(
!
option_cache_allocate
(
oc
,
"parse_option_decl"
))
error
(
"out of memory allocating option cache."
);
log_fatal
(
"out of memory allocating option cache."
);
(
*
oc
)
->
data
.
buffer
=
bp
;
(
*
oc
)
->
data
.
data
=
&
bp
->
data
[
0
];
...
...
@@ -1022,7 +1022,7 @@ void parse_string_list (cfile, lp, multiple)
sizeof
(
struct
string_list
*
));
if
(
!
tmp
)
error
(
"no memory for string list entry."
);
log_fatal
(
"no memory for string list entry."
);
strcpy
(
tmp
->
string
,
val
);
tmp
->
next
=
(
struct
string_list
*
)
0
;
...
...
@@ -1061,7 +1061,7 @@ void parse_reject_statement (cfile, config)
list
=
(
struct
iaddrlist
*
)
malloc
(
sizeof
(
struct
iaddrlist
));
if
(
!
list
)
error
(
"no memory for reject list!"
);
log_fatal
(
"no memory for reject list!"
);
list
->
addr
=
addr
;
list
->
next
=
config
->
reject_list
;
...
...
client/dhclient.c
View file @
8ae2d595
...
...
@@ -56,7 +56,7 @@
#ifndef lint
static
char
ocopyright
[]
=
"$Id: dhclient.c,v 1.5
5 1999/02/14 19:40:20
mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.
\n
"
;
"$Id: dhclient.c,v 1.5
6 1999/02/24 17:56:42
mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.
\n
"
;
#endif
/* not lint */
#include "dhcpd.h"
...
...
@@ -127,7 +127,7 @@ int main (argc, argv, envp)
if
(
++
i
==
argc
)
usage
();
local_port
=
htons
(
atoi
(
argv
[
i
]));
debug
(
"binding to user-specified port %d"
,
log_
debug
(
"binding to user-specified port %d"
,
ntohs
(
local_port
));
}
else
if
(
!
strcmp
(
argv
[
i
],
"-d"
))
{
no_daemon
=
1
;
...
...
@@ -155,7 +155,7 @@ int main (argc, argv, envp)
((
struct
interface_info
*
)
dmalloc
(
sizeof
*
tmp
,
"specified_interface"
));
if
(
!
tmp
)
error
(
"Insufficient memory to %s %s"
,
log_fatal
(
"Insufficient memory to %s %s"
,
"record interface"
,
argv
[
i
]);
memset
(
tmp
,
0
,
sizeof
*
tmp
);
strcpy
(
tmp
->
name
,
argv
[
i
]);
...
...
@@ -167,11 +167,11 @@ int main (argc, argv, envp)
}
if
(
!
quiet
)
{
note
(
message
);
note
(
copyright
);
note
(
arr
);
note
(
contrib
);
note
(
url
);
log_info
(
message
);
log_info
(
copyright
);
log_info
(
arr
);
log_info
(
contrib
);
log_info
(
url
);
}
/* Default to the DHCP/BOOTP port. */
...
...
@@ -217,7 +217,7 @@ int main (argc, argv, envp)
(
struct
string_list
*
)
0
);
script_go
((
struct
client_state
*
)
0
);
note
(
"No broadcast interfaces found - exiting."
);
log_info
(
"No broadcast interfaces found - exiting."
);
/* Nothing more to do. */
exit
(
0
);
...
...
@@ -286,7 +286,7 @@ int main (argc, argv, envp)
static
void
usage
()
{
error
(
"Usage: dhclient [-d] [-D] [-q] [-c] [-p <port>]
\n
[-lf %s"
,
log_fatal
(
"Usage: dhclient [-d] [-D] [-q] [-c] [-p <port>]
\n
[-lf %s"
,
"lease-file] [-pf pid-file] [-cf config-file] [interface]"
);
}
...
...
@@ -521,7 +521,7 @@ void dhcpack (packet)
packet
->
raw
->
hlen
)
||
(
memcmp
(
packet
->
interface
->
hw_address
.
haddr
,
packet
->
raw
->
chaddr
,
packet
->
raw
->
hlen
)))
{
debug
(
"DHCPACK in wrong transaction."
);
log_
debug
(
"DHCPACK in wrong transaction."
);
return
;
}
...
...
@@ -529,15 +529,15 @@ void dhcpack (packet)
client
->
state
!=
S_REQUESTING
&&
client
->
state
!=
S_RENEWING
&&
client
->
state
!=
S_REBINDING
)
{
debug
(
"DHCPACK in wrong state."
);
log_
debug
(
"DHCPACK in wrong state."
);
return
;
}
note
(
"DHCPACK from %s"
,
piaddr
(
packet
->
client_addr
));
log_info
(
"DHCPACK from %s"
,
piaddr
(
packet
->
client_addr
));
lease
=
packet_to_lease
(
packet
);
if
(
!
lease
)
{
note
(
"packet_to_lease failed."
);
log_info
(
"packet_to_lease failed."
);
return
;
}
...
...
@@ -562,7 +562,7 @@ void dhcpack (packet)
client
->
new
->
expiry
=
0
;
if
(
!
client
->
new
->
expiry
)
{
warn
(
"no expiry time on offered lease."
);
log_error
(
"no expiry time on offered lease."
);
/* XXX this is going to be bad - if this _does_
XXX happen, we should probably dynamically
XXX disqualify the DHCP server that gave us the
...
...
@@ -665,7 +665,7 @@ void bind_lease (client)
add_timeout
(
client
->
active
->
renewal
,
state_bound
,
client
);
note
(
"bound to %s -- renewal in %d seconds."
,
log_info
(
"bound to %s -- renewal in %d seconds."
,
piaddr
(
client
->
active
->
address
),
client
->
active
->
renewal
-
cur_time
);
client
->
state
=
S_BOUND
;
...
...
@@ -742,7 +742,7 @@ void bootp (packet)
for
(
ap
=
packet
->
interface
->
client
->
config
->
reject_list
;
ap
;
ap
=
ap
->
next
)
{
if
(
addr_eq
(
packet
->
client_addr
,
ap
->
addr
))
{
note
(
"BOOTREPLY from %s rejected."
,
log_info
(
"BOOTREPLY from %s rejected."
,
piaddr
(
ap
->
addr
));
return
;
}
...
...
@@ -784,7 +784,7 @@ void dhcp (packet)
for
(
ap
=
packet
->
interface
->
client
->
config
->
reject_list
;
ap
;
ap
=
ap
->
next
)
{
if
(
addr_eq
(
packet
->
client_addr
,
ap
->
addr
))
{
note
(
"%s from %s rejected."
,
log_info
(
"%s from %s rejected."
,
type
,
piaddr
(
ap
->
addr
));
return
;
}
...
...
@@ -821,11 +821,11 @@ void dhcpoffer (packet)
packet
->
raw
->
hlen
)
||
(
memcmp
(
packet
->
interface
->
hw_address
.
haddr
,
packet
->
raw
->
chaddr
,
packet
->
raw
->
hlen
)))
{
debug
(
"%s in wrong transaction."
,
name
);
log_
debug
(
"%s in wrong transaction."
,
name
);
return
;
}
note
(
"%s from %s"
,
name
,
piaddr
(
packet
->
client_addr
));
log_info
(
"%s from %s"
,
name
,
piaddr
(
packet
->
client_addr
));
/* If this lease doesn't supply the minimum required parameters,
...
...
@@ -835,7 +835,7 @@ void dhcpoffer (packet)
if
(
!
lookup_option
(
packet
->
options
.
dhcp_hash
,
client
->
config
->
required_options
[
i
]))
{
note
(
"%s isn't satisfactory."
,
name
);
log_info
(
"%s isn't satisfactory."
,
name
);
return
;
}
}
...
...
@@ -846,14 +846,14 @@ void dhcpoffer (packet)
if
(
lease
->
address
.
len
==
sizeof
packet
->
raw
->
yiaddr
&&
!
memcmp
(
lease
->
address
.
iabuf
,
&
packet
->
raw
->
yiaddr
,
lease
->
address
.
len
))
{
debug
(
"%s already seen."
,
name
);
log_
debug
(
"%s already seen."
,
name
);
return
;
}
}
lease
=
packet_to_lease
(
packet
);
if
(
!
lease
)
{
note
(
"packet_to_lease failed."
);
log_info
(
"packet_to_lease failed."
);
return
;
}
...
...
@@ -939,7 +939,7 @@ struct client_lease *packet_to_lease (packet)
lease
=
(
struct
client_lease
*
)
new_client_lease
(
"packet_to_lease"
);
if
(
!
lease
)
{
warn
(
"dhcpoffer: no memory to record lease.
\n
"
);
log_error
(
"dhcpoffer: no memory to record lease.
\n
"
);
return
(
struct
client_lease
*
)
0
;
}
...
...
@@ -976,7 +976,7 @@ struct client_lease *packet_to_lease (packet)
break
;
lease
->
server_name
=
dmalloc
(
len
+
1
,
"packet_to_lease"
);
if
(
!
lease
->
server_name
)
{
warn
(
"dhcpoffer: no memory for filename.
\n
"
);
log_error
(
"dhcpoffer: no memory for filename.
\n
"
);
destroy_client_lease
(
lease
);
return
(
struct
client_lease
*
)
0
;
}
else
{
...
...
@@ -995,7 +995,7 @@ struct client_lease *packet_to_lease (packet)
break
;
lease
->
filename
=
dmalloc
(
len
+
1
,
"packet_to_lease"
);
if
(
!
lease
->
filename
)
{
warn
(
"dhcpoffer: no memory for filename.
\n
"
);
log_error
(
"dhcpoffer: no memory for filename.
\n
"
);
destroy_client_lease
(
lease
);
return
(
struct
client_lease
*
)
0
;
}
else
{
...
...
@@ -1025,7 +1025,7 @@ void dhcpnak (packet)
packet
->
raw
->
hlen
)
||
(
memcmp
(
packet
->
interface
->
hw_address
.
haddr
,
packet
->
raw
->
chaddr
,
packet
->
raw
->
hlen
)))
{
debug
(
"DHCPNAK in wrong transaction."
);
log_
debug
(
"DHCPNAK in wrong transaction."
);
return
;
}
...
...
@@ -1033,14 +1033,14 @@ void dhcpnak (packet)
client
->
state
!=
S_REQUESTING
&&
client
->
state
!=
S_RENEWING
&&
client
->
state
!=
S_REBINDING
)
{
debug
(
"DHCPNAK in wrong state."
);
log_
debug
(
"DHCPNAK in wrong state."
);
return
;
}
note
(
"DHCPNAK from %s"
,
piaddr
(
packet
->
client_addr
));
log_info
(
"DHCPNAK from %s"
,
piaddr
(
packet
->
client_addr
));
if
(
!
client
->
active
)
{
note
(
"DHCPNAK with no active lease.
\n
"
);
log_info
(
"DHCPNAK with no active lease.
\n
"
);
return
;
}
...
...
@@ -1090,14 +1090,14 @@ void send_discover (cpp)
}
if
(
!
client
->
medium
)
{
if
(
fail
)
error
(
"No valid media types for %s!"
,
log_fatal
(
"No valid media types for %s!"
,
client
->
interface
->
name
);
client
->
medium
=
client
->
config
->
media
;
increase
=
1
;
}
note
(
"Trying medium
\"
%s
\"
%d"
,
log_info
(
"Trying medium
\"
%s
\"
%d"
,
client
->
medium
->
string
,
increase
);
script_init
(
client
,
"MEDIUM"
,
client
->
medium
);
if
(
script_go
(
client
))
{
...
...
@@ -1144,7 +1144,7 @@ void send_discover (cpp)
else
client
->
packet
.
secs
=
255
;
note
(
"DHCPDISCOVER on %s to %s port %d interval %ld"
,
log_info
(
"DHCPDISCOVER on %s to %s port %d interval %ld"
,
client
->
name
?
client
->
name
:
client
->
interface
->
name
,
inet_ntoa
(
sockaddr_broadcast
.
sin_addr
),
ntohs
(
sockaddr_broadcast
.
sin_port
),
client
->
interval
);
...
...
@@ -1156,7 +1156,7 @@ void send_discover (cpp)
inaddr_any
,
&
sockaddr_broadcast
,
(
struct
hardware
*
)
0
);
if
(
result
<
0
)
warn
(
"send_packet: %m"
);
log_error
(
"send_packet: %m"
);
add_timeout
(
cur_time
+
client
->
interval
,
send_discover
,
client
);
}
...
...
@@ -1175,7 +1175,7 @@ void state_panic (cpp)
loop
=
lp
=
client
->
active
;
note
(
"No DHCPOFFERS received."
);
log_info
(
"No DHCPOFFERS received."
);
/* We may not have an active lease, but we may have some
predefined leases that we can try. */
...
...
@@ -1185,7 +1185,7 @@ void state_panic (cpp)
/* Run through the list of leases and see if one can be used. */
while
(
client
->
active
)
{
if
(
client
->
active
->
expiry
>
cur_time
)
{
note
(
"Trying recorded lease %s"
,
log_info
(
"Trying recorded lease %s"
,
piaddr
(
client
->
active
->
address
));
/* Run the client script with the existing
parameters. */
...
...
@@ -1203,7 +1203,7 @@ void state_panic (cpp)
if
(
cur_time
<
client
->
active
->
renewal
)
{
client
->
state
=
S_BOUND
;
note
(
"bound: renewal in %d seconds."
,
log_info
(
"bound: renewal in %d seconds."
,
client
->
active
->
renewal
-
cur_time
);
add_timeout
((
client
->
...
...
@@ -1211,7 +1211,7 @@ void state_panic (cpp)
state_bound
,
client
);
}
else
{
client
->
state
=
S_BOUND
;
note
(
"bound: immediate renewal."
);
log_info
(
"bound: immediate renewal."
);
state_bound
(
client
);
}
reinitialize_interfaces
();
...
...
@@ -1251,7 +1251,7 @@ void state_panic (cpp)
/* No leases were available, or what was available didn't work, so
tell the shell script that we failed to allocate an address,
and try again later. */
note
(
"No working leases in persistent database - sleeping.
\n
"
);
log_info
(
"No working leases in persistent database - sleeping.
\n
"
);
script_init
(
client
,
"FAIL"
,
(
struct
string_list
*
)
0
);
if
(
client
->
alias
)
script_write_params
(
client
,
"alias_"
,
client
->
alias
);
...
...
@@ -1385,7 +1385,7 @@ void send_request (cpp)
else
client
->
packet
.
secs
=
255
;
note
(
"DHCPREQUEST on %s to %s port %d"
,
log_info
(
"DHCPREQUEST on %s to %s port %d"
,
client
->
name
?
client
->
name
:
client
->
interface
->
name
,
inet_ntoa
(
destination
.
sin_addr
),
ntohs
(
destination
.
sin_port
));
...
...
@@ -1407,7 +1407,7 @@ void send_request (cpp)
(
struct
hardware
*
)
0
);
if
(
result
<
0
)
warn
(
"send_packet: %m"
);
log_error
(
"send_packet: %m"
);
add_timeout
(
cur_time
+
client
->
interval
,
send_request
,
client
);
...
...
@@ -1420,7 +1420,7 @@ void send_decline (cpp)
int
result
;
note
(
"DHCPDECLINE on %s to %s port %d"
,
log_info
(
"DHCPDECLINE on %s to %s port %d"
,
client
->
name
?
client
->
name
:
client
->
interface
->
name
,
inet_ntoa
(
sockaddr_broadcast
.
sin_addr
),
ntohs
(
sockaddr_broadcast
.
sin_port
));
...
...
@@ -1432,7 +1432,7 @@ void send_decline (cpp)
inaddr_any
,
&
sockaddr_broadcast
,
(
struct
hardware
*
)
0
);
if
(
result
<
0
)
warn
(
"send_packet: %m"
);
log_error
(
"send_packet: %m"
);
}
void
send_release
(
cpp
)
...
...
@@ -1442,7 +1442,7 @@ void send_release (cpp)
int
result
;
note
(
"DHCPRELEASE on %s to %s port %d"
,
log_info
(
"DHCPRELEASE on %s to %s port %d"
,
client
->
name
?
client
->
name
:
client
->
interface
->
name
,
inet_ntoa
(
sockaddr_broadcast
.
sin_addr
),
ntohs
(
sockaddr_broadcast
.
sin_port
));
...
...
@@ -1454,7 +1454,7 @@ void send_release (cpp)
inaddr_any
,
&
sockaddr_broadcast
,
(
struct
hardware
*
)
0
);
if
(
result
<
0
)
warn
(
"send_packet: %m"
);
log_error
(
"send_packet: %m"
);
}
void
make_client_options
(
client
,
lease
,
type
,
sid
,
rip
,
prl
,
...
...
@@ -1487,7 +1487,7 @@ void make_client_options (client, lease, type, sid, rip, prl,
rip
->
iabuf
,
rip
->
len
,
&
dhcp_options
[
DHO_DHCP_REQUESTED_ADDRESS
],
"make_client_options"
)))
warn
(
"can't make requested address option cache."
);
log_error
(
"can't make requested address option cache."
);
else
{
save_option
(
options
->
dhcp_hash
,
oc
);
option_cache_dereference
(
&
oc
,
"make_client_options"
);
...
...
@@ -1500,7 +1500,7 @@ void make_client_options (client, lease, type, sid, rip, prl,
(
&
oc
,
(
struct
buffer
**
)
0
,
type
,
1
,
&
dhcp_options
[
DHO_DHCP_MESSAGE_TYPE
],
"make_client_options"
)))
warn
(
"can't make message type."
);
log_error
(
"can't make message type."
);
else
{
save_option
(
options
->
dhcp_hash
,
oc
);
option_cache_dereference
(
&
oc
,
"make_client_options"
);
...
...
@@ -1511,7 +1511,7 @@ void make_client_options (client, lease, type, sid, rip, prl,
for
(
i
=
0
;
prl
[
i
];
i
++
)
;
if
(
!
buffer_allocate
(
&
bp
,
i
,
"make_client_options"
))
warn
(
"can't make buffer for parameter request list."
);
log_error
(
"can't make buffer for parameter request list."
);
else
{
for
(
i
=
0
;
prl
[
i
];
i
++
)
bp
->
data
[
i
]
=
prl
[
i
];
...
...
@@ -1519,7 +1519,7 @@ void make_client_options (client, lease, type, sid, rip, prl,
(
&
oc
,
&
bp
,
(
u_int8_t
*
)
0
,
i
,
&
dhcp_options
[
DHO_DHCP_PARAMETER_REQUEST_LIST
],
"make_client_options"
)))
warn
(
"can't make option cache"
);
log_error
(
"can't make option cache"
);
else
{
save_option
(
options
->
dhcp_hash
,
oc
);
option_cache_dereference
...
...
@@ -1532,7 +1532,7 @@ void make_client_options (client, lease, type, sid, rip, prl,
DHO_DHCP_LEASE_TIME
)))
{
if
(
!
buffer_allocate
(
&
bp
,
sizeof
(
u_int32_t
),
"make_client_options"
))
warn
(
"can't make buffer for requested lease time."
);
log_error
(
"can't make buffer for requested lease time."
);
else
{
putULong
(
bp
->
data
,
client
->
config
->
requested_lease
);
...
...
@@ -1540,7 +1540,7 @@ void make_client_options (client, lease, type, sid, rip, prl,
(
&
oc
,
&
bp
,
(
u_int8_t
*
)
0
,
sizeof
(
u_int32_t
),
&
dhcp_options
[
DHO_DHCP_LEASE_TIME
],
"make_client_options"
)))
warn
(
"can't make option cache"
);
log_error
(
"can't make option cache"
);
else
{
save_option
(
options
->
dhcp_hash
,
oc
);
option_cache_dereference
...
...
@@ -1807,7 +1807,7 @@ void rewrite_client_leases ()
fclose
(
leaseFile
);
leaseFile
=
fopen
(
path_dhclient_db
,
"w"
);
if
(
!
leaseFile
)
error
(
"can't create %s: %m"
,
path_dhclient_db
);
log_fatal
(
"can't create %s: %m"
,
path_dhclient_db
);
/* Write out all the leases attached to configured interfaces that
we know about. */
...
...
@@ -1863,7 +1863,7 @@ void write_client_lease (client, lease, rewrite)
if
(
!
leaseFile
)
{
/* XXX */
leaseFile
=
fopen
(
path_dhclient_db
,
"w"
);
if
(
!
leaseFile
)
error
(
"can't create %s: %m"
,
path_dhclient_db
);
log_fatal
(
"can't create %s: %m"
,
path_dhclient_db
);
}
fprintf
(
leaseFile
,
"lease {
\n
"
);
...
...
@@ -1950,7 +1950,7 @@ void script_init (client, reason, medium)
fd
=
mkstemp
(
scriptName
);
#else
if
(
!
mktemp
(
scriptName
))
error
(
"can't create temporary client script %s: %m"
,
log_fatal
(
"can't create temporary client script %s: %m"
,
scriptName
);
fd
=
creat
(
scriptName
,
0600
);
}
while
(
fd
<
0
);
...
...
@@ -1958,7 +1958,7 @@ void script_init (client, reason, medium)
scriptFile
=
fdopen
(
fd
,
"w"
);
if
(
!
scriptFile
)
error
(
"can't write script file: %m"
);
log_fatal
(
"can't write script file: %m"
);
fprintf
(
scriptFile
,
"#!/bin/sh
\n\n
"
);
if
(
client
)
{
if
(
client
->
interface
)
{
...
...
@@ -2119,7 +2119,7 @@ char *dhcp_option_ev_name (option)
int
i
;
if
(
strlen
(
option
->
name
)
+
1
>
sizeof
evbuf
)
error
(
"option %s name is larger than static buffer."
);
log_fatal
(
"option %s name is larger than static buffer."
);
for
(
i
=
0
;
option
->
name
[
i
];
i
++
)
{
if
(
option
->
name
[
i
]
==
'-'
)
evbuf
[
i
]
=
'_'
;
...
...
@@ -2152,7 +2152,7 @@ void go_daemon ()
/* Become a daemon... */
if
((
pid
=
fork
())
<
0
)
error
(
"Can't fork daemon: %m"
);
log_fatal
(
"Can't fork daemon: %m"
);
else
if
(
pid
)
exit
(
0
);
/* Become session leader and get pid... */
...
...
@@ -2174,13 +2174,13 @@ void write_client_pid_file ()
pfdesc
=
open
(
path_dhclient_pid
,
O_CREAT
|
O_TRUNC
|
O_WRONLY
,
0644
);
if
(
pfdesc
<
0
)
{
warn
(
"Can't create %s: %m"
,
path_dhclient_pid
);
log_error
(
"Can't create %s: %m"
,
path_dhclient_pid
);
return
;
}
pf
=
fdopen
(
pfdesc
,
"w"
);
if
(
!
pf
)
warn
(
"Can't fdopen %s: %m"
,
path_dhclient_pid
);
log_error
(
"Can't fdopen %s: %m"
,
path_dhclient_pid
);
else
{
fprintf
(
pf
,
"%ld
\n
"
,
(
long
)
getpid
());
fclose
(
pf
);
...
...
common/alloc.c
View file @
8ae2d595
...
...
@@ -42,7 +42,7 @@
#ifndef lint
static
char
copyright
[]
=
"$Id: alloc.c,v 1.2
2 1999/02/23 19:04:25
mellon Exp $ Copyright (c) 1995, 1996, 1998 The Internet Software Consortium. All rights reserved.
\n
"
;
"$Id: alloc.c,v 1.2
3 1999/02/24 17:56:43
mellon Exp $ Copyright (c) 1995, 1996, 1998 The Internet Software Consortium. All rights reserved.
\n
"
;
#endif
/* not lint */
#include "dhcpd.h"
...
...
@@ -56,7 +56,7 @@ VOIDPTR dmalloc (size, name)
{
VOIDPTR
foo
=
(
VOIDPTR
)
malloc
(
size
);
if
(
!
foo
)
warn
(
"No memory for %s."
,
name
);
log_error
(
"No memory for %s."
,
name
);
else
memset
(
foo
,
0
,
size
);
return
foo
;
...
...
@@ -67,7 +67,7 @@ void dfree (ptr, name)
char
*
name
;
{
if
(
!
ptr
)
{