diff --git a/client/clparse.c b/client/clparse.c index 63143549..b0b63188 100644 --- a/client/clparse.c +++ b/client/clparse.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: clparse.c,v 1.21 1998/11/11 07:48:23 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n"; +"$Id: clparse.c,v 1.22 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; diff --git a/client/dhclient.c b/client/dhclient.c index e9a6c2d9..9e5577c5 100644 --- a/client/dhclient.c +++ b/client/dhclient.c @@ -56,7 +56,7 @@ #ifndef lint static char ocopyright[] = -"$Id: dhclient.c,v 1.55 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.56 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 ]\n [-lf %s", + log_fatal ("Usage: dhclient [-d] [-D] [-q] [-c] [-p ]\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); diff --git a/common/alloc.c b/common/alloc.c index 62065b07..611853f6 100644 --- a/common/alloc.c +++ b/common/alloc.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: alloc.c,v 1.22 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.23 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) { - warn ("dfree %s: free on null pointer.", name); + log_error ("dfree %s: free on null pointer.", name); return; } free (ptr); @@ -425,11 +425,11 @@ int expression_reference (ptr, src, name) char *name; { if (!ptr) { - warn ("Null pointer in expression_reference: %s", name); + log_error ("Null pointer in expression_reference: %s", name); abort (); } if (*ptr) { - warn ("Non-null pointer in expression_reference (%s)", + log_error ("Non-null pointer in expression_reference (%s)", name); abort (); } @@ -465,11 +465,11 @@ int option_cache_reference (ptr, src, name) char *name; { if (!ptr) { - warn ("Null pointer in option_cache_reference: %s", name); + log_error ("Null pointer in option_cache_reference: %s", name); abort (); } if (*ptr) { - warn ("Non-null pointer in option_cache_reference (%s)", + log_error ("Non-null pointer in option_cache_reference (%s)", name); abort (); } @@ -499,11 +499,11 @@ int buffer_reference (ptr, bp, name) char *name; { if (!ptr) { - warn ("Null pointer passed to buffer_reference: %s", name); + log_error ("Null pointer passed to buffer_reference: %s", name); abort (); } if (*ptr) { - warn ("Non-null pointer in buffer_reference (%s)", name); + log_error ("Non-null pointer in buffer_reference (%s)", name); abort (); } *ptr = bp; @@ -518,7 +518,7 @@ int buffer_dereference (ptr, name) struct buffer *bp; if (!ptr || !*ptr) { - warn ("Null pointer passed to buffer_dereference: %s", name); + log_error ("Null pointer passed to buffer_dereference: %s", name); abort (); } @@ -551,11 +551,11 @@ int dns_host_entry_reference (ptr, bp, name) char *name; { if (!ptr) { - warn ("Null pointer in dns_host_entry_reference: %s", name); + log_error ("Null pointer in dns_host_entry_reference: %s", name); abort (); } if (*ptr) { - warn ("Non-null pointer in dns_host_entry_reference (%s)", + log_error ("Non-null pointer in dns_host_entry_reference (%s)", name); abort (); } @@ -571,7 +571,7 @@ int dns_host_entry_dereference (ptr, name) struct dns_host_entry *bp; if (!ptr || !*ptr) { - warn ("Null pointer in dns_host_entry_dereference: %s", name); + log_error ("Null pointer in dns_host_entry_dereference: %s", name); abort (); } diff --git a/common/bpf.c b/common/bpf.c index b0ede130..31a0293c 100644 --- a/common/bpf.c +++ b/common/bpf.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: bpf.c,v 1.20 1999/02/14 18:41:11 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: bpf.c,v 1.21 1999/02/24 17:56:43 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -109,11 +109,11 @@ int if_register_bpf (info) continue; } else { if (!b) - error ("No bpf devices.%s%s%s", + log_fatal ("No bpf devices.%s%s%s", " Please read the README", " section for your operating", " system."); - error ("Can't find free bpf: %m"); + log_fatal ("Can't find free bpf: %m"); } } else { break; @@ -122,7 +122,7 @@ int if_register_bpf (info) /* Set the BPF device to point at this interface. */ if (ioctl (sock, BIOCSETIF, info -> ifp) < 0) - error ("Can't attach interface %s to bpf device %s: %m", + log_fatal ("Can't attach interface %s to bpf device %s: %m", info -> name, filename); return sock; @@ -141,7 +141,7 @@ void if_register_send (info) info -> wfdesc = info -> rfdesc; #endif if (!quiet_interface_discovery) - note ("Sending on BPF/%s/%s/%s", + log_info ("Sending on BPF/%s/%s/%s", info -> name, print_hw_addr (info -> hw_address.htype, info -> hw_address.hlen, @@ -201,39 +201,39 @@ void if_register_receive (info) /* Make sure the BPF version is in range... */ if (ioctl (info -> rfdesc, BIOCVERSION, &v) < 0) - error ("Can't get BPF version: %m"); + log_fatal ("Can't get BPF version: %m"); if (v.bv_major != BPF_MAJOR_VERSION || v.bv_minor < BPF_MINOR_VERSION) - error ("Kernel BPF version out of range - recompile dhcpd!"); + log_fatal ("Kernel BPF version out of range - recompile dhcpd!"); /* Set immediate mode so that reads return as soon as a packet comes in, rather than waiting for the input buffer to fill with packets. */ if (ioctl (info -> rfdesc, BIOCIMMEDIATE, &flag) < 0) - error ("Can't set immediate mode on bpf device: %m"); + log_fatal ("Can't set immediate mode on bpf device: %m"); #ifdef NEED_OSF_PFILT_HACKS /* Allow the copyall flag to be set... */ if (ioctl(info -> rfdesc, EIOCALLOWCOPYALL, &flag) < 0) - error ("Can't set ALLOWCOPYALL: %m"); + log_fatal ("Can't set ALLOWCOPYALL: %m"); /* Clear all the packet filter mode bits first... */ bits = 0; if (ioctl (info -> rfdesc, EIOCMBIS, &bits) < 0) - error ("Can't clear pfilt bits: %m"); + log_fatal ("Can't clear pfilt bits: %m"); /* Set the ENBATCH, ENCOPYALL, ENBPFHDR bits... */ bits = ENBATCH | ENCOPYALL | ENBPFHDR; if (ioctl (info -> rfdesc, EIOCMBIS, &bits) < 0) - error ("Can't set ENBATCH|ENCOPYALL|ENBPFHDR: %m"); + log_fatal ("Can't set ENBATCH|ENCOPYALL|ENBPFHDR: %m"); #endif /* Get the required BPF buffer length from the kernel. */ if (ioctl (info -> rfdesc, BIOCGBLEN, &info -> rbuf_max) < 0) - error ("Can't get bpf buffer length: %m"); + log_fatal ("Can't get bpf buffer length: %m"); info -> rbuf = malloc (info -> rbuf_max); if (!info -> rbuf) - error ("Can't allocate %d bytes for bpf input buffer."); + log_fatal ("Can't allocate %d bytes for bpf input buffer."); info -> rbuf_offset = 0; info -> rbuf_len = 0; @@ -247,9 +247,9 @@ void if_register_receive (info) dhcp_bpf_filter [8].k = ntohs (local_port); if (ioctl (info -> rfdesc, BIOCSETF, &p) < 0) - error ("Can't install packet filter program: %m"); + log_fatal ("Can't install packet filter program: %m"); if (!quiet_interface_discovery) - note ("Listening on BPF/%s/%s/%s", + log_info ("Listening on BPF/%s/%s/%s", info -> name, print_hw_addr (info -> hw_address.htype, info -> hw_address.hlen, diff --git a/common/discover.c b/common/discover.c index a6a8b19f..fb0888c7 100644 --- a/common/discover.c +++ b/common/discover.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: discover.c,v 1.3 1999/02/14 18:45:30 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: discover.c,v 1.4 1999/02/24 17:56:44 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -83,7 +83,7 @@ void discover_interfaces (state) /* Create an unbound datagram socket to do the SIOCGIFADDR ioctl on. */ if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) - error ("Can't create addrlist socket"); + log_fatal ("Can't create addrlist socket"); /* Get the interface configuration information... */ ic.ifc_len = sizeof buf; @@ -91,7 +91,7 @@ void discover_interfaces (state) i = ioctl(sock, SIOCGIFCONF, &ic); if (i < 0) - error ("ioctl: SIOCGIFCONF: %m"); + log_fatal ("ioctl: SIOCGIFCONF: %m"); /* If we already have a list of interfaces, and we're running as a DHCP server, the interfaces were requested. */ @@ -130,7 +130,7 @@ void discover_interfaces (state) deal with. */ strcpy (ifr.ifr_name, ifp -> ifr_name); if (ioctl (sock, SIOCGIFFLAGS, &ifr) < 0) - error ("Can't get interface flags for %s: %m", + log_fatal ("Can't get interface flags for %s: %m", ifr.ifr_name); /* See if we've seen an interface that matches this one. */ @@ -156,7 +156,7 @@ void discover_interfaces (state) tmp = ((struct interface_info *) dmalloc (sizeof *tmp, "discover_interfaces")); if (!tmp) - error ("Insufficient memory to %s %s", + log_fatal ("Insufficient memory to %s %s", "record interface", ifp -> ifr_name); strcpy (tmp -> name, ifp -> ifr_name); tmp -> circuit_id = (u_int8_t *)tmp -> name; @@ -209,7 +209,7 @@ void discover_interfaces (state) #endif tif = (struct ifreq *)malloc (len); if (!tif) - error ("no space to remember ifp."); + log_fatal ("no space to remember ifp."); memcpy (tif, ifp, len); tmp -> ifp = tif; tmp -> primary_address = foo.sin_addr; @@ -230,7 +230,7 @@ void discover_interfaces (state) subnet -> interface = tmp; subnet -> interface_address = addr; } else if (subnet -> interface != tmp) { - warn ("Multiple %s %s: %s %s", + log_error ("Multiple %s %s: %s %s", "interfaces match the", "same subnet", subnet -> interface -> name, @@ -239,7 +239,7 @@ void discover_interfaces (state) share = subnet -> shared_network; if (tmp -> shared_network && tmp -> shared_network != share) { - warn ("Interface %s matches %s", + log_error ("Interface %s matches %s", tmp -> name, "multiple shared networks"); } else { @@ -249,7 +249,7 @@ void discover_interfaces (state) if (!share -> interface) { share -> interface = tmp; } else if (share -> interface != tmp) { - warn ("Multiple %s %s: %s %s", + log_error ("Multiple %s %s: %s %s", "interfaces match the", "same shared network", share -> interface -> name, @@ -286,7 +286,7 @@ void discover_interfaces (state) proc_dev = fopen (PROCDEV_DEVICE, "r"); if (!proc_dev) - error ("%s: %m", PROCDEV_DEVICE); + log_fatal ("%s: %m", PROCDEV_DEVICE); while (fgets (buffer, sizeof buffer, proc_dev)) { char *name = buffer; @@ -319,7 +319,7 @@ void discover_interfaces (state) tmp = ((struct interface_info *) dmalloc (sizeof *tmp, "discover_interfaces")); if (!tmp) - error ("Insufficient memory to %s %s", + log_fatal ("Insufficient memory to %s %s", "record interface", name); memset (tmp, 0, sizeof *tmp); strcpy (tmp -> name, name); @@ -344,7 +344,7 @@ void discover_interfaces (state) /* Make up an ifreq structure. */ tif = (struct ifreq *)malloc (sizeof (struct ifreq)); if (!tif) - error ("no space to remember ifp."); + log_fatal ("no space to remember ifp."); memset (tif, 0, sizeof (struct ifreq)); strcpy (tif -> ifr_name, tmp -> name); tmp -> ifp = tif; @@ -397,7 +397,7 @@ void discover_interfaces (state) #endif default: - error ("%s: unknown hardware address type %d", + log_fatal ("%s: unknown hardware address type %d", ifr.ifr_name, sa.sa_family); } } @@ -418,7 +418,7 @@ void discover_interfaces (state) INTERFACE_REQUESTED); if (!tmp -> ifp || !(tmp -> flags & INTERFACE_REQUESTED)) { if ((tmp -> flags & INTERFACE_REQUESTED) != ir) - error ("%s: not found", tmp -> name); + log_fatal ("%s: not found", tmp -> name); if (!last) interfaces = interfaces -> next; else @@ -437,7 +437,7 @@ void discover_interfaces (state) /* We must have a subnet declaration for each interface. */ if (!tmp -> shared_network && (state == DISCOVER_SERVER)) - error ("No subnet declaration for %s (%s).", + log_fatal ("No subnet declaration for %s (%s).", tmp -> name, inet_ntoa (foo.sin_addr)); /* Find subnets that don't have valid interface @@ -475,13 +475,13 @@ struct interface_info *setup_fallback () ((struct interface_info *) dmalloc (sizeof *fallback_interface, "discover_interfaces")); if (!fallback_interface) - error ("Insufficient memory to record fallback interface."); + log_fatal ("Insufficient memory to record fallback interface."); memset (fallback_interface, 0, sizeof *fallback_interface); strcpy (fallback_interface -> name, "fallback"); fallback_interface -> shared_network = new_shared_network ("parse_statement"); if (!fallback_interface -> shared_network) - error ("No memory for shared subnet"); + log_fatal ("No memory for shared subnet"); memset (fallback_interface -> shared_network, 0, sizeof (struct shared_network)); fallback_interface -> shared_network -> name = "fallback-net"; @@ -520,7 +520,7 @@ void got_one (l) if ((result = receive_packet (ip, u.packbuf, sizeof u, &from, &hfrom)) < 0) { - warn ("receive_packet failed on %s: %m", ip -> name); + log_error ("receive_packet failed on %s: %m", ip -> name); return; } if (result == 0) diff --git a/common/dispatch.c b/common/dispatch.c index 0efe0e65..b24d9f6f 100644 --- a/common/dispatch.c +++ b/common/dispatch.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: dispatch.c,v 1.52 1999/02/14 18:46:20 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: dispatch.c,v 1.53 1999/02/24 17:56:44 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -74,7 +74,7 @@ void dispatch () } fds = (struct pollfd *)malloc ((nfds) * sizeof (struct pollfd)); if (!fds) - error ("Can't allocate poll structures."); + log_fatal ("Can't allocate poll structures."); do { /* Call any expired timeouts, and then if there's @@ -125,7 +125,7 @@ void dispatch () if (errno == EAGAIN || errno == EINTR) continue; else - error ("poll: %m"); + log_fatal ("poll: %m"); } i = 0; @@ -197,7 +197,7 @@ void dispatch () /* Not likely to be transitory... */ if (count < 0) - error ("select: %m"); + log_fatal ("select: %m"); for (l = protocols; l; l = l -> next) { if (!FD_ISSET (l -> fd, &r)) @@ -267,7 +267,7 @@ void add_timeout (when, where, what) } else { q = (struct timeout *)malloc (sizeof (struct timeout)); if (!q) - error ("Can't allocate timeout structure!"); + log_fatal ("Can't allocate timeout structure!"); q -> func = where; q -> what = what; } @@ -335,7 +335,7 @@ struct protocol *add_protocol (name, fd, handler, local) p = (struct protocol *)malloc (sizeof *p); if (!p) - error ("can't allocate protocol struct for %s", name); + log_fatal ("can't allocate protocol struct for %s", name); p -> fd = fd; p -> handler = handler; diff --git a/common/dlpi.c b/common/dlpi.c index 192539bc..c8fd91c2 100644 --- a/common/dlpi.c +++ b/common/dlpi.c @@ -122,7 +122,7 @@ #ifndef lint static char copyright[] = -"$Id: dlpi.c,v 1.3 1999/02/14 18:48:05 mellon Exp $ Copyright (c) 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: dlpi.c,v 1.4 1999/02/24 17:56:44 mellon Exp $ Copyright (c) 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ static int strioctl PROTO ((int fd, int cmd, int timeout, int len, char *dp)); @@ -208,7 +208,7 @@ int if_register_dlpi (info) /* Open a DLPI device */ if ((sock = dlpiopen (info -> name)) < 0) { - error ("Can't open DLPI device for %s: %m", info -> name); + log_fatal ("Can't open DLPI device for %s: %m", info -> name); } /* @@ -220,7 +220,7 @@ int if_register_dlpi (info) * the dl_mac_type and dl_provider_style */ if (dlpiinforeq(sock) < 0 || dlpiinfoack(sock, (char *)buf) < 0) { - error ("Can't get DLPI MAC type for %s: %m", info -> name); + log_fatal ("Can't get DLPI MAC type for %s: %m", info -> name); } else { switch (dlp -> info_ack.dl_mac_type) { case DL_CSMACD: /* IEEE 802.3 */ @@ -231,7 +231,7 @@ int if_register_dlpi (info) info -> hw_address.htype = HTYPE_FDDI; break; default: - error ("%s: unknown DLPI MAC type %d", + log_fatal ("%s: unknown DLPI MAC type %d", info -> name, dlp -> info_ack.dl_mac_type); break; @@ -247,7 +247,7 @@ int if_register_dlpi (info) if (dlpiattachreq (sock, unit) < 0 || dlpiokack (sock, (char *)buf) < 0) { - error ("Can't attach DLPI device for %s: %m", info -> name); + log_fatal ("Can't attach DLPI device for %s: %m", info -> name); } } @@ -256,7 +256,7 @@ int if_register_dlpi (info) */ if (dlpibindreq (sock, DLPI_DEFAULTSAP, 0, DL_CLDLS, 0, 0) < 0 || dlpibindack (sock, (char *)buf) < 0) { - error ("Can't bind DLPI device for %s: %m", info -> name); + log_fatal ("Can't bind DLPI device for %s: %m", info -> name); } /* @@ -265,7 +265,7 @@ int if_register_dlpi (info) */ if (dlpiphysaddrreq (sock, DL_CURR_PHYS_ADDR) < 0 || dlpiphysaddrack (sock, (char *)buf) < 0) { - error ("Can't get DLPI hardware address for %s: %m", + log_fatal ("Can't get DLPI hardware address for %s: %m", info -> name); } @@ -276,14 +276,14 @@ int if_register_dlpi (info) #ifdef USE_DLPI_RAW if (strioctl (sock, DLIOCRAW, INFTIM, 0, 0) < 0) { - error ("Can't set DLPI RAW mode for %s: %m", + log_fatal ("Can't set DLPI RAW mode for %s: %m", info -> name); } #endif #ifdef USE_DLPI_PFMOD if (ioctl (sock, I_PUSH, "pfmod") < 0) { - error ("Can't push packet filter onto DLPI for %s: %m", + log_fatal ("Can't push packet filter onto DLPI for %s: %m", info -> name); } #endif @@ -336,7 +336,7 @@ void if_register_send (info) /* Install the filter */ if (strioctl (info -> wfdesc, PFIOCSETF, INFTIM, sizeof (pf), (char *)&pf) < 0) { - error ("Can't set PFMOD send filter on %s: %m", info -> name); + log_fatal ("Can't set PFMOD send filter on %s: %m", info -> name); } # endif /* USE_DLPI_PFMOD */ @@ -349,7 +349,7 @@ void if_register_send (info) #endif if (!quiet_interface_discovery) - note ("Sending on DLPI/%s/%s/%s", + log_info ("Sending on DLPI/%s/%s/%s", info -> name, print_hw_addr (info -> hw_address.htype, info -> hw_address.hlen, @@ -426,12 +426,12 @@ void if_register_receive (info) /* Install the filter... */ if (strioctl (info -> rfdesc, PFIOCSETF, INFTIM, sizeof (pf), (char *)&pf) < 0) { - error ("Can't set PFMOD receive filter on %s: %m", info -> name); + log_fatal ("Can't set PFMOD receive filter on %s: %m", info -> name); } #endif if (!quiet_interface_discovery) - note ("Listening on DLPI/%s/%s/%s", + log_info ("Listening on DLPI/%s/%s/%s", info -> name, print_hw_addr (info -> hw_address.htype, info -> hw_address.hlen, @@ -1164,14 +1164,14 @@ static int strgetmsg (fd, ctlp, datap, flagsp, caller) count = poll (&pfd, 1, to_msec); if (count == 0) { - /* error ("strgetmsg: timeout"); */ + /* log_fatal ("strgetmsg: timeout"); */ return -1; } else if (count < 0) { if (errno == EAGAIN || errno == EINTR) { time (&now); continue; } else { - /* error ("poll: %m"); */ + /* log_fatal ("poll: %m"); */ return -1; } } else { @@ -1186,7 +1186,7 @@ static int strgetmsg (fd, ctlp, datap, flagsp, caller) (void) sigset (SIGALRM, sigalrm); if (alarm (DLPI_MAXWAIT) < 0) { - /* error ("alarm: %m"); */ + /* log_fatal ("alarm: %m"); */ return -1; } #endif /* !defined (USE_POLL) */ @@ -1204,7 +1204,7 @@ static int strgetmsg (fd, ctlp, datap, flagsp, caller) * Stop timer. */ if (alarm (0) < 0) { - /* error ("alarm: %m"); */ + /* log_fatal ("alarm: %m"); */ return -1; } #endif diff --git a/common/dns.c b/common/dns.c index 391e3fc7..df9e26ec 100644 --- a/common/dns.c +++ b/common/dns.c @@ -48,7 +48,7 @@ #ifndef lint static char copyright[] = -"$Id: dns.c,v 1.9 1998/03/17 06:09:59 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n"; +"$Id: dns.c,v 1.10 1999/02/24 17:56:44 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -76,7 +76,7 @@ void dns_startup () /* Only initialize icmp once. */ if (dns_protocol_initialized) - error ("attempted to reinitialize dns protocol"); + log_fatal ("attempted to reinitialize dns protocol"); dns_protocol_initialized = 1; /* Get the protocol number (should be 1). */ @@ -89,7 +89,7 @@ void dns_startup () /* Get a socket for the DNS protocol. */ dns_protocol_fd = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (dns_protocol_fd < 0) - error ("unable to create dns socket: %m"); + log_fatal ("unable to create dns socket: %m"); first_name_server (); @@ -473,13 +473,13 @@ void dns_packet (protocol) status = recvfrom (protocol -> fd, (char *)buf, sizeof buf, 0, (struct sockaddr *)&from, &len); if (status < 0) { - warn ("dns_packet: %m"); + log_error ("dns_packet: %m"); return; } /* Response is too long? */ if (len > 512) { - warn ("dns_packet: dns message too long (%d)", len); + log_error ("dns_packet: dns message too long (%d)", len); return; } @@ -492,7 +492,7 @@ void dns_packet (protocol) /* If this is a response to a query from us, there should have been only one query. */ if (ntohs (ns_header -> qdcount) != 1) { - warn ("Bogus DNS answer packet from %s claims %d queries.\n", + log_error ("Bogus DNS answer packet from %s claims %d queries.\n", inet_ntoa (from.sin_addr), ntohs (ns_header -> qdcount)); return; @@ -513,12 +513,12 @@ void dns_packet (protocol) /* See if we asked this question. */ query = find_dns_query (&qbuf.q, 0); if (!query) { -warn ("got answer for question %s from DNS, which we didn't ask.", +log_error ("got answer for question %s from DNS, which we didn't ask.", qbuf.q.data); return; } -note ("got answer for question %s from DNS", qbuf.q.data); +log_info ("got answer for question %s from DNS", qbuf.q.data); /* Wake up everybody who's waiting. */ for (wakeup = query -> wakeups; wakeup; wakeup = wakeup -> next) { diff --git a/common/errwarn.c b/common/errwarn.c index 078ae417..16d2c2d3 100644 --- a/common/errwarn.c +++ b/common/errwarn.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: errwarn.c,v 1.15 1997/05/09 08:03:44 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: errwarn.c,v 1.16 1999/02/24 17:56:45 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -57,7 +57,7 @@ int warnings_occurred; /* Log an error message, then exit... */ -void error (ANSI_DECL(char *) fmt, VA_DOTDOTDOT) +void log_fatal (ANSI_DECL(char *) fmt, VA_DOTDOTDOT) KandR (char *fmt;) va_dcl { @@ -89,9 +89,9 @@ void error (ANSI_DECL(char *) fmt, VA_DOTDOTDOT) exit (1); } -/* Log a warning message... */ +/* Log an error message... */ -int warn (ANSI_DECL (char *) fmt, VA_DOTDOTDOT) +int log_error (ANSI_DECL (char *) fmt, VA_DOTDOTDOT) KandR (char *fmt;) va_dcl { @@ -117,7 +117,7 @@ int warn (ANSI_DECL (char *) fmt, VA_DOTDOTDOT) /* Log a note... */ -int note (ANSI_DECL (char *) fmt, VA_DOTDOTDOT) +int log_info (ANSI_DECL (char *) fmt, VA_DOTDOTDOT) KandR (char *fmt;) va_dcl { @@ -143,7 +143,7 @@ int note (ANSI_DECL (char *) fmt, VA_DOTDOTDOT) /* Log a debug message... */ -int debug (ANSI_DECL (char *) fmt, VA_DOTDOTDOT) +int log_debug (ANSI_DECL (char *) fmt, VA_DOTDOTDOT) KandR (char *fmt;) va_dcl { diff --git a/common/execute.c b/common/execute.c index 5d9fa14c..536719e8 100644 --- a/common/execute.c +++ b/common/execute.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: execute.c,v 1.4 1998/11/11 07:51:41 mellon Exp $ Copyright (c) 1998 The Internet Software Consortium. All rights reserved.\n"; +"$Id: execute.c,v 1.5 1999/02/24 17:56:45 mellon Exp $ Copyright (c) 1998 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -68,7 +68,7 @@ int execute_statements (packet, in_options, out_options, statements) in_options, r -> data.ie.expr); #if defined (DEBUG_EXPRESSIONS) - note ("exec: if %s", (status + log_info ("exec: if %s", (status ? (result ? "true" : "false") : "NULL")); #endif @@ -86,7 +86,7 @@ int execute_statements (packet, in_options, out_options, statements) (&result, packet, in_options, r -> data.eval); #if defined (DEBUG_EXPRESSIONS) - note ("exec: evaluate: %s", + log_info ("exec: evaluate: %s", (status ? (result ? "true" : "false") : "NULL")); #endif @@ -94,7 +94,7 @@ int execute_statements (packet, in_options, out_options, statements) case add_statement: #if defined (DEBUG_EXPRESSIONS) - note ("exec: add %s", (r -> data.add -> name + log_info ("exec: add %s", (r -> data.add -> name ? r -> data.add -> name : "")); #endif @@ -103,34 +103,34 @@ int execute_statements (packet, in_options, out_options, statements) case break_statement: #if defined (DEBUG_EXPRESSIONS) - note ("exec: break"); + log_info ("exec: break"); #endif return 0; case supersede_option_statement: #if defined (DEBUG_EXPRESSIONS) - note ("exec: supersede option %s.%s", + log_info ("exec: supersede option %s.%s", r -> data.option -> option -> universe -> name, r -> data.option -> option -> name); goto option_statement; #endif case default_option_statement: #if defined (DEBUG_EXPRESSIONS) - note ("exec: default option %s.%s", + log_info ("exec: default option %s.%s", r -> data.option -> option -> universe -> name, r -> data.option -> option -> name); goto option_statement; #endif case append_option_statement: #if defined (DEBUG_EXPRESSIONS) - note ("exec: append option %s.%s", + log_info ("exec: append option %s.%s", r -> data.option -> option -> universe -> name, r -> data.option -> option -> name); goto option_statement; #endif case prepend_option_statement: #if defined (DEBUG_EXPRESSIONS) - note ("exec: prepend option %s.%s", + log_info ("exec: prepend option %s.%s", r -> data.option -> option -> universe -> name, r -> data.option -> option -> name); option_statement: @@ -143,7 +143,7 @@ int execute_statements (packet, in_options, out_options, statements) break; default: - error ("bogus statement type %d\n", r -> op); + log_fatal ("bogus statement type %d\n", r -> op); } } diff --git a/common/hash.c b/common/hash.c index 0a95635b..15bb5801 100644 --- a/common/hash.c +++ b/common/hash.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: hash.c,v 1.10 1998/03/16 06:11:51 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: hash.c,v 1.11 1999/02/24 17:56:45 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -105,7 +105,7 @@ void add_hash (table, name, len, pointer) bp = new_hash_bucket ("add_hash"); if (!bp) { - warn ("Can't add %s to hash table.", name); + log_error ("Can't add %s to hash table.", name); return; } bp -> name = name; diff --git a/common/icmp.c b/common/icmp.c index bfdf8f25..0f9a69e6 100644 --- a/common/icmp.c +++ b/common/icmp.c @@ -43,7 +43,7 @@ #ifndef lint static char copyright[] = -"$Id: icmp.c,v 1.11 1998/06/25 22:54:13 mellon Exp $ Copyright (c) 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; +"$Id: icmp.c,v 1.12 1999/02/24 17:56:45 mellon Exp $ Copyright (c) 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -67,7 +67,7 @@ void icmp_startup (routep, handler) /* Only initialize icmp once. */ if (icmp_protocol_initialized) - error ("attempted to reinitialize icmp protocol"); + log_fatal ("attempted to reinitialize icmp protocol"); icmp_protocol_initialized = 1; /* Get the protocol number (should be 1). */ @@ -78,13 +78,13 @@ void icmp_startup (routep, handler) /* Get a raw socket for the ICMP protocol. */ icmp_protocol_fd = socket (AF_INET, SOCK_RAW, protocol); if (icmp_protocol_fd < 0) - error ("unable to create icmp socket: %m"); + log_fatal ("unable to create icmp socket: %m"); /* Make sure it does routing... */ state = 0; if (setsockopt (icmp_protocol_fd, SOL_SOCKET, SO_DONTROUTE, (char *)&state, sizeof state) < 0) - error ("Unable to disable SO_DONTROUTE on ICMP socket: %m"); + log_fatal ("Unable to disable SO_DONTROUTE on ICMP socket: %m"); add_protocol ("icmp", icmp_protocol_fd, icmp_echoreply, (void *)handler); @@ -98,7 +98,7 @@ int icmp_echorequest (addr) int status; if (!icmp_protocol_initialized) - error ("attempt to use ICMP protocol before initialization."); + log_fatal ("attempt to use ICMP protocol before initialization."); #ifdef HAVE_SA_LEN to.sin_len = sizeof to; @@ -126,7 +126,7 @@ int icmp_echorequest (addr) status = sendto (icmp_protocol_fd, (char *)&icmp, sizeof icmp, 0, (struct sockaddr *)&to, sizeof to); if (status < 0) - warn ("icmp_echorequest %s: %m", inet_ntoa(to.sin_addr)); + log_error ("icmp_echorequest %s: %m", inet_ntoa(to.sin_addr)); if (status != sizeof icmp) return 0; @@ -149,7 +149,7 @@ void icmp_echoreply (protocol) status = recvfrom (protocol -> fd, (char *)icbuf, sizeof icbuf, 0, (struct sockaddr *)&from, &len); if (status < 0) { - warn ("icmp_echoreply: %m"); + log_error ("icmp_echoreply: %m"); return; } diff --git a/common/interact.c b/common/interact.c index 561af874..d75d7137 100644 --- a/common/interact.c +++ b/common/interact.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: interact.c,v 1.1 1998/04/09 05:18:56 mellon Exp $ Copyright (c) 1998 The Internet Software Consortium. All rights reserved.\n"; +"$Id: interact.c,v 1.2 1999/02/24 17:56:45 mellon Exp $ Copyright (c) 1998 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -60,13 +60,13 @@ void interact_startup () /* Only initialize interact once. */ if (interact_initialized) - error ("attempted to reinitialize interact protocol"); + log_fatal ("attempted to reinitialize interact protocol"); interact_initialized = 1; /* Make a socket... */ interact_fd = socket (AF_UNIX, SOCK_STREAM, 0); if (interact_fd < 0) - error ("unable to create interact socket: %m"); + log_fatal ("unable to create interact socket: %m"); /* XXX for now... */ name.sun_family = PF_UNIX; @@ -83,7 +83,7 @@ void interact_startup () /* Bind to it... */ if (bind (interact_fd, (struct sockaddr *)&name, len) < 0) { - warn ("can't bind to interact socket: %m"); + log_error ("can't bind to interact socket: %m"); close (interact_fd); umask (m); return; @@ -92,7 +92,7 @@ void interact_startup () /* Listen for connections... */ if (listen (interact_fd, 1) < 0) { - warn ("can't listen on interact socket: %m"); + log_error ("can't listen on interact socket: %m"); close (interact_fd); unlink (name.sun_path); return; @@ -112,20 +112,20 @@ void new_interact_connection (proto) tmp = (struct interact_client *)malloc (sizeof *tmp); if (!tmp) - error ("Can't find memory for new client!"); + log_fatal ("Can't find memory for new client!"); memset (tmp, 0, sizeof *tmp); namelen = sizeof name; new_fd = accept (proto -> fd, (struct sockaddr *)&name, &namelen); if (new_fd < 0) { - warn ("accept: %m"); + log_error ("accept: %m"); free (tmp); return; } if ((arg = fcntl (new_fd, F_GETFL, 0)) < 0) { bad_flag: - warn ("Can't set flags on new interactive client: %m"); + log_error ("Can't set flags on new interactive client: %m"); close (new_fd); free (tmp); return; @@ -153,7 +153,7 @@ void interact_client_input (proto) status = read (proto -> fd, &client -> ibuf [client -> ibuflen], (sizeof client -> ibuf) - client -> ibuflen); if (status < 0) { - warn ("interact_client_input: %m"); + log_error ("interact_client_input: %m"); blow: close (proto -> fd); remove_protocol (proto); @@ -168,7 +168,7 @@ void interact_client_input (proto) eobuf = memchr (client -> ibuf, '\n', client -> ibuflen); if (!eobuf) { if (client -> ibuflen == sizeof client -> ibuf) { - warn ("interact_client_input: buffer overflow."); + log_error ("interact_client_input: buffer overflow."); goto blow; } return; @@ -220,7 +220,7 @@ int interact_client_write (client, string, lastp) obufmax = (strlen (string) + 1025) & ~1023; obuf = malloc (obufmax); if (!obuf) { - warn ("interact_client_write: out of memory"); + log_error ("interact_client_write: out of memory"); blow: close (client -> proto -> fd); remove_protocol (client -> proto); diff --git a/common/lpf.c b/common/lpf.c index a705cc03..88544173 100644 --- a/common/lpf.c +++ b/common/lpf.c @@ -43,7 +43,7 @@ #ifndef lint static char copyright[] = -"$Id: lpf.c,v 1.2 1999/02/14 06:05:49 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: lpf.c,v 1.3 1999/02/24 17:56:45 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -93,7 +93,7 @@ int if_register_lpf (info) if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT || errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT || errno == EAFNOSUPPORT) - error ("socket: %m - make sure %s %s!", + log_fatal ("socket: %m - make sure %s %s!", "CONFIG_PACKET and CONFIG_FILTER are defined", "in your kernel configuration"); error("Open a socket for LPF: %m"); @@ -107,7 +107,7 @@ int if_register_lpf (info) if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT || errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT || errno == EAFNOSUPPORT) - error ("socket: %m - make sure %s %s!", + log_fatal ("socket: %m - make sure %s %s!", "CONFIG_PACKET and CONFIG_FILTER are defined", "in your kernel configuration"); error("Bind socket to interface: %m"); @@ -129,7 +129,7 @@ void if_register_send (info) info -> wfdesc = info -> rfdesc; #endif if (!quiet_interface_discovery) - note ("Sending on LPF/%s/%s/%s", + log_info ("Sending on LPF/%s/%s/%s", info -> name, print_hw_addr (info -> hw_address.htype, info -> hw_address.hlen, @@ -168,13 +168,13 @@ void if_register_receive (info) if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT || errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT || errno == EAFNOSUPPORT) - error ("socket: %m - make sure %s %s!", + log_fatal ("socket: %m - make sure %s %s!", "CONFIG_PACKET and CONFIG_FILTER are defined", "in your kernel configuration"); - error ("Can't install packet filter program: %m"); + log_fatal ("Can't install packet filter program: %m"); } if (!quiet_interface_discovery) - note ("Listening on LPF/%s/%s/%s", + log_info ("Listening on LPF/%s/%s/%s", info -> name, print_hw_addr (info -> hw_address.htype, info -> hw_address.hlen, diff --git a/common/memory.c b/common/memory.c index c6c561ee..8248481d 100644 --- a/common/memory.c +++ b/common/memory.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: memory.c,v 1.45 1999/02/14 18:49:45 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: memory.c,v 1.46 1999/02/24 17:56:46 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -224,7 +224,7 @@ void new_address_range (low, high, subnet, pool) /* All subnets should have attached shared network structures. */ if (!share) { strcpy (netbuf, piaddr (subnet -> net)); - error ("No shared network for network %s (%s)", + log_fatal ("No shared network for network %s (%s)", netbuf, piaddr (subnet -> netmask)); } @@ -242,7 +242,7 @@ void new_address_range (low, high, subnet, pool) strcpy (lowbuf, piaddr (low)); strcpy (highbuf, piaddr (high)); strcpy (netbuf, piaddr (subnet -> netmask)); - error ("Address range %s to %s, netmask %s spans %s!", + log_fatal ("Address range %s to %s, netmask %s spans %s!", lowbuf, highbuf, netbuf, "multiple subnets"); } @@ -251,7 +251,7 @@ void new_address_range (low, high, subnet, pool) strcpy (lowbuf, piaddr (low)); strcpy (highbuf, piaddr (high)); strcpy (netbuf, piaddr (subnet -> netmask)); - error ("Address range %s to %s not on net %s/%s!", + log_fatal ("Address range %s to %s not on net %s/%s!", lowbuf, highbuf, piaddr (subnet -> net), netbuf); } @@ -270,7 +270,7 @@ void new_address_range (low, high, subnet, pool) if (!address_range) { strcpy (lowbuf, piaddr (low)); strcpy (highbuf, piaddr (high)); - error ("No memory for address range %s-%s.", lowbuf, highbuf); + log_fatal ("No memory for address range %s-%s.", lowbuf, highbuf); } memset (address_range, 0, (sizeof *address_range) * (max - min + 1)); @@ -378,7 +378,7 @@ int subnet_inner_than (subnet, scan, warnp) break; strcpy (n1buf, piaddr (subnet -> net)); if (warnp) - warn ("%ssubnet %s/%d conflicts with subnet %s/%d", + log_error ("%ssubnet %s/%d conflicts with subnet %s/%d", "Warning: ", n1buf, 32 - i, piaddr (scan -> net), 32 - j); if (i < j) @@ -440,7 +440,7 @@ void enter_lease (lease) if (!comp) { comp = new_lease ("enter_lease"); if (!comp) { - error ("No memory for lease %s\n", + log_fatal ("No memory for lease %s\n", piaddr (lease -> ip_addr)); } *comp = *lease; @@ -494,7 +494,7 @@ int supersede_lease (comp, lease, commit) memcmp (comp -> hardware_addr.haddr, lease -> hardware_addr.haddr, comp -> hardware_addr.hlen))))) { - warn ("Lease conflict at %s", + log_error ("Lease conflict at %s", piaddr (comp -> ip_addr)); return 0; } @@ -546,7 +546,7 @@ int supersede_lease (comp, lease, commit) lease -> uid = (unsigned char *)0; lease -> uid_max = 0; } else { - error ("corrupt lease uid."); /* XXX */ + log_fatal ("corrupt lease uid."); /* XXX */ } } else { comp -> uid = (unsigned char *)0; @@ -671,7 +671,7 @@ void abandon_lease (lease, message) lease -> flags |= ABANDONED_LEASE; lt = *lease; lt.ends = cur_time; /* XXX */ - warn ("Abandoning IP address %s: %s", + log_error ("Abandoning IP address %s: %s", piaddr (lease -> ip_addr), message); lt.hardware_addr.htype = 0; lt.hardware_addr.hlen = 0; @@ -871,7 +871,7 @@ struct group *clone_group (group, caller) { struct group *g = new_group (caller); if (!g) - error ("%s: can't allocate new group", caller); + log_fatal ("%s: can't allocate new group", caller); *g = *group; g -> statements = (struct executable_statement *)0; g -> next = group; @@ -893,13 +893,13 @@ void write_leases () l -> uid_len || (l -> flags & ABANDONED_LEASE)) if (!write_lease (l)) - error ("Can't rewrite %s", + log_fatal ("Can't rewrite %s", "lease database"); } } } if (!commit_leases ()) - error ("Can't commit leases to new database: %m"); + log_fatal ("Can't commit leases to new database: %m"); } void dump_subnets () @@ -909,20 +909,20 @@ void dump_subnets () struct subnet *n; struct pool *p; - note ("Subnets:"); + log_info ("Subnets:"); for (n = subnets; n; n = n -> next_subnet) { - debug (" Subnet %s", piaddr (n -> net)); - debug (" netmask %s", + log_debug (" Subnet %s", piaddr (n -> net)); + log_debug (" netmask %s", piaddr (n -> netmask)); } - note ("Shared networks:"); + log_info ("Shared networks:"); for (s = shared_networks; s; s = s -> next) { - note (" %s", s -> name); + log_info (" %s", s -> name); for (p = s -> pools; p; p = p -> next) { for (l = p -> leases; l; l = l -> next) { print_lease (l); } - debug ("Last Lease:"); + log_debug ("Last Lease:"); print_lease (p -> last_lease); } } diff --git a/common/nit.c b/common/nit.c index 0581bd3d..5734f695 100644 --- a/common/nit.c +++ b/common/nit.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: nit.c,v 1.16 1999/02/14 18:50:25 mellon Exp $ Copyright (c) 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: nit.c,v 1.17 1999/02/24 17:56:46 mellon Exp $ Copyright (c) 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -95,7 +95,7 @@ int if_register_nit (info) /* Open a NIT device */ sock = open ("/dev/nit", O_RDWR); if (sock < 0) - error ("Can't open NIT device for %s: %m", info -> name); + log_fatal ("Can't open NIT device for %s: %m", info -> name); /* Set the NIT device to point at this interface. */ sio.ic_cmd = NIOCBIND; @@ -103,7 +103,7 @@ int if_register_nit (info) sio.ic_dp = (char *)(info -> ifp); sio.ic_timout = INFTIM; if (ioctl (sock, I_STR, &sio) < 0) - error ("Can't attach interface %s to nit device: %m", + log_fatal ("Can't attach interface %s to nit device: %m", info -> name); /* Get the low-level address... */ @@ -112,7 +112,7 @@ int if_register_nit (info) sio.ic_dp = (char *)𝔦 sio.ic_timout = INFTIM; if (ioctl (sock, I_STR, &sio) < 0) - error ("Can't get physical layer address for %s: %m", + log_fatal ("Can't get physical layer address for %s: %m", info -> name); /* XXX code below assumes ethernet interface! */ @@ -121,7 +121,7 @@ int if_register_nit (info) memcpy (info -> hw_address.haddr, ifr.ifr_ifru.ifru_addr.sa_data, 6); if (ioctl (sock, I_PUSH, "pf") < 0) - error ("Can't push packet filter onto NIT for %s: %m", + log_fatal ("Can't push packet filter onto NIT for %s: %m", info -> name); return sock; @@ -150,12 +150,12 @@ void if_register_send (info) sio.ic_dp = (char *)&pf; sio.ic_timout = INFTIM; if (ioctl (info -> wfdesc, I_STR, &sio) < 0) - error ("Can't set NIT filter: %m"); + log_fatal ("Can't set NIT filter: %m"); #else info -> wfdesc = info -> rfdesc; #endif if (!quiet_interface_discovery) - note ("Sending on NIT/%s/%s", + log_info ("Sending on NIT/%s/%s", print_hw_addr (info -> hw_address.htype, info -> hw_address.hlen, info -> hw_address.haddr), @@ -186,28 +186,28 @@ void if_register_receive (info) packet. */ x = 0; if (ioctl (info -> rfdesc, NIOCSSNAP, &x) < 0) - error ("Can't set NIT snap length on %s: %m", info -> name); + log_fatal ("Can't set NIT snap length on %s: %m", info -> name); /* Set the stream to byte stream mode */ if (ioctl (info -> rfdesc, I_SRDOPT, RMSGN) != 0) - note ("I_SRDOPT failed on %s: %m", info -> name); + log_info ("I_SRDOPT failed on %s: %m", info -> name); #if 0 /* Push on the chunker... */ if (ioctl (info -> rfdesc, I_PUSH, "nbuf") < 0) - error ("Can't push chunker onto NIT STREAM: %m"); + log_fatal ("Can't push chunker onto NIT STREAM: %m"); /* Set the timeout to zero. */ t.tv_sec = 0; t.tv_usec = 0; if (ioctl (info -> rfdesc, NIOCSTIME, &t) < 0) - error ("Can't set chunk timeout: %m"); + log_fatal ("Can't set chunk timeout: %m"); #endif /* Ask for no header... */ x = 0; if (ioctl (info -> rfdesc, NIOCSFLAGS, &x) < 0) - error ("Can't set NIT flags on %s: %m", info -> name); + log_fatal ("Can't set NIT flags on %s: %m", info -> name); /* Set up the NIT filter program. */ /* XXX Unlike the BPF filter program, this one won't work if the @@ -235,10 +235,10 @@ void if_register_receive (info) sio.ic_dp = (char *)&pf; sio.ic_timout = INFTIM; if (ioctl (info -> rfdesc, I_STR, &sio) < 0) - error ("Can't set NIT filter on %s: %m", info -> name); + log_fatal ("Can't set NIT filter on %s: %m", info -> name); if (!quiet_interface_discovery) - note ("Listening on NIT/%s/%s", + log_info ("Listening on NIT/%s/%s", print_hw_addr (info -> hw_address.htype, info -> hw_address.hlen, info -> hw_address.haddr), diff --git a/common/options.c b/common/options.c index 26889cb9..59fadc43 100644 --- a/common/options.c +++ b/common/options.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: options.c,v 1.34 1998/11/06 00:12:40 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: options.c,v 1.35 1999/02/24 17:56:46 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #define DHCP_OPTION_DATA @@ -115,7 +115,7 @@ int parse_option_buffer (packet, buffer, length) struct buffer *bp = (struct buffer *)0; if (!buffer_allocate (&bp, length, "parse_option_buffer")) { - warn ("parse_option_buffer: no memory for option buffer."); + log_error ("parse_option_buffer: no memory for option buffer."); return 0; } memcpy (bp -> data, buffer, length); @@ -134,7 +134,7 @@ int parse_option_buffer (packet, buffer, length) /* If the length is outrageous, the options are bad. */ if (offset + len + 2 > length) { - warn ("Option %s length %d overflows input buffer.", + log_error ("Option %s length %d overflows input buffer.", dhcp_options [code].name, len); buffer_dereference (&bp, "parse_option_buffer"); @@ -146,7 +146,7 @@ int parse_option_buffer (packet, buffer, length) if (code == DHO_DHCP_AGENT_OPTIONS) { if (!parse_agent_information_option (packet, len, buffer + offset + 2)) { - warn ("malformed agent information option."); + log_error ("malformed agent information option."); buffer_dereference (&bp, "parse_option_buffer"); return 0; @@ -154,7 +154,7 @@ int parse_option_buffer (packet, buffer, length) } else { if (!option_cache_allocate (&op, "parse_option_buffer")) { - warn ("Can't allocate storage for option %s.", + log_error ("Can't allocate storage for option %s.", dhcp_options [code].name); buffer_dereference (&bp, "parse_option_buffer"); @@ -216,7 +216,7 @@ int parse_agent_information_option (packet, len, data) dmalloc (op [1] + 1 + sizeof *t, "parse_agent_information_option"); if (!t) - error ("can't allocate space for option tag data."); + log_fatal ("can't allocate space for option tag data."); /* Link it in at the tail of the list. */ t -> next = (struct option_tag *)0; @@ -232,7 +232,7 @@ int parse_agent_information_option (packet, len, data) a = (struct agent_options *)dmalloc (sizeof *a, "parse_agent_information_option"); if (!a) - error ("can't allocate space for agent option structure."); + log_fatal ("can't allocate space for agent option structure."); /* Find the tail of the list. */ for (tail = &packet -> options.agent_options; @@ -620,7 +620,7 @@ char *pretty_print_option (code, data, len, emit_commas, emit_quotes) /* Code should be between 0 and 255. */ if (code > 255) - error ("pretty_print_option: bad code %d\n", code); + log_fatal ("pretty_print_option: bad code %d\n", code); if (emit_commas) comma = ','; @@ -630,7 +630,7 @@ char *pretty_print_option (code, data, len, emit_commas, emit_quotes) /* Figure out the size of the data. */ for (i = 0; dhcp_options [code].format [i]; i++) { if (!numhunk) { - warn ("%s: Excess information in format string: %s\n", + log_error ("%s: Excess information in format string: %s\n", dhcp_options [code].name, &(dhcp_options [code].format [i])); break; @@ -672,7 +672,7 @@ char *pretty_print_option (code, data, len, emit_commas, emit_quotes) case 'e': break; default: - warn ("%s: garbage in format string: %s\n", + log_error ("%s: garbage in format string: %s\n", dhcp_options [code].name, &(dhcp_options [code].format [i])); break; @@ -681,14 +681,14 @@ char *pretty_print_option (code, data, len, emit_commas, emit_quotes) /* Check for too few bytes... */ if (hunksize > len) { - warn ("%s: expecting at least %d bytes; got %d", + log_error ("%s: expecting at least %d bytes; got %d", dhcp_options [code].name, hunksize, len); return ""; } /* Check for too many bytes... */ if (numhunk == -1 && hunksize < len) - warn ("%s: %d extra bytes", + log_error ("%s: %d extra bytes", dhcp_options [code].name, len - hunksize); @@ -697,7 +697,7 @@ char *pretty_print_option (code, data, len, emit_commas, emit_quotes) numhunk = len / hunksize; /* See if we got an exact number of hunks. */ if (numhunk > 0 && numhunk * hunksize < len) - warn ("%s: %d extra bytes at end of array\n", + log_error ("%s: %d extra bytes at end of array\n", dhcp_options [code].name, len - numhunk * hunksize); @@ -753,7 +753,7 @@ char *pretty_print_option (code, data, len, emit_commas, emit_quotes) strcpy (op, *dp++ ? "true" : "false"); break; default: - warn ("Unexpected format code %c", fmtbuf [j]); + log_error ("Unexpected format code %c", fmtbuf [j]); } op += strlen (op); if (j + 1 < numelem && comma != ':') @@ -788,7 +788,7 @@ void do_packet (interface, packet, len, from_port, from, hfrom) tp.haddr = hfrom; if (packet -> hlen > sizeof packet -> chaddr) { - note ("Discarding packet with bogus hardware address length."); + log_info ("Discarding packet with bogus hardware address length."); return; } if (!parse_options (&tp)) { @@ -907,7 +907,7 @@ static void do_option_set (hash, option, op) case eval_statement: case break_statement: default: - warn ("bogus statement type in do_option_set."); + log_error ("bogus statement type in do_option_set."); break; case default_option_statement: @@ -933,7 +933,7 @@ static void do_option_set (hash, option, op) if (!oc -> expression && oc -> data.len) { if (!expression_allocate (&oc -> expression, "do_option_set")) { - warn ("Can't allocate const expression."); + log_error ("Can't allocate const expression."); break; } oc -> expression -> op = expr_const_data; @@ -1011,7 +1011,7 @@ void save_option (hash, oc) /* Otherwise, just put the new one at the head of the list. */ bptr = new_pair ("save_option"); if (!bptr) { - warn ("No memory for option_cache reference."); + log_error ("No memory for option_cache reference."); return; } bptr -> cdr = hash [hashix]; @@ -1058,7 +1058,7 @@ int option_cache_dereference (ptr, name) char *name; { if (!ptr || !*ptr) { - warn ("Null pointer in option_cache_dereference: %s", name); + log_error ("Null pointer in option_cache_dereference: %s", name); abort (); } diff --git a/common/packet.c b/common/packet.c index f1725144..c6da2a7c 100644 --- a/common/packet.c +++ b/common/packet.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: packet.c,v 1.19 1998/03/16 06:14:08 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: packet.c,v 1.20 1999/02/24 17:56:47 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -63,13 +63,13 @@ u_int32_t checksum (buf, nbytes, sum) int i; #ifdef DEBUG_CHECKSUM - debug ("checksum (%x %d %x)", buf, nbytes, sum); + log_debug ("checksum (%x %d %x)", buf, nbytes, sum); #endif /* Checksum all the pairs of bytes first... */ for (i = 0; i < (nbytes & ~1); i += 2) { #ifdef DEBUG_CHECKSUM_VERBOSE - debug ("sum = %x", sum); + log_debug ("sum = %x", sum); #endif sum += (u_int16_t) ntohs(*((u_int16_t *)(buf + i))); } @@ -78,7 +78,7 @@ u_int32_t checksum (buf, nbytes, sum) byte order is big-endian, so the remaining byte is the high byte. */ if (i < nbytes) { #ifdef DEBUG_CHECKSUM_VERBOSE - debug ("sum = %x", sum); + log_debug ("sum = %x", sum); #endif sum += buf [i] << 8; } @@ -93,26 +93,26 @@ u_int32_t wrapsum (sum) u_int32_t sum; { #ifdef DEBUG_CHECKSUM - debug ("wrapsum (%x)", sum); + log_debug ("wrapsum (%x)", sum); #endif while (sum > 0x10000) { sum = (sum >> 16) + (sum & 0xFFFF); #ifdef DEBUG_CHECKSUM_VERBOSE - debug ("sum = %x", sum); + log_debug ("sum = %x", sum); #endif sum += (sum >> 16); #ifdef DEBUG_CHECKSUM_VERBOSE - debug ("sum = %x", sum); + log_debug ("sum = %x", sum); #endif } sum = sum ^ 0xFFFF; #ifdef DEBUG_CHECKSUM_VERBOSE - debug ("sum = %x", sum); + log_debug ("sum = %x", sum); #endif #ifdef DEBUG_CHECKSUM - debug ("wrapsum returns %x", htons (sum)); + log_debug ("wrapsum returns %x", htons (sum)); #endif return htons(sum); } @@ -267,7 +267,7 @@ ssize_t decode_udp_ip_header (interface, buf, bufix, from, data, len) /* Check the IP header checksum - it should be zero. */ if (wrapsum (checksum (buf + bufix, ip_len, 0))) { - note ("Bad IP checksum: %x", + log_info ("Bad IP checksum: %x", wrapsum (checksum (buf + bufix, sizeof *ip, 0))); return -1; } @@ -298,7 +298,7 @@ ssize_t decode_udp_ip_header (interface, buf, bufix, from, data, len) ntohs (udp -> uh_ulen))))); if (usum && usum != sum) { - note ("Bad udp checksum: %x %x", usum, sum); + log_info ("Bad udp checksum: %x %x", usum, sum); return -1; } #endif diff --git a/common/parse.c b/common/parse.c index d8132b51..7ac0149e 100644 --- a/common/parse.c +++ b/common/parse.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: parse.c,v 1.12 1999/02/14 18:54:03 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: parse.c,v 1.13 1999/02/24 17:56:47 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -132,7 +132,7 @@ char *parse_string (cfile) } s = (char *)malloc (strlen (val) + 1); if (!s) - error ("no memory for string %s.", val); + log_fatal ("no memory for string %s.", val); strcpy (s, val); if (!parse_semi (cfile)) @@ -166,7 +166,7 @@ char *parse_host_name (cfile) /* Store this identifier... */ if (!(s = (char *)malloc (strlen (val) + 1))) - error ("can't allocate temp space for hostname."); + log_fatal ("can't allocate temp space for hostname."); strcpy (s, val); c = cons ((caddr_t)s, c); len += strlen (s) + 1; @@ -179,7 +179,7 @@ char *parse_host_name (cfile) /* Assemble the hostname together into a string. */ if (!(s = (char *)malloc (len))) - error ("can't allocate space for hostname."); + log_fatal ("can't allocate space for hostname."); t = s + len; *--t = 0; while (c) { @@ -375,7 +375,7 @@ unsigned char *parse_numeric_aggregate (cfile, buf, if (!bufp && *max) { bufp = (unsigned char *)malloc (*max * size / 8); if (!bufp) - error ("can't allocate space for numeric aggregate"); + log_fatal ("can't allocate space for numeric aggregate"); } else s = bufp; @@ -416,7 +416,7 @@ unsigned char *parse_numeric_aggregate (cfile, buf, } else { t = (unsigned char *)malloc (strlen (val) + 1); if (!t) - error ("no temp space for number."); + log_fatal ("no temp space for number."); strcpy ((char *)t, val); c = cons ((caddr_t)t, c); } @@ -426,7 +426,7 @@ unsigned char *parse_numeric_aggregate (cfile, buf, if (c) { bufp = (unsigned char *)malloc (count * size / 8); if (!bufp) - error ("can't allocate space for numeric aggregate."); + log_fatal ("can't allocate space for numeric aggregate."); s = bufp + count - size / 8; *max = count; } @@ -486,11 +486,11 @@ void convert_num (buf, str, base, size) else if (tval >= '0') tval -= '0'; else { - warn ("Bogus number: %s.", str); + log_error ("Bogus number: %s.", str); break; } if (tval >= base) { - warn ("Bogus number: %s: digit %d not in base %d\n", + log_error ("Bogus number: %s: digit %d not in base %d\n", str, tval, base); break; } @@ -504,15 +504,15 @@ void convert_num (buf, str, base, size) if (val > max) { switch (base) { case 8: - warn ("value %s%o exceeds max (%d) for precision.", + log_error ("value %s%o exceeds max (%d) for precision.", negative ? "-" : "", val, max); break; case 16: - warn ("value %s%x exceeds max (%d) for precision.", + log_error ("value %s%x exceeds max (%d) for precision.", negative ? "-" : "", val, max); break; default: - warn ("value %s%u exceeds max (%d) for precision.", + log_error ("value %s%u exceeds max (%d) for precision.", negative ? "-" : "", val, max); break; } @@ -530,7 +530,7 @@ void convert_num (buf, str, base, size) putLong (buf, -(unsigned long)val); break; default: - warn ("Unexpected integer size: %d\n", size); + log_error ("Unexpected integer size: %d\n", size); break; } } else { @@ -545,7 +545,7 @@ void convert_num (buf, str, base, size) putULong (buf, val); break; default: - warn ("Unexpected integer size: %d\n", size); + log_error ("Unexpected integer size: %d\n", size); break; } } @@ -738,7 +738,7 @@ struct option *parse_option_name (cfile) } vendor = malloc (strlen (val) + 1); if (!vendor) - error ("no memory for vendor information."); + log_fatal ("no memory for vendor information."); strcpy (vendor, val); token = peek_token (&val, cfile); if (token == DOT) { @@ -828,7 +828,7 @@ int parse_cshl (data, cfile) sizeof (struct option_tag), "parse_cshl"); if (!next) - error ("no memory for string list."); + log_fatal ("no memory for string list."); memcpy (next -> data, ibuf, ilen); *last = next; last = &next -> next; @@ -844,7 +844,7 @@ int parse_cshl (data, cfile) } while (1); if (!buffer_allocate (&data -> buffer, tlen + ilen, "parse_cshl")) - error ("no memory to store octet data."); + log_fatal ("no memory to store octet data."); data -> data = &data -> buffer -> data [0]; data -> len = tlen + ilen; data -> terminated = 0; @@ -995,7 +995,7 @@ struct executable_statement *parse_executable_statement (cfile, lose) dmalloc (sizeof (struct executable_statement), "parse_executable_statement")); if (!stmt) - error ("no memory for new statement."); + log_fatal ("no memory for new statement."); *stmt = base; return stmt; } @@ -1091,7 +1091,7 @@ struct executable_statement *parse_if_statement (cfile, lose) dmalloc (sizeof (struct executable_statement), "parse_if_statement")); if (!stmt) - error ("no memory for if statement."); + log_fatal ("no memory for if statement."); memset (stmt, 0, sizeof *stmt); stmt -> op = if_statement; stmt -> data.ie.expr = if_condition; @@ -1218,7 +1218,7 @@ int parse_non_binary (expr, cfile, lose, context) return 0; } if (!expression_allocate (expr, "parse_expression: CHECK")) - error ("can't allocate expression"); + log_fatal ("can't allocate expression"); (*expr) -> op = expr_check; (*expr) -> data.check = col; break; @@ -1226,7 +1226,7 @@ int parse_non_binary (expr, cfile, lose, context) case NOT: token = next_token (&val, cfile); if (!expression_allocate (expr, "parse_expression: NOT")) - error ("can't allocate expression"); + log_fatal ("can't allocate expression"); (*expr) -> op = expr_not; if (!parse_non_binary (&(*expr) -> data.not, cfile, lose, context)) { @@ -1243,7 +1243,7 @@ int parse_non_binary (expr, cfile, lose, context) case EXISTS: token = next_token (&val, cfile); if (!expression_allocate (expr, "parse_expression: EXISTS")) - error ("can't allocate expression"); + log_fatal ("can't allocate expression"); (*expr) -> op = expr_exists; (*expr) -> data.option = parse_option_name (cfile); if (!(*expr) -> data.option) { @@ -1257,7 +1257,7 @@ int parse_non_binary (expr, cfile, lose, context) case SUBSTRING: token = next_token (&val, cfile); if (!expression_allocate (expr, "parse_expression: SUBSTRING")) - error ("can't allocate expression"); + log_fatal ("can't allocate expression"); (*expr) -> op = expr_substring; token = next_token (&val, cfile); @@ -1327,7 +1327,7 @@ int parse_non_binary (expr, cfile, lose, context) case SUFFIX: token = next_token (&val, cfile); if (!expression_allocate (expr, "parse_expression: SUFFIX")) - error ("can't allocate expression"); + log_fatal ("can't allocate expression"); (*expr) -> op = expr_suffix; token = next_token (&val, cfile); @@ -1354,7 +1354,7 @@ int parse_non_binary (expr, cfile, lose, context) case OPTION: token = next_token (&val, cfile); if (!expression_allocate (expr, "parse_expression: OPTION")) - error ("can't allocate expression"); + log_fatal ("can't allocate expression"); (*expr) -> op = expr_option; (*expr) -> data.option = parse_option_name (cfile); if (!(*expr) -> data.option) { @@ -1368,14 +1368,14 @@ int parse_non_binary (expr, cfile, lose, context) case HARDWARE: token = next_token (&val, cfile); if (!expression_allocate (expr, "parse_expression: HARDWARE")) - error ("can't allocate expression"); + log_fatal ("can't allocate expression"); (*expr) -> op = expr_hardware; break; case PACKET: token = next_token (&val, cfile); if (!expression_allocate (expr, "parse_expression: PACKET")) - error ("can't allocate expression"); + log_fatal ("can't allocate expression"); (*expr) -> op = expr_packet; token = next_token (&val, cfile); @@ -1402,7 +1402,7 @@ int parse_non_binary (expr, cfile, lose, context) case STRING: token = next_token (&val, cfile); if (!make_const_data (expr, val, strlen (val), 1, 1)) - error ("can't make constant string expression."); + log_fatal ("can't make constant string expression."); break; case EXTRACT_INT: @@ -1416,7 +1416,7 @@ int parse_non_binary (expr, cfile, lose, context) if (!expression_allocate (expr, "parse_expression: EXTRACT_INT")) - error ("can't allocate expression"); + log_fatal ("can't allocate expression"); if (!parse_data_expression (&(*expr) -> data.extract_int, cfile, lose)) { @@ -1474,7 +1474,7 @@ int parse_non_binary (expr, cfile, lose, context) case NUMBER: if (!expression_allocate (expr, "parse_expression: NUMBER")) - error ("can't allocate expression"); + log_fatal ("can't allocate expression"); /* If we're in a numeric context, this should just be a number, by itself. */ @@ -1583,7 +1583,7 @@ int parse_expression (expr, cfile, lose, context, plhs, binop) if (next_op == expr_none) { if (!expression_allocate (expr, "parse_expression: COMBINE")) - error ("Can't allocate expression!"); + log_fatal ("Can't allocate expression!"); (*expr) -> op = binop; /* All the binary operators' data union members @@ -1620,7 +1620,7 @@ int parse_expression (expr, cfile, lose, context, plhs, binop) /* Now combine the LHS and the RHS using binop. */ tmp = (struct expression *)0; if (!expression_allocate (&tmp, "parse_expression: COMBINE2")) - error ("No memory for equal precedence combination."); + log_fatal ("No memory for equal precedence combination."); /* Store the LHS and RHS. */ tmp -> data.equal [0] = lhs; @@ -1727,7 +1727,7 @@ struct executable_statement *parse_option_statement (cfile, lookups, stmt -> op = op; if (expr && !option_cache (&stmt -> data.option, (struct data_string *)0, expr, option)) - error ("no memory for option cache in parse_option_statement"); + log_fatal ("no memory for option cache in parse_option_statement"); return stmt; } @@ -1760,7 +1760,7 @@ int parse_option_token (rv, cfile, fmt, expr, uniform, lookups) token = next_token (&val, cfile); if (!make_const_data (&t, (unsigned char *) val, strlen (val), 1, 1)) - error ("No memory for concatenation"); + log_fatal ("No memory for concatenation"); } else { parse_warn ("expecting string %s.", "or hexadecimal data"); @@ -1779,7 +1779,7 @@ int parse_option_token (rv, cfile, fmt, expr, uniform, lookups) } if (!make_const_data (&t, (unsigned char *)val, strlen (val), 1, 1)) - error ("No memory for concatenation"); + log_fatal ("No memory for concatenation"); break; case 'I': /* IP address or hostname. */ @@ -1853,7 +1853,7 @@ int parse_option_token (rv, cfile, fmt, expr, uniform, lookups) break; 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; diff --git a/common/print.c b/common/print.c index 98b0a2b2..245c904f 100644 --- a/common/print.c +++ b/common/print.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: print.c,v 1.19 1999/02/14 18:55:01 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: print.c,v 1.20 1999/02/24 17:56:47 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -76,26 +76,26 @@ void print_lease (lease) struct tm *t; char tbuf [32]; - debug (" Lease %s", + log_debug (" Lease %s", piaddr (lease -> ip_addr)); t = gmtime (&lease -> starts); strftime (tbuf, sizeof tbuf, "%Y/%m/%d %H:%M:%S", t); - debug (" start %s", tbuf); + log_debug (" start %s", tbuf); t = gmtime (&lease -> ends); strftime (tbuf, sizeof tbuf, "%Y/%m/%d %H:%M:%S", t); - debug (" end %s", tbuf); + log_debug (" end %s", tbuf); t = gmtime (&lease -> timestamp); strftime (tbuf, sizeof tbuf, "%Y/%m/%d %H:%M:%S", t); - debug (" stamp %s", tbuf); + log_debug (" stamp %s", tbuf); - debug (" hardware addr = %s", + log_debug (" hardware addr = %s", print_hw_addr (lease -> hardware_addr.htype, lease -> hardware_addr.hlen, lease -> hardware_addr.haddr)); - debug (" host %s ", + log_debug (" host %s ", lease -> host ? lease -> host -> name : ""); } @@ -105,37 +105,37 @@ void dump_packet (tp) { struct dhcp_packet *tdp = tp -> raw; - debug ("packet length %d", tp -> packet_length); - debug ("op = %d htype = %d hlen = %d hops = %d", + log_debug ("packet length %d", tp -> packet_length); + log_debug ("op = %d htype = %d hlen = %d hops = %d", tdp -> op, tdp -> htype, tdp -> hlen, tdp -> hops); - debug ("xid = %x secs = %d flags = %x", + log_debug ("xid = %x secs = %d flags = %x", tdp -> xid, tdp -> secs, tdp -> flags); - debug ("ciaddr = %s", inet_ntoa (tdp -> ciaddr)); - debug ("yiaddr = %s", inet_ntoa (tdp -> yiaddr)); - debug ("siaddr = %s", inet_ntoa (tdp -> siaddr)); - debug ("giaddr = %s", inet_ntoa (tdp -> giaddr)); - debug ("chaddr = %02.2x:%02.2x:%02.2x:%02.2x:%02.2x:%02.2x", + log_debug ("ciaddr = %s", inet_ntoa (tdp -> ciaddr)); + log_debug ("yiaddr = %s", inet_ntoa (tdp -> yiaddr)); + log_debug ("siaddr = %s", inet_ntoa (tdp -> siaddr)); + log_debug ("giaddr = %s", inet_ntoa (tdp -> giaddr)); + log_debug ("chaddr = %02.2x:%02.2x:%02.2x:%02.2x:%02.2x:%02.2x", ((unsigned char *)(tdp -> chaddr)) [0], ((unsigned char *)(tdp -> chaddr)) [1], ((unsigned char *)(tdp -> chaddr)) [2], ((unsigned char *)(tdp -> chaddr)) [3], ((unsigned char *)(tdp -> chaddr)) [4], ((unsigned char *)(tdp -> chaddr)) [5]); - debug ("filename = %s", tdp -> file); - debug ("server_name = %s", tdp -> sname); + log_debug ("filename = %s", tdp -> file); + log_debug ("server_name = %s", tdp -> sname); if (tp -> options_valid) { int i; for (i = 0; i < 256; i++) { if (tp -> options [i].data) - debug (" %s = %s", + log_debug (" %s = %s", dhcp_options [i].name, pretty_print_option (i, tp -> options [i].data, tp -> options [i].len, 1, 1)); } } - debug (""); + log_debug (""); } #endif @@ -152,7 +152,7 @@ void dump_raw (buf, len) for (i = 0; i < len; i++) { if ((i & 15) == 0) { if (lbix) - note (lbuf); + log_info (lbuf); sprintf (lbuf, "%03x:", i); lbix = 4; } else if ((i & 7) == 0) @@ -160,7 +160,7 @@ void dump_raw (buf, len) sprintf (&lbuf [lbix], " %02x", buf [i]); lbix += 3; } - note (lbuf); + log_info (lbuf); } void hash_dump (table) @@ -175,12 +175,12 @@ void hash_dump (table) for (i = 0; i < table -> hash_count; i++) { if (!table -> buckets [i]) continue; - note ("hash bucket %d:", i); + log_info ("hash bucket %d:", i); for (bp = table -> buckets [i]; bp; bp = bp -> next) { if (bp -> len) dump_raw (bp -> name, bp -> len); else - note ((char *)bp -> name); + log_info ((char *)bp -> name); } } } @@ -526,6 +526,6 @@ void print_expression (name, expr) char buf [1024]; print_subexpression (expr, buf, sizeof buf); - note ("%s: %s", name, buf); + log_info ("%s: %s", name, buf); } diff --git a/common/raw.c b/common/raw.c index 973ede13..7f4047e9 100644 --- a/common/raw.c +++ b/common/raw.c @@ -54,7 +54,7 @@ #ifndef lint static char copyright[] = -"$Id: raw.c,v 1.11 1997/10/20 21:47:14 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: raw.c,v 1.12 1999/02/24 17:56:47 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -79,25 +79,25 @@ void if_register_send (info) /* List addresses on which we're listening. */ if (!quiet_interface_discovery) - note ("Sending on %s, port %d", + log_info ("Sending on %s, port %d", piaddr (info -> address), htons (local_port)); if ((sock = socket (AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0) - error ("Can't create dhcp socket: %m"); + log_fatal ("Can't create dhcp socket: %m"); /* Set the BROADCAST option so that we can broadcast DHCP responses. */ flag = 1; if (setsockopt (sock, SOL_SOCKET, SO_BROADCAST, &flag, sizeof flag) < 0) - error ("Can't set SO_BROADCAST option on dhcp socket: %m"); + log_fatal ("Can't set SO_BROADCAST option on dhcp socket: %m"); /* Set the IP_HDRINCL flag so that we can supply our own IP headers... */ if (setsockopt (sock, IPPROTO_IP, IP_HDRINCL, &flag, sizeof flag) < 0) - error ("Can't set IP_HDRINCL flag: %m"); + log_fatal ("Can't set IP_HDRINCL flag: %m"); info -> wfdesc = sock; if (!quiet_interface_discovery) - note ("Sending on Raw/%s/%s", + log_info ("Sending on Raw/%s/%s", info -> name, (info -> shared_network ? info -> shared_network -> name : "unattached")); diff --git a/common/resolv.c b/common/resolv.c index 30077ba7..bb2627a1 100644 --- a/common/resolv.c +++ b/common/resolv.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: resolv.c,v 1.6 1998/01/12 01:01:44 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: resolv.c,v 1.7 1999/02/24 17:56:48 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -67,7 +67,7 @@ void read_resolv_conf (parse_time) eol_token = 1; if ((cfile = fopen (path_resolv_conf, "r")) == NULL) { - warn ("Can't open %s: %m", path_resolv_conf); + log_error ("Can't open %s: %m", path_resolv_conf); return; } @@ -96,7 +96,7 @@ void read_resolv_conf (parse_time) nd = new_domain_search_list ("read_resolv_conf"); if (!nd) - error ("No memory for %s", dn); + log_fatal ("No memory for %s", dn); nd -> next = (struct domain_search_list *)0; *dp = nd; @@ -127,7 +127,7 @@ void read_resolv_conf (parse_time) if (!ns) { ns = new_name_server ("read_resolv_conf"); if (!ns) - error ("No memory for nameserver %s", + log_fatal ("No memory for nameserver %s", piaddr (iaddr)); ns -> next = (struct name_server *)0; *sp = ns; @@ -192,7 +192,7 @@ struct name_server *first_name_server () /* Check /etc/resolv.conf and reload it if it's changed. */ if (cur_time > rcdate) { if (stat (path_resolv_conf, &st) < 0) { - warn ("Can't stat %s", path_resolv_conf); + log_error ("Can't stat %s", path_resolv_conf); return (struct name_server *)0; } if (st.st_mtime > rcdate) { diff --git a/common/socket.c b/common/socket.c index ff9b8f50..9d594345 100644 --- a/common/socket.c +++ b/common/socket.c @@ -50,7 +50,7 @@ #ifndef lint static char copyright[] = -"$Id: socket.c,v 1.29 1999/02/14 19:40:21 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: socket.c,v 1.30 1999/02/24 17:56:48 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -105,7 +105,7 @@ int if_register_socket (info) #if !defined (SO_BINDTODEVICE) && !defined (USE_FALLBACK) /* Make sure only one interface is registered. */ if (once) - error ("The standard socket API can only support %s", + log_fatal ("The standard socket API can only support %s", "hosts with a single network interface."); once = 1; #endif @@ -118,23 +118,23 @@ int if_register_socket (info) /* Make a socket... */ if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) - error ("Can't create dhcp socket: %m"); + log_fatal ("Can't create dhcp socket: %m"); /* Set the REUSEADDR option so that we don't fail to start if we're being restarted. */ flag = 1; if (setsockopt (sock, SOL_SOCKET, SO_REUSEADDR, (char *)&flag, sizeof flag) < 0) - error ("Can't set SO_REUSEADDR option on dhcp socket: %m"); + log_fatal ("Can't set SO_REUSEADDR option on dhcp socket: %m"); /* Set the BROADCAST option so that we can broadcast DHCP responses. */ if (setsockopt (sock, SOL_SOCKET, SO_BROADCAST, (char *)&flag, sizeof flag) < 0) - error ("Can't set SO_BROADCAST option on dhcp socket: %m"); + log_fatal ("Can't set SO_BROADCAST option on dhcp socket: %m"); /* Bind the socket to this interface's IP address. */ if (bind (sock, (struct sockaddr *)&name, sizeof name) < 0) - error ("Can't bind to dhcp address: %m"); + log_fatal ("Can't bind to dhcp address: %m"); #if defined (SO_BINDTODEVICE) /* Bind this socket to this interface. */ @@ -159,7 +159,7 @@ void if_register_send (info) info -> wfdesc = info -> rfdesc; #endif if (!quiet_interface_discovery) - note ("Sending on Socket/%s/%s", + log_info ("Sending on Socket/%s/%s", info -> name, (info -> shared_network ? info -> shared_network -> name : "unattached")); @@ -175,7 +175,7 @@ void if_register_receive (info) we don't need to register this interface twice. */ info -> rfdesc = if_register_socket (info); if (!quiet_interface_discovery) - note ("Listening on Socket/%s/%s", + log_info ("Listening on Socket/%s/%s", info -> name, (info -> shared_network ? info -> shared_network -> name : "unattached")); @@ -252,7 +252,7 @@ void fallback_discard (protocol) status = recvfrom (interface -> wfdesc, buf, sizeof buf, 0, (struct sockaddr *)&from, &flen); if (status < 0) - warn ("fallback_discard: %m"); + log_error ("fallback_discard: %m"); } #endif /* USE_SOCKET_SEND */ diff --git a/common/sysconf.c b/common/sysconf.c index 09146cfa..252a0b47 100644 --- a/common/sysconf.c +++ b/common/sysconf.c @@ -44,7 +44,7 @@ #ifndef lint static char copyright[] = -"$Id: sysconf.c,v 1.4 1998/03/16 06:14:51 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: sysconf.c,v 1.5 1999/02/24 17:56:48 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -61,12 +61,12 @@ void sysconf_startup (handler) /* Only initialize sysconf once. */ if (sysconf_initialized) - error ("attempted to reinitialize sysconf protocol"); + log_fatal ("attempted to reinitialize sysconf protocol"); sysconf_initialized = 1; sysconf_fd = socket (AF_UNIX, SOCK_STREAM, 0); if (sysconf_fd < 0) - error ("unable to create sysconf socket: %m"); + log_fatal ("unable to create sysconf socket: %m"); /* XXX for now... */ name.sun_family = PF_UNIX; @@ -79,7 +79,7 @@ void sysconf_startup (handler) if (connect (sysconf_fd, (struct sockaddr *)&name, len) < 0) { if (!once) - warn ("can't connect to sysconf socket: %m"); + log_error ("can't connect to sysconf socket: %m"); once = 1; close (sysconf_fd); sysconf_initialized = 0; @@ -108,26 +108,26 @@ void sysconf_message (proto) status = read (sysconf_fd, &hdr, sizeof hdr); if (status < 0) { - warn ("sysconf_message: %m"); + log_error ("sysconf_message: %m"); lose: add_timeout (cur_time + 60, sysconf_restart, proto -> local); remove_protocol (proto); return; } if (status < sizeof (hdr)) { - warn ("sysconf_message: short message"); + log_error ("sysconf_message: short message"); goto lose; } if (hdr.length) { buf = malloc (hdr.length); if (!buf) - error ("sysconf_message: can't buffer payload"); + log_fatal ("sysconf_message: can't buffer payload"); status = read (sysconf_fd, buf, hdr.length); if (status < 0) - error ("sysconf_message payload read: %m"); + log_fatal ("sysconf_message payload read: %m"); if (status != hdr.length) - error ("sysconf_message payload: short read"); + log_fatal ("sysconf_message payload: short read"); } else buf = (char *)0; diff --git a/common/tables.c b/common/tables.c index 841dbb21..7542a5cc 100644 --- a/common/tables.c +++ b/common/tables.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: tables.c,v 1.18 1999/02/14 18:56:37 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: tables.c,v 1.19 1999/02/24 17:56:48 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -1114,7 +1114,7 @@ void initialize_universes() dhcp_universe.set_func = dhcp_option_set; dhcp_universe.hash = new_hash (); if (!dhcp_universe.hash) - error ("Can't allocate dhcp option hash table."); + log_fatal ("Can't allocate dhcp option hash table."); for (i = 0; i < 256; i++) { dhcp_universe.options [i] = &dhcp_options [i]; add_hash (dhcp_universe.hash, @@ -1127,7 +1127,7 @@ void initialize_universes() agent_universe.lookup_func = agent_suboption_lookup; agent_universe.hash = new_hash (); if (!agent_universe.hash) - error ("Can't allocate agent option hash table."); + log_fatal ("Can't allocate agent option hash table."); for (i = 0; i < 256; i++) { agent_universe.options [i] = &agent_options [i]; add_hash (agent_universe.hash, @@ -1141,7 +1141,7 @@ void initialize_universes() server_universe.set_func = server_option_set; server_universe.hash = new_hash (); if (!server_universe.hash) - error ("Can't allocate server option hash table."); + log_fatal ("Can't allocate server option hash table."); for (i = 0; i < 256; i++) { server_universe.options [i] = &server_options [i]; add_hash (server_universe.hash, diff --git a/common/tree.c b/common/tree.c index a3690a20..40fedfda 100644 --- a/common/tree.c +++ b/common/tree.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: tree.c,v 1.18 1998/11/09 02:45:02 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; +"$Id: tree.c,v 1.19 1999/02/24 17:56:48 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -56,7 +56,7 @@ pair cons (car, cdr) { pair foo = (pair)dmalloc (sizeof *foo, "cons"); if (!foo) - error ("no memory for cons."); + log_fatal ("no memory for cons."); foo -> car = car; foo -> cdr = cdr; return foo; @@ -78,13 +78,13 @@ int make_const_option_cache (oc, buffer, data, len, option, name) } else { bp = (struct buffer *)0; if (!buffer_allocate (&bp, len, name)) { - warn ("%s: can't allocate buffer.", name); + log_error ("%s: can't allocate buffer.", name); return 0; } } if (!option_cache_allocate (oc, name)) { - warn ("%s: can't allocate option cache."); + log_error ("%s: can't allocate option cache."); buffer_dereference (&bp, name); return 0; } @@ -103,7 +103,7 @@ int make_host_lookup (expr, name) char *name; { if (!expression_allocate (expr, "make_host_lookup")) { - warn ("No memory for host lookup tree node."); + log_error ("No memory for host lookup tree node."); return 0; } (*expr) -> op = expr_host_lookup; @@ -123,7 +123,7 @@ int enter_dns_host (dh, name) XXX already exists, if possible, rather than creating XXX a new structure. */ if (!dns_host_entry_allocate (dh, name, "enter_dns_host")) { - warn ("Can't allocate space for new host."); + log_error ("Can't allocate space for new host."); return 0; } return 1; @@ -139,7 +139,7 @@ int make_const_data (expr, data, len, terminated, allocate) struct expression *nt; if (!expression_allocate (expr, "make_host_lookup")) { - warn ("No memory for make_const_data tree node."); + log_error ("No memory for make_const_data tree node."); return 0; } nt = *expr; @@ -149,7 +149,7 @@ int make_const_data (expr, data, len, terminated, allocate) if (!buffer_allocate (&nt -> data.const_data.buffer, len + terminated, "make_const_data")) { - warn ("Can't allocate const_data buffer."); + log_error ("Can't allocate const_data buffer."); expression_dereference (expr, "make_const_data"); return 0; @@ -189,7 +189,7 @@ int make_concat (expr, left, right) /* Otherwise, allocate a new node to concatenate the two. */ if (!expression_allocate (expr, "make_concat")) { - warn ("No memory for concatenation expression node."); + log_error ("No memory for concatenation expression node."); return 0; } @@ -209,7 +209,7 @@ int make_substring (new, expr, offset, length) { /* Allocate an expression node to compute the substring. */ if (!expression_allocate (new, "make_substring")) { - warn ("no memory for substring expression."); + log_error ("no memory for substring expression."); return 0; } (*new) -> op = expr_substring; @@ -231,7 +231,7 @@ int make_limit (new, expr, limit) /* Allocate a node to enforce a limit on evaluation. */ if (!expression_allocate (new, "make_limit")) - warn ("no memory for limit expression"); + log_error ("no memory for limit expression"); (*new) -> op = expr_substring; expression_reference (&(*new) -> data.substring.expr, expr, "make_limit"); @@ -239,7 +239,7 @@ int make_limit (new, expr, limit) /* Offset is a constant 0. */ if (!expression_allocate (&(*new) -> data.substring.offset, "make_limit")) { - warn ("no memory for limit offset expression"); + log_error ("no memory for limit offset expression"); expression_dereference (new, "make_limit"); return 0; } @@ -249,7 +249,7 @@ int make_limit (new, expr, limit) /* Length is a constant: the specified limit. */ if (!expression_allocate (&(*new) -> data.substring.len, "make_limit")) { - warn ("no memory for limit length expression"); + log_error ("no memory for limit length expression"); expression_dereference (new, "make_limit"); return 0; } @@ -285,14 +285,14 @@ int do_host_lookup (result, dns) int new_len; #ifdef DEBUG_EVAL - debug ("time: now = %d dns = %d %d diff = %d", + log_debug ("time: now = %d dns = %d %d diff = %d", cur_time, dns -> timeout, cur_time - dns -> timeout); #endif /* If the record hasn't timed out, just copy the data and return. */ if (cur_time <= dns -> timeout) { #ifdef DEBUG_EVAL - debug ("easy copy: %d %s", + log_debug ("easy copy: %d %s", dns -> data.len, (dns -> data.len > 4 ? inet_ntoa (*(struct in_addr *)(dns -> data.data)) @@ -302,7 +302,7 @@ int do_host_lookup (result, dns) return 1; } #ifdef DEBUG_EVAL - debug ("Looking up %s", dns -> hostname); + log_debug ("Looking up %s", dns -> hostname); #endif /* Otherwise, look it up... */ @@ -312,18 +312,18 @@ int do_host_lookup (result, dns) switch (h_errno) { case HOST_NOT_FOUND: #endif - warn ("%s: host unknown.", dns -> hostname); + log_error ("%s: host unknown.", dns -> hostname); #ifndef NO_H_ERRNO break; case TRY_AGAIN: - warn ("%s: temporary name server failure", + log_error ("%s: temporary name server failure", dns -> hostname); break; case NO_RECOVERY: - warn ("%s: name server failed", dns -> hostname); + log_error ("%s: name server failed", dns -> hostname); break; case NO_DATA: - warn ("%s: no A record associated with address", + log_error ("%s: no A record associated with address", dns -> hostname); } #endif /* !NO_H_ERRNO */ @@ -335,7 +335,7 @@ int do_host_lookup (result, dns) } #ifdef DEBUG_EVAL - debug ("Lookup succeeded; first address is %s", + log_debug ("Lookup succeeded; first address is %s", inet_ntoa (h -> h_addr_list [0])); #endif @@ -350,7 +350,7 @@ int do_host_lookup (result, dns) new_len = count * h -> h_length; if (!buffer_allocate (&dns -> data.buffer, new_len, "do_host_lookup")) { - warn ("No memory for %s.", dns -> hostname); + log_error ("No memory for %s.", dns -> hostname); return 0; } @@ -365,7 +365,7 @@ int do_host_lookup (result, dns) h -> h_addr_list [i], h -> h_length); } #ifdef DEBUG_EVAL - debug ("dns -> data: %x h -> h_addr_list [0]: %x", + log_debug ("dns -> data: %x h -> h_addr_list [0]: %x", *(int *)(dns -> buffer), h -> h_addr_list [0]); #endif @@ -374,7 +374,7 @@ int do_host_lookup (result, dns) dns -> timeout = cur_time + 3600; #ifdef DEBUG_EVAL - debug ("hard copy: %d %s", dns -> data.len, + log_debug ("hard copy: %d %s", dns -> data.len, (dns -> data.len > 4 ? inet_ntoa (*(struct in_addr *)(dns -> data.data)) : 0)); #endif @@ -396,7 +396,7 @@ int evaluate_boolean_expression (result, packet, options, expr) case expr_check: *result = check_collection (packet, expr -> data.check); #if defined (DEBUG_EXPRESSIONS) - note ("bool: check (%s) returns %s", + log_info ("bool: check (%s) returns %s", expr -> data.check -> name, *result ? "true" : "false"); #endif return 1; @@ -417,7 +417,7 @@ int evaluate_boolean_expression (result, packet, options, expr) } #if defined (DEBUG_EXPRESSIONS) - note ("bool: equal (%s, %s) = %s", + log_info ("bool: equal (%s, %s) = %s", sleft ? print_hex_1 (left.len, left.data, 30) : "NULL", sright ? print_hex_2 (right.len, right.data, 30) : "NULL", @@ -440,7 +440,7 @@ int evaluate_boolean_expression (result, packet, options, expr) expr -> data.and [1]); #if defined (DEBUG_EXPRESSIONS) - note ("bool: and (%s, %s) = %s", + log_info ("bool: and (%s, %s) = %s", sleft ? (bleft ? "true" : "false") : "NULL", sright ? (bright ? "true" : "false") : "NULL", ((sleft && sright) @@ -458,7 +458,7 @@ int evaluate_boolean_expression (result, packet, options, expr) sright = evaluate_boolean_expression (&bright, packet, options, expr -> data.or [1]); #if defined (DEBUG_EXPRESSIONS) - note ("bool: or (%s, %s) = %s", + log_info ("bool: or (%s, %s) = %s", sleft ? (bleft ? "true" : "false") : "NULL", sright ? (bright ? "true" : "false") : "NULL", ((sleft && sright) @@ -474,7 +474,7 @@ int evaluate_boolean_expression (result, packet, options, expr) sleft = evaluate_boolean_expression (&bleft, packet, options, expr -> data.not); #if defined (DEBUG_EXPRESSIONS) - note ("bool: not (%s) = %s", + log_info ("bool: not (%s) = %s", sleft ? (bleft ? "true" : "false") : "NULL", ((sleft && sright) ? (!bleft ? "true" : "false") : "NULL")); @@ -497,7 +497,7 @@ int evaluate_boolean_expression (result, packet, options, expr) "evaluate_boolean_expression"); } #if defined (DEBUG_EXPRESSIONS) - note ("data: exists %s.%s = %s", + log_info ("data: exists %s.%s = %s", expr -> data.option -> universe -> name, expr -> data.option -> name, *result ? "true" : "false"); #endif @@ -511,7 +511,7 @@ int evaluate_boolean_expression (result, packet, options, expr) case expr_packet: case expr_concat: case expr_host_lookup: - warn ("Data opcode in evaluate_boolean_expression: %d", + log_error ("Data opcode in evaluate_boolean_expression: %d", expr -> op); return 0; @@ -519,12 +519,12 @@ int evaluate_boolean_expression (result, packet, options, expr) case expr_extract_int16: case expr_extract_int32: case expr_const_int: - warn ("Numeric opcode in evaluate_boolean_expression: %d", + log_error ("Numeric opcode in evaluate_boolean_expression: %d", expr -> op); return 0; } - warn ("Bogus opcode in evaluate_boolean_expression: %d", expr -> op); + log_error ("Bogus opcode in evaluate_boolean_expression: %d", expr -> op); return 0; } @@ -570,7 +570,7 @@ int evaluate_data_expression (result, packet, options, expr) s3 = 0; #if defined (DEBUG_EXPRESSIONS) - note ("data: substring (%s, %s, %s) = %s", + log_info ("data: substring (%s, %s, %s) = %s", s0 ? print_hex_1 (data.len, data.data, 30) : "NULL", s1 ? print_dec_1 (offset) : "NULL", s2 ? print_dec_2 (len) : "NULL", @@ -607,7 +607,7 @@ int evaluate_data_expression (result, packet, options, expr) } #if defined (DEBUG_EXPRESSIONS) - note ("data: suffix (%s, %d) = %s", + log_info ("data: suffix (%s, %d) = %s", s0 ? print_hex_1 (data.len, data.data, 30) : "NULL", s1 ? print_dec_1 (len) : "NULL", ((s0 && s1) @@ -621,7 +621,7 @@ int evaluate_data_expression (result, packet, options, expr) s0 = ((*expr -> data.option -> universe -> lookup_func) (result, options, expr -> data.option -> code)); #if defined (DEBUG_EXPRESSIONS) - note ("data: option %s.%s = %s", + log_info ("data: option %s.%s = %s", expr -> data.option -> universe -> name, expr -> data.option -> name, s0 ? print_hex_1 (result -> len, result -> data, 60) @@ -632,7 +632,7 @@ int evaluate_data_expression (result, packet, options, expr) /* Combine the hardware type and address. */ case expr_hardware: if (!packet || !packet -> raw) { - warn ("data: hardware: raw packet not available"); + log_error ("data: hardware: raw packet not available"); return 0; } result -> len = packet -> raw -> hlen + 1; @@ -644,11 +644,11 @@ int evaluate_data_expression (result, packet, options, expr) packet -> raw -> hlen); result -> terminated = 0; } else { - warn ("data: hardware: no memory for buffer."); + log_error ("data: hardware: no memory for buffer."); return 0; } #if defined (DEBUG_EXPRESSIONS) - note ("data: hardware = %s", + log_info ("data: hardware = %s", print_hex_1 (result -> len, result -> data, 60)); #endif return 1; @@ -656,7 +656,7 @@ int evaluate_data_expression (result, packet, options, expr) /* Extract part of the raw packet. */ case expr_packet: if (!packet || !packet -> raw) { - warn ("data: packet: raw packet not available"); + log_error ("data: packet: raw packet not available"); return 0; } @@ -678,14 +678,14 @@ int evaluate_data_expression (result, packet, options, expr) + offset), result -> len); result -> terminated = 0; } else { - warn ("data: packet: no memory for buffer."); + log_error ("data: packet: no memory for buffer."); return 0; } s2 = 1; } else s2 = 0; #if defined (DEBUG_EXPRESSIONS) - note ("data: packet (%d, %d) = %s", + log_info ("data: packet (%d, %d) = %s", offset, len, s2 ? print_hex_1 (result -> len, result -> data, 60) : NULL); @@ -695,7 +695,7 @@ int evaluate_data_expression (result, packet, options, expr) /* Some constant data... */ case expr_const_data: #if defined (DEBUG_EXPRESSIONS) - note ("data: const = %s", + log_info ("data: const = %s", print_hex_1 (expr -> data.const_data.len, expr -> data.const_data.data, 60)); #endif @@ -708,7 +708,7 @@ int evaluate_data_expression (result, packet, options, expr) case expr_host_lookup: s0 = do_host_lookup (result, expr -> data.host_lookup); #if defined (DEBUG_EXPRESSIONS) - note ("data: DNS lookup (%s) = %s", + log_info ("data: DNS lookup (%s) = %s", expr -> data.host_lookup -> hostname, (s0 ? print_dotted_quads (result -> len, result -> data) @@ -731,7 +731,7 @@ int evaluate_data_expression (result, packet, options, expr) (result -> len + other.terminated), "expr_concat")) { - warn ("data: concat: no memory"); + log_error ("data: concat: no memory"); result -> len = 0; data_string_forget (&data, "expr_concat"); data_string_forget (&other, "expr_concat"); @@ -746,7 +746,7 @@ int evaluate_data_expression (result, packet, options, expr) else if (s1) data_string_copy (result, &other, "expr_concat"); #if defined (DEBUG_EXPRESSIONS) - note ("data: concat (%s, %s) = %s", + log_info ("data: concat (%s, %s) = %s", s0 ? print_hex_1 (data.len, data.data, 20) : "NULL", s1 ? print_hex_2 (other.len, other.data, 20) : "NULL", ((s0 || s1) @@ -761,7 +761,7 @@ int evaluate_data_expression (result, packet, options, expr) case expr_or: case expr_not: case expr_match: - warn ("Boolean opcode in evaluate_data_expression: %d", + log_error ("Boolean opcode in evaluate_data_expression: %d", expr -> op); return 0; @@ -769,12 +769,12 @@ int evaluate_data_expression (result, packet, options, expr) case expr_extract_int16: case expr_extract_int32: case expr_const_int: - warn ("Numeric opcode in evaluate_data_expression: %d", + log_error ("Numeric opcode in evaluate_data_expression: %d", expr -> op); return 0; } - warn ("Bogus opcode in evaluate_data_expression: %d", expr -> op); + log_error ("Bogus opcode in evaluate_data_expression: %d", expr -> op); return 0; } @@ -794,7 +794,7 @@ int evaluate_numeric_expression (result, packet, options, expr) case expr_or: case expr_not: case expr_match: - warn ("Boolean opcode in evaluate_numeric_expression: %d", + log_error ("Boolean opcode in evaluate_numeric_expression: %d", expr -> op); return 0; @@ -806,7 +806,7 @@ int evaluate_numeric_expression (result, packet, options, expr) case expr_packet: case expr_concat: case expr_host_lookup: - warn ("Data opcode in evaluate_numeric_expression: %d", + log_error ("Data opcode in evaluate_numeric_expression: %d", expr -> op); return 0; @@ -818,7 +818,7 @@ int evaluate_numeric_expression (result, packet, options, expr) if (status) *result = data.data [0]; #if defined (DEBUG_EXPRESSIONS) - note ("num: extract_int8 (%s) = %s", + log_info ("num: extract_int8 (%s) = %s", status ? print_hex_1 (data.len, data.data, 60) : "NULL", status ? print_dec_1 (*result) : "NULL" ); #endif @@ -834,7 +834,7 @@ int evaluate_numeric_expression (result, packet, options, expr) if (status && data.len >= 2) *result = getUShort (data.data); #if defined (DEBUG_EXPRESSIONS) - note ("num: extract_int16 (%s) = %ld", + log_info ("num: extract_int16 (%s) = %ld", ((status && data.len >= 2) ? print_hex_1 (data.len, data.data, 60) : "NULL"), *result); @@ -851,7 +851,7 @@ int evaluate_numeric_expression (result, packet, options, expr) if (status && data.len >= 4) *result = getULong (data.data); #if defined (DEBUG_EXPRESSIONS) - note ("num: extract_int32 (%s) = %ld", + log_info ("num: extract_int32 (%s) = %ld", ((status && data.len >= 4) ? print_hex_1 (data.len, data.data, 60) : "NULL"), *result); @@ -865,7 +865,7 @@ int evaluate_numeric_expression (result, packet, options, expr) return 1; } - warn ("Bogus opcode in evaluate_numeric_expression: %d", expr -> op); + log_error ("Bogus opcode in evaluate_numeric_expression: %d", expr -> op); return 0; } @@ -954,7 +954,7 @@ void expression_dereference (eptr, name) if (--(expr -> refcnt) > 0) return; if (expr -> refcnt < 0) { - warn ("expression_dereference: negative refcnt!"); + log_error ("expression_dereference: negative refcnt!"); abort (); } diff --git a/common/upf.c b/common/upf.c index fea90fb8..4fc2f01b 100644 --- a/common/upf.c +++ b/common/upf.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: upf.c,v 1.4 1999/02/14 18:57:19 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: upf.c,v 1.5 1999/02/24 17:56:49 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -97,7 +97,7 @@ int if_register_upf (info) if (errno == EBUSY) { continue; } else { - error ("Can't find free upf: %m"); + log_fatal ("Can't find free upf: %m"); } } else { break; @@ -106,21 +106,21 @@ int if_register_upf (info) /* Set the UPF device to point at this interface. */ if (ioctl (sock, EIOCSETIF, info -> ifp) < 0) - error ("Can't attach interface %s to upf device %s: %m", + log_fatal ("Can't attach interface %s to upf device %s: %m", info -> name, filename); /* Get the hardware address. */ if (ioctl (sock, EIOCDEVP, ¶m) < 0) - error ("Can't get interface %s hardware address: %m", + log_fatal ("Can't get interface %s hardware address: %m", info -> name); /* We only know how to do ethernet. */ if (param.end_dev_type != ENDT_10MB) - error ("Invalid device type on network interface %s: %d", + log_fatal ("Invalid device type on network interface %s: %d", info -> name, param.end_dev_type); if (param.end_addr_len != 6) - error ("Invalid hardware address length on %s: %d", + log_fatal ("Invalid hardware address length on %s: %d", info -> name, param.end_addr_len); info -> hw_address.hlen = 6; @@ -143,7 +143,7 @@ void if_register_send (info) info -> wfdesc = info -> rfdesc; #endif if (!quiet_interface_discovery) - note ("Sending on UPF/%s/%s/%s", + log_info ("Sending on UPF/%s/%s/%s", info -> name, print_hw_addr (info -> hw_address.htype, info -> hw_address.hlen, @@ -172,18 +172,18 @@ void if_register_receive (info) /* Allow the copyall flag to be set... */ if (ioctl(info -> rfdesc, EIOCALLOWCOPYALL, &flag) < 0) - error ("Can't set ALLOWCOPYALL: %m"); + log_fatal ("Can't set ALLOWCOPYALL: %m"); /* Clear all the packet filter mode bits first... */ flag = (ENHOLDSIG | ENBATCH | ENTSTAMP | ENPROMISC | ENNONEXCL | ENCOPYALL); if (ioctl (info -> rfdesc, EIOCMBIC, &flag) < 0) - error ("Can't clear pfilt bits: %m"); + log_fatal ("Can't clear pfilt bits: %m"); /* Set the ENBATCH and ENCOPYALL bits... */ bits = ENBATCH | ENCOPYALL; if (ioctl (info -> rfdesc, EIOCMBIS, &bits) < 0) - error ("Can't set ENBATCH|ENCOPYALL: %m"); + log_fatal ("Can't set ENBATCH|ENCOPYALL: %m"); /* Set up the UPF filter program. */ /* XXX Unlike the BPF filter program, this one won't work if the @@ -206,9 +206,9 @@ void if_register_receive (info) pf.enf_Filter [pf.enf_FilterLen++] = local_port; if (ioctl (info -> rfdesc, EIOCSETF, &pf) < 0) - error ("Can't install packet filter program: %m"); + log_fatal ("Can't install packet filter program: %m"); if (!quiet_interface_discovery) - note ("Listening on UPF/%s/%s/%s", + log_info ("Listening on UPF/%s/%s/%s", info -> name, print_hw_addr (info -> hw_address.htype, info -> hw_address.hlen, diff --git a/dhcpctl/dhcpctl.c b/dhcpctl/dhcpctl.c index 212dd721..8d0d14df 100644 --- a/dhcpctl/dhcpctl.c +++ b/dhcpctl/dhcpctl.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: dhcpctl.c,v 1.1 1998/04/09 05:20:14 mellon Exp $ Copyright (c) 1998 The Internet Software Consortium. All rights reserved.\n"; +"$Id: dhcpctl.c,v 1.2 1999/02/24 17:56:49 mellon Exp $ Copyright (c) 1998 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -79,7 +79,7 @@ int main (argc, argv, envp) dhcpctl_fd = socket (AF_UNIX, SOCK_STREAM, 0); if (dhcpctl_fd < 0) - error ("unable to create dhcpctl socket: %m"); + log_fatal ("unable to create dhcpctl socket: %m"); /* XXX for now... */ name.sun_family = PF_UNIX; @@ -91,19 +91,19 @@ int main (argc, argv, envp) strlen (name.sun_path)); if (connect (dhcpctl_fd, (struct sockaddr *)&name, len) < 0) - error ("can't connect to dhcpctl socket: %m"); + log_fatal ("can't connect to dhcpctl socket: %m"); #if 0 if ((arg = fcntl (dhcpctl_fd, F_GETFL, 0)) < 0) - error ("Can't get flags on socket: %m"); + log_fatal ("Can't get flags on socket: %m"); arg |= O_ASYNC; if (fcntl (dhcpctl_fd, F_SETFL, arg) < 0) - error ("Can't set flags on socket: %m"); + log_fatal ("Can't set flags on socket: %m"); #endif dhcpctl = fdopen (dhcpctl_fd, "r+"); if (!dhcpctl) - error ("Can't fdopen dhcpctl socket: %m"); + log_fatal ("Can't fdopen dhcpctl socket: %m"); setlinebuf (dhcpctl); /* Read the response. */ diff --git a/includes/dhcpd.h b/includes/dhcpd.h index a0a9d0ff..9e38c4d3 100644 --- a/includes/dhcpd.h +++ b/includes/dhcpd.h @@ -812,10 +812,10 @@ int option_cache_dereference PROTO ((struct option_cache **, char *)); /* errwarn.c */ extern int warnings_occurred; -void error PROTO ((char *, ...)); -int warn PROTO ((char *, ...)); -int note PROTO ((char *, ...)); -int debug PROTO ((char *, ...)); +void log_fatal PROTO ((char *, ...)); +int log_error PROTO ((char *, ...)); +int log_info PROTO ((char *, ...)); +int log_debug PROTO ((char *, ...)); int parse_warn PROTO ((char *, ...)); /* dhcpd.c */ diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c index b3653c68..a0801143 100644 --- a/relay/dhcrelay.c +++ b/relay/dhcrelay.c @@ -42,7 +42,7 @@ #ifndef lint static char ocopyright[] = -"$Id: dhcrelay.c,v 1.18 1999/02/14 19:40:22 mellon Exp $ Copyright (c) 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: dhcrelay.c,v 1.19 1999/02/24 17:56:50 mellon Exp $ Copyright (c) 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -141,7 +141,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; @@ -150,7 +150,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]); if (++i == argc) { usage (); @@ -194,7 +194,7 @@ int main (argc, argv, envp) } else { he = gethostbyname (argv [i]); if (!he) { - warn ("%s: host unknown", argv [i]); + log_error ("%s: host unknown", argv [i]); } else { iap = ((struct in_addr *) he -> h_addr_list [0]); @@ -203,7 +203,7 @@ int main (argc, argv, envp) if (iap) { sp = (struct server_list *)malloc (sizeof *sp); if (!sp) - error ("no memory for server.\n"); + log_fatal ("no memory for server.\n"); sp -> next = servers; servers = sp; memcpy (&sp -> to.sin_addr, @@ -213,11 +213,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. */ @@ -263,7 +263,7 @@ int main (argc, argv, envp) log_perror = 0; if ((pid = fork()) < 0) - error ("can't fork daemon: %m"); + log_fatal ("can't fork daemon: %m"); else if (pid) exit (0); @@ -271,11 +271,11 @@ int main (argc, argv, envp) O_CREAT | O_TRUNC | O_WRONLY, 0644); if (pfdesc < 0) { - warn ("Can't create %s: %m", path_dhcrelay_pid); + log_error ("Can't create %s: %m", path_dhcrelay_pid); } else { pf = fdopen (pfdesc, "w"); if (!pf) - warn ("Can't fdopen %s: %m", + log_error ("Can't fdopen %s: %m", path_dhcrelay_pid); else { fprintf (pf, "%ld\n", (long)getpid ()); @@ -310,7 +310,7 @@ void relay (ip, packet, length, from_port, from, hfrom) struct hardware hto; if (packet -> hlen > sizeof packet -> chaddr) { - note ("Discarding packet with invalid hlen."); + log_info ("Discarding packet with invalid hlen."); return; } @@ -362,7 +362,7 @@ void relay (ip, packet, length, from_port, from, hfrom) return; if (!out) { - warn ("packet to bogus giaddr %s.\n", + log_error ("packet to bogus giaddr %s.\n", inet_ntoa (packet -> giaddr)); ++bogus_giaddr_drops; return; @@ -372,10 +372,10 @@ void relay (ip, packet, length, from_port, from, hfrom) (struct packet *)0, packet, length, out -> primary_address, &to, &hto) < 0) { - debug ("sendpkt: %m"); + log_debug ("sendpkt: %m"); ++server_packet_errors; } else { - debug ("forwarded BOOTREPLY for %s to %s", + log_debug ("forwarded BOOTREPLY for %s to %s", print_hw_addr (packet -> htype, packet -> hlen, packet -> chaddr), inet_ntoa (to.sin_addr)); @@ -412,10 +412,10 @@ void relay (ip, packet, length, from_port, from, hfrom) (struct packet *)0, packet, length, ip -> primary_address, &sp -> to, (struct hardware *)0) < 0) { - debug ("send_packet: %m"); + log_debug ("send_packet: %m"); ++client_packet_errors; } else { - debug ("forwarded BOOTREQUEST for %s to %s", + log_debug ("forwarded BOOTREQUEST for %s to %s", print_hw_addr (packet -> htype, packet -> hlen, packet -> chaddr), inet_ntoa (sp -> to.sin_addr)); @@ -427,7 +427,7 @@ void relay (ip, packet, length, from_port, from, hfrom) static void usage () { - error ("Usage: dhcrelay [-p ] [-d] [-D] [-i interface]\n%s%s%s", + log_fatal ("Usage: dhcrelay [-p ] [-d] [-D] [-i interface]\n%s%s%s", " ", "[-q] [-a] [-A length] [-m append|replace|forward|discard]\n", " [server1 [... serverN]]"); @@ -757,7 +757,7 @@ int add_relay_agent_options (ip, packet, length, giaddr) *sp++ = RAI_CIRCUIT_ID; /* Sanity check. Had better not every happen. */ if (ip -> circuit_id_len > 255 || ip -> circuit_id_len < 1) - error ("completely bogus circuit id length %d on %s\n", + log_fatal ("completely bogus circuit id length %d on %s\n", ip -> circuit_id_len, ip -> name); *sp++ = ip -> circuit_id_len; memcpy (sp, ip -> circuit_id, ip -> circuit_id_len); @@ -767,7 +767,7 @@ int add_relay_agent_options (ip, packet, length, giaddr) if (ip -> remote_id) { *sp++ = RAI_REMOTE_ID; if (ip -> remote_id_len > 255 || ip -> remote_id_len < 1) - error ("completely bogus remote id length %d on %s\n", + log_fatal ("completely bogus remote id length %d on %s\n", ip -> circuit_id_len, ip -> name); *sp++ = ip -> remote_id_len; memcpy (sp, ip -> remote_id, ip -> remote_id_len); @@ -777,7 +777,7 @@ int add_relay_agent_options (ip, packet, length, giaddr) /* Relay option's total length shouldn't ever get to be more than 257 bytes. */ if (sp - op > 257) - error ("total agent option length exceeds 257 (%d) on %s\n", + log_fatal ("total agent option length exceeds 257 (%d) on %s\n", sp - op, ip -> name); /* Calculate length of RAI option. */ diff --git a/server/bootp.c b/server/bootp.c index 5f742164..93852370 100644 --- a/server/bootp.c +++ b/server/bootp.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: bootp.c,v 1.37 1999/02/14 19:40:22 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: bootp.c,v 1.38 1999/02/24 17:56:50 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -81,7 +81,7 @@ void bootp (packet) if (!locate_network (packet)) { - note ("%s: network unknown", msgbuf); + log_info ("%s: network unknown", msgbuf); return; } @@ -128,7 +128,7 @@ void bootp (packet) ack_lease (packet, lease, 0, 0, msgbuf); return; } - note ("%s: no available leases", msgbuf); + log_info ("%s: no available leases", msgbuf); return; } @@ -150,14 +150,14 @@ void bootp (packet) if (evaluate_boolean_option_cache (packet, &options, lookup_option (options.dhcp_hash, SV_ALLOW_BOOTP))) { - note ("%s: bootp disallowed", msgbuf); + log_info ("%s: bootp disallowed", msgbuf); return; } if (evaluate_boolean_option_cache (packet, &options, lookup_option (options.dhcp_hash, SV_ALLOW_BOOTING))) { - note ("%s: booting disallowed", msgbuf); + log_info ("%s: booting disallowed", msgbuf); return; } @@ -244,8 +244,8 @@ void bootp (packet) from = packet -> interface -> primary_address; /* Report what we're doing... */ - note ("%s", msgbuf); - note ("BOOTREPLY for %s to %s (%s) via %s", + log_info ("%s", msgbuf); + log_info ("BOOTREPLY for %s to %s (%s) via %s", piaddr (ip_address), hp -> name, print_hw_addr (packet -> raw -> htype, packet -> raw -> hlen, @@ -272,7 +272,7 @@ void bootp (packet) &raw, outgoing.packet_length, from, &to, &hto); if (result < 0) - warn ("send_packet: %m"); + log_error ("send_packet: %m"); return; } /* Otherwise, broadcast it on the local network. */ @@ -286,5 +286,5 @@ void bootp (packet) packet, &raw, outgoing.packet_length, from, &to, &hto); if (result < 0) - warn ("send_packet: %m"); + log_error ("send_packet: %m"); } diff --git a/server/class.c b/server/class.c index 7f403f6c..1b96372f 100644 --- a/server/class.c +++ b/server/class.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: class.c,v 1.7 1998/11/11 07:58:35 mellon Exp $ Copyright (c) 1998 The Internet Software Consortium. All rights reserved.\n"; +"$Id: class.c,v 1.8 1999/02/24 17:56:51 mellon Exp $ Copyright (c) 1998 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -159,7 +159,7 @@ void classification_setup () me = (struct expression *)dmalloc (sizeof (struct expression), "default check expression"); if (!me) - error ("Can't allocate default check expression"); + log_fatal ("Can't allocate default check expression"); memset (me, 0, sizeof *me); me -> op = expr_check; me -> data.check = &default_collection; @@ -169,7 +169,7 @@ void classification_setup () dmalloc (sizeof (struct executable_statement), "add default collection check rule"); if (!rules) - error ("Can't allocate check of default collection"); + log_fatal ("Can't allocate check of default collection"); memset (rules, 0, sizeof *rules); rules -> op = eval_statement; rules -> data.eval = me; @@ -196,7 +196,7 @@ int check_collection (packet, collection) for (class = collection -> classes; class; class = class -> nic) { #if defined (DEBUG_CLASS_MATCHING) - note ("checking against class %s...", class -> name); + log_info ("checking against class %s...", class -> name); #endif memset (&data, 0, sizeof data); /* If a class is for billing, don't put the client in the @@ -211,7 +211,7 @@ int check_collection (packet, collection) data.data, data.len)))) { #if defined (DEBUG_CLASS_MATCHING) - note ("matches subclass %s.", + log_info ("matches subclass %s.", print_hex_1 (data.len, data.data, 60)); #endif @@ -222,7 +222,7 @@ int check_collection (packet, collection) continue; } #if defined (DEBUG_CLASS_MATCHING) - note ("spawning subclass %s.", + log_info ("spawning subclass %s.", print_hex_1 (data.len, data.data, 60)); #endif nc = (struct class *) @@ -240,7 +240,7 @@ int check_collection (packet, collection) sizeof (struct lease *), "check_collection")); if (!nc -> billed_leases) { - warn ("no memory for billing"); + log_error ("no memory for billing"); data_string_forget (&nc -> hash_string, "check_collection"); @@ -270,7 +270,7 @@ int check_collection (packet, collection) if (status) { matched = 1; #if defined (DEBUG_CLASS_MATCHING) - note ("matches class."); + log_info ("matches class."); #endif classify (packet, class); } @@ -285,7 +285,7 @@ void classify (packet, class) if (packet -> class_count < PACKET_MAX_CLASSES) packet -> classes [packet -> class_count++] = class; else - warn ("too many groups for %s", + log_error ("too many groups for %s", print_hw_addr (packet -> raw -> htype, packet -> raw -> hlen, packet -> raw -> chaddr)); @@ -315,7 +315,7 @@ int unbill_class (lease, class) if (class -> billed_leases [i] == lease) break; if (i == class -> lease_limit) { - warn ("lease %s unbilled with no billing arrangement.", + log_error ("lease %s unbilled with no billing arrangement.", piaddr (lease -> ip_addr)); return 0; } @@ -339,7 +339,7 @@ int bill_class (lease, class) break; if (i == class -> lease_limit) { - warn ("class billing consumption disagrees with leases."); + log_error ("class billing consumption disagrees with leases."); return 0; } diff --git a/server/confpars.c b/server/confpars.c index a8b01435..b5a9156c 100644 --- a/server/confpars.c +++ b/server/confpars.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: confpars.c,v 1.59 1999/02/23 19:07:14 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: confpars.c,v 1.60 1999/02/24 17:56:51 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -69,7 +69,7 @@ int readconf () root_group.authoritative = 0; if ((cfile = fopen (path_dhcpd_conf, "r")) == NULL) - error ("Can't open %s: %m", path_dhcpd_conf); + log_fatal ("Can't open %s: %m", path_dhcpd_conf); do { token = peek_token (&val, cfile); if (token == EOF) @@ -107,7 +107,7 @@ void read_leases () thinking that no leases have been assigned to anybody, which could create severe network chaos. */ if ((cfile = fopen (path_dhcpd_db, "r")) == NULL) - error ("Can't open lease database %s: %m -- %s", + log_fatal ("Can't open lease database %s: %m -- %s", path_dhcpd_db, "check for failed database rewrite attempt!"); do { @@ -115,7 +115,7 @@ void read_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); } else { struct lease *lease; @@ -242,7 +242,7 @@ int parse_statement (cfile, group, type, host_decl, declaration) share = new_shared_network ("parse_statement"); if (!share) - error ("No memory for shared subnet"); + log_fatal ("No memory for shared subnet"); share -> group = clone_group (group, "parse_statement:subnet"); share -> group -> shared_network = share; @@ -257,7 +257,7 @@ int parse_statement (cfile, group, type, host_decl, declaration) n = piaddr (share -> subnets -> net); t = malloc (strlen (n) + 1); if (!t) - error ("no memory for subnet name"); + log_fatal ("no memory for subnet name"); strcpy (t, n); share -> name = t; @@ -360,7 +360,7 @@ int parse_statement (cfile, group, type, host_decl, declaration) et = (struct executable_statement *)dmalloc (sizeof *et, "allow/deny"); if (!et) - error ("no memory for %s statement", + log_fatal ("no memory for %s statement", token == ALLOW ? "allow" : "deny"); memset (et, 0, sizeof *et); et -> op = supersede_option_statement; @@ -498,7 +498,7 @@ void parse_failover_peer (cfile, group, type) if (is_identifier (token) || token == STRING) { name = dmalloc (strlen (name) + 1, "peer name"); if (!peer -> name) - error ("no memory for peer name %s", name); + log_fatal ("no memory for peer name %s", name); } else { parse_warn ("expecting identifier or left brace"); skip_to_semi (cfile); @@ -552,7 +552,7 @@ void parse_failover_peer (cfile, group, type) peer = new_failover_peer ("parse_failover_peer"); if (!peer) - error ("no memory for %sfailover peer%s%s.", + log_fatal ("no memory for %sfailover peer%s%s.", name ? "" : "anonymous", name ? " " : "", name); /* Save the name. */ @@ -654,7 +654,7 @@ void parse_pool_statement (cfile, group, type) pool = new_pool ("parse_pool_statement"); if (!pool) - error ("no memory for pool."); + log_fatal ("no memory for pool."); if (!parse_lbrace (cfile)) return; @@ -669,7 +669,7 @@ void parse_pool_statement (cfile, group, type) get_permit: permit = new_permit ("parse_pool_statement"); if (!permit) - error ("no memory for permit"); + log_fatal ("no memory for permit"); next_token (&val, cfile); token = next_token (&val, cfile); switch (token) { @@ -889,7 +889,7 @@ void parse_host_declaration (cfile, group) host = (struct host_decl *)dmalloc (sizeof (struct host_decl), "parse_host_declaration"); if (!host) - error ("can't allocate host decl struct %s.", name); + log_fatal ("can't allocate host decl struct %s.", name); host -> name = name; host -> group = clone_group (group, "parse_host_declaration"); @@ -972,7 +972,7 @@ struct class *parse_class_declaration (cfile, group, type) data.buffer = (struct buffer *)0; if (!buffer_allocate (&data.buffer, data.len + 1, "parse_class_declaration")) - error ("no memoy for class name."); + log_fatal ("no memoy for class name."); data.data = &data.buffer -> data [0]; data.terminated = 1; @@ -980,7 +980,7 @@ struct class *parse_class_declaration (cfile, group, type) } else if (type == 2) { if (!(name = dmalloc (strlen (val) + 1, "parse_class_declaration"))) - error ("No memory for class name %s.", val); + log_fatal ("No memory for class name %s.", val); strcpy (name, val); } else { name = (char *)0; @@ -1018,7 +1018,7 @@ struct class *parse_class_declaration (cfile, group, type) class = (struct class *)dmalloc (sizeof (struct class), "parse_class_declaration"); if (!class) - error ("No memory for class %s.", val); + log_fatal ("No memory for class %s.", val); memset (class, 0, sizeof *class); if (pc) { class -> group = pc -> group; @@ -1031,7 +1031,7 @@ struct class *parse_class_declaration (cfile, group, type) sizeof (struct lease *), "check_collection"); if (!class -> billed_leases) - error ("no memory for billed leases"); + log_fatal ("no memory for billed leases"); memset (class -> billed_leases, 0, (class -> lease_limit * sizeof class -> billed_leases)); @@ -1057,7 +1057,7 @@ struct class *parse_class_declaration (cfile, group, type) dmalloc (sizeof (struct executable_statement), "implicit user/vendor class")); if (!stmt) - error ("no memory for class statement."); + log_fatal ("no memory for class statement."); memset (stmt, 0, sizeof *stmt); stmt -> op = supersede_option_statement; if (option_cache_allocate (&stmt -> data.option, @@ -1170,7 +1170,7 @@ struct class *parse_class_declaration (cfile, group, type) sizeof (struct lease *), "check_collection"); if (!class -> billed_leases) - error ("no memory for billed leases."); + log_fatal ("no memory for billed leases."); memset (class -> billed_leases, 0, (class -> lease_limit * sizeof class -> billed_leases)); @@ -1212,7 +1212,7 @@ void parse_shared_net_declaration (cfile, group) share = new_shared_network ("parse_shared_net_declaration"); if (!share) - error ("No memory for shared subnet"); + log_fatal ("No memory for shared subnet"); share -> pools = (struct pool *)0; share -> next = (struct shared_network *)0; share -> interface = (struct interface_info *)0; @@ -1230,7 +1230,7 @@ void parse_shared_net_declaration (cfile, group) } name = malloc (strlen (val) + 1); if (!name) - error ("no memory for shared network name"); + log_fatal ("no memory for shared network name"); strcpy (name, val); } else { name = parse_host_name (cfile); @@ -1282,7 +1282,7 @@ void parse_subnet_declaration (cfile, share) subnet = new_subnet ("parse_subnet_declaration"); if (!subnet) - error ("No memory for new subnet"); + log_fatal ("No memory for new subnet"); subnet -> shared_network = share; subnet -> group = clone_group (share -> group, "parse_subnet_declaration"); @@ -1538,7 +1538,7 @@ struct lease *parse_lease_declaration (cfile) lease.uid = (unsigned char *) malloc (lease.uid_len); if (!lease.uid) { - warn ("no space for uid"); + log_error ("no space for uid"); return (struct lease *)0; } memcpy (lease.uid, val, lease.uid_len); @@ -1548,7 +1548,7 @@ struct lease *parse_lease_declaration (cfile) (cfile, (unsigned char *)0, &lease.uid_len, ':', 16, 8); if (!lease.uid) { - warn ("no space for uid"); + log_error ("no space for uid"); return (struct lease *)0; } if (lease.uid_len == 0) { @@ -1559,7 +1559,7 @@ struct lease *parse_lease_declaration (cfile) } } if (!lease.uid) { - error ("No memory for lease uid"); + log_fatal ("No memory for lease uid"); } break; @@ -1762,12 +1762,12 @@ void parse_address_range (cfile, group, type, pool) if (!pool) { pool = new_pool ("parse_address_range"); if (!pool) - error ("no memory for ad-hoc pool."); + log_fatal ("no memory for ad-hoc pool."); if (dynamic) { pool -> permit_list = new_permit ("parse_address_range"); if (!pool -> permit_list) - error ("no memory for ad-hoc permit."); + log_fatal ("no memory for ad-hoc permit."); pool -> permit_list -> type = permit_dynamic_bootp_clients; } diff --git a/server/db.c b/server/db.c index 61518b51..84c46dea 100644 --- a/server/db.c +++ b/server/db.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: db.c,v 1.20 1998/11/11 08:00:11 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: db.c,v 1.21 1999/02/24 17:56:51 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -176,7 +176,7 @@ int write_lease (lease) ++errors; } if (errors) - note ("write_lease: unable to write lease %s", + log_info ("write_lease: unable to write lease %s", piaddr (lease -> ip_addr)); return !errors; } @@ -243,11 +243,11 @@ int commit_leases () We need to do this even if we're rewriting the file below, just in case the rewrite fails. */ if (fflush (db_file) == EOF) { - note ("commit_leases: unable to commit: %m"); + log_info ("commit_leases: unable to commit: %m"); return 0; } if (fsync (fileno (db_file)) < 0) { - note ("commit_leases: unable to commit: %m"); + log_info ("commit_leases: unable to commit: %m"); return 0; } @@ -288,10 +288,10 @@ void new_lease_file () sprintf (newfname, "%s.%d", path_dhcpd_db, (int)t); db_fd = open (newfname, O_WRONLY | O_TRUNC | O_CREAT, 0664); if (db_fd < 0) { - error ("Can't create new lease file: %m"); + log_fatal ("Can't create new lease file: %m"); } if ((db_file = fdopen (db_fd, "w")) == NULL) { - error ("Can't fdopen new lease file!"); + log_fatal ("Can't fdopen new lease file!"); } /* Write out all the leases that we know of... */ @@ -301,15 +301,15 @@ void new_lease_file () /* Get the old database out of the way... */ sprintf (backfname, "%s~", path_dhcpd_db); if (unlink (backfname) < 0 && errno != ENOENT) - error ("Can't remove old lease database backup %s: %m", + log_fatal ("Can't remove old lease database backup %s: %m", backfname); if (link (path_dhcpd_db, backfname) < 0) - error ("Can't backup lease database %s to %s: %m", + log_fatal ("Can't backup lease database %s to %s: %m", path_dhcpd_db, backfname); /* Move in the new file... */ if (rename (newfname, path_dhcpd_db) < 0) - error ("Can't install new lease database %s to %s: %m", + log_fatal ("Can't install new lease database %s to %s: %m", newfname, path_dhcpd_db); counting = 1; diff --git a/server/dhcp.c b/server/dhcp.c index 179df0d0..83b33acb 100644 --- a/server/dhcp.c +++ b/server/dhcp.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: dhcp.c,v 1.74 1999/02/14 19:27:56 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: dhcp.c,v 1.75 1999/02/24 17:56:51 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -104,7 +104,7 @@ void dhcpdiscover (packet) /* Sourceless packets don't make sense here. */ if (!packet -> shared_network) { - note ("Packet from unknown subnet: %s", + log_info ("Packet from unknown subnet: %s", inet_ntoa (packet -> raw -> giaddr)); return; } @@ -114,7 +114,7 @@ void dhcpdiscover (packet) lease = allocate_lease (packet, packet -> shared_network -> pools, 0); if (!lease) { - note ("no free leases on network %s match %s", + log_info ("no free leases on network %s match %s", packet -> shared_network -> name, print_hw_addr (packet -> raw -> htype, packet -> raw -> hlen, @@ -222,7 +222,7 @@ void dhcprequest (packet) from there. Fry it. */ if (!packet -> shared_network) { if (subnet && subnet -> group -> authoritative) { - note ("%s: wrong network.", msgbuf); + log_info ("%s: wrong network.", msgbuf); nak_lease (packet, &cip); return; } @@ -236,7 +236,7 @@ void dhcprequest (packet) if (!subnet) { if (packet -> shared_network -> group -> authoritative) { - note ("%s: wrong network.", msgbuf); + log_info ("%s: wrong network.", msgbuf); nak_lease (packet, &cip); } return; @@ -251,17 +251,17 @@ void dhcprequest (packet) it wasn't what got picked, the lease belongs to us, so we should NAK it. */ if (ours) { - note ("%s: wrong lease %s.", msgbuf, piaddr (cip)); + log_info ("%s: wrong lease %s.", msgbuf, piaddr (cip)); nak_lease (packet, &cip); } else - note ("%s: wrong lease %s", msgbuf, piaddr (cip)); + log_info ("%s: wrong lease %s", msgbuf, piaddr (cip)); return; } /* If the address the client asked for is ours, but it wasn't available for the client, NAK it. */ if (!lease && ours) { - note ("%s: lease %s unavailable.", msgbuf, piaddr (cip)); + log_info ("%s: lease %s unavailable.", msgbuf, piaddr (cip)); nak_lease (packet, &cip); return; } @@ -279,7 +279,7 @@ void dhcprequest (packet) (lease -> uid_len != data.len || memcmp (data.data, lease -> uid, lease -> uid_len))) { - note ("%s: wrong owner %s.", msgbuf, piaddr (cip)); + log_info ("%s: wrong owner %s.", msgbuf, piaddr (cip)); nak_lease (packet, &cip); } else ack_lease (packet, lease, DHCPACK, 0, msgbuf); @@ -287,7 +287,7 @@ void dhcprequest (packet) data_string_forget (&data, "dhcprequest"); return; } - note ("%s: unknown lease %s.", msgbuf, piaddr (cip)); + log_info ("%s: unknown lease %s.", msgbuf, piaddr (cip)); } void dhcprelease (packet) @@ -303,7 +303,7 @@ void dhcprelease (packet) so let it go. */ if ((oc = lookup_option (packet -> options.dhcp_hash, DHO_DHCP_REQUESTED_ADDRESS))) { - note ("DHCPRELEASE from %s specified requested-address.", + log_info ("DHCPRELEASE from %s specified requested-address.", print_hw_addr (packet -> raw -> htype, packet -> raw -> hlen, packet -> raw -> chaddr)); @@ -329,7 +329,7 @@ void dhcprelease (packet) } - note ("DHCPRELEASE of %s from %s via %s (%sfound)", + log_info ("DHCPRELEASE of %s from %s via %s (%sfound)", inet_ntoa (packet -> raw -> ciaddr), print_hw_addr (packet -> raw -> htype, packet -> raw -> hlen, @@ -366,7 +366,7 @@ void dhcpdecline (packet) data_string_forget (&data, "dhcpdecline"); lease = find_lease_by_ip_addr (cip); - note ("DHCPDECLINE on %s from %s via %s", + log_info ("DHCPDECLINE on %s from %s via %s", piaddr (cip), print_hw_addr (packet -> raw -> htype, packet -> raw -> hlen, @@ -384,7 +384,7 @@ void dhcpdecline (packet) void dhcpinform (packet) struct packet *packet; { - note ("DHCPINFORM from %s", + log_info ("DHCPINFORM from %s", inet_ntoa (packet -> raw -> ciaddr)); } @@ -412,11 +412,11 @@ void nak_lease (packet, cip) /* Set DHCP_MESSAGE_TYPE to DHCPNAK */ if (!option_cache_allocate (&oc, "nak_lease")) { - warn ("No memory for DHCPNAK message type."); + log_error ("No memory for DHCPNAK message type."); return; } if (!make_const_data (&oc -> expression, &nak, sizeof nak, 0, 0)) { - warn ("No memory for expr_const expression."); + log_error ("No memory for expr_const expression."); option_cache_dereference (&oc, "nak_lease"); return; } @@ -426,12 +426,12 @@ void nak_lease (packet, cip) /* Set DHCP_MESSAGE to whatever the message is */ if (!option_cache_allocate (&oc, "nak_lease")) { - warn ("No memory for DHCPNAK message type."); + log_error ("No memory for DHCPNAK message type."); return; } if (!make_const_data (&oc -> expression, dhcp_message, strlen (dhcp_message), 1, 0)) { - warn ("No memory for expr_const expression."); + log_error ("No memory for expr_const expression."); option_cache_dereference (&oc, "nak_lease"); return; } @@ -462,7 +462,7 @@ void nak_lease (packet, cip) raw.op = BOOTREPLY; /* Report what we're sending... */ - note ("DHCPNAK on %s to %s via %s", + log_info ("DHCPNAK on %s to %s via %s", piaddr (*cip), print_hw_addr (packet -> raw -> htype, packet -> raw -> hlen, @@ -509,7 +509,7 @@ void nak_lease (packet, cip) outgoing.packet_length, from, &to, &hto); if (result < 0) - warn ("send_fallback: %m"); + log_error ("send_fallback: %m"); return; } } else { @@ -522,7 +522,7 @@ void nak_lease (packet, cip) packet, &raw, outgoing.packet_length, from, &to, (struct hardware *)0); if (result < 0) - warn ("send_packet: %m"); + log_error ("send_packet: %m"); } void ack_lease (packet, lease, offer, when, msg) @@ -554,7 +554,7 @@ void ack_lease (packet, lease, offer, when, msg) /* Allocate a lease state structure... */ state = new_lease_state ("ack_lease"); if (!state) - error ("unable to allocate lease state!"); + log_fatal ("unable to allocate lease state!"); memset (state, 0, sizeof *state); /* Replace the old lease hostname with the new one, if it's changed. */ @@ -575,7 +575,7 @@ void ack_lease (packet, lease, offer, when, msg) lease -> client_hostname = dmalloc (d1.len + 1, "ack_lease"); if (!lease -> client_hostname) - warn ("no memory for client hostname."); + log_error ("no memory for client hostname."); else { memcpy (lease -> client_hostname, d1.data, d1.len); lease -> client_hostname [d1.len] = 0; @@ -630,7 +630,7 @@ void ack_lease (packet, lease, offer, when, msg) &packet -> options, oc)) { if (d1.len && packet -> raw -> secs < d1.data [0]) { data_string_forget (&d1, "ack_lease"); - note ("%s: %d secs < %d", + log_info ("%s: %d secs < %d", packet -> raw -> secs, d1.data [0]); return; } @@ -675,7 +675,7 @@ void ack_lease (packet, lease, offer, when, msg) if (evaluate_option_cache (&d1, packet, &packet -> options, oc)) { if (d1.len && !d1.data [0]) { - note ("%s: unknown", msg); + log_info ("%s: unknown", msg); data_string_forget (&d1, "ack_lease"); return; } @@ -691,7 +691,7 @@ void ack_lease (packet, lease, offer, when, msg) &packet -> options, oc)) { if (d1.len && !d1.data [0]) { data_string_forget (&d1, "ack_lease"); - note ("%s: bootp disallowed", msg); + log_info ("%s: bootp disallowed", msg); return; } data_string_forget (&d1, "ack_lease"); @@ -703,7 +703,7 @@ void ack_lease (packet, lease, offer, when, msg) if (oc && evaluate_option_cache (&d1, packet, &packet -> options, oc)) { if (d1.len && !d1.data [0]) { - note ("%s: booting disallowed", msg); + log_info ("%s: booting disallowed", msg); data_string_forget (&d1, "ack_lease"); return; } @@ -738,7 +738,7 @@ void ack_lease (packet, lease, offer, when, msg) packet -> classes [i])) break; if (i == packet -> class_count) { - note ("%s: no available billing", msg); + log_info ("%s: no available billing", msg); return; } } @@ -882,7 +882,7 @@ void ack_lease (packet, lease, offer, when, msg) "ack_lease"); /* XXX inelegant */ if (!lt.uid) - error ("can't allocate memory for large uid."); + log_fatal ("can't allocate memory for large uid."); memcpy (lt.uid, d1.data, lt.uid_len); } data_string_forget (&d1, "ack_lease"); @@ -914,7 +914,7 @@ void ack_lease (packet, lease, offer, when, msg) if (!(supersede_lease (lease, <, !offer || offer == DHCPACK) || (offer && offer != DHCPACK))) { - note ("%s: database update failed", msg); + log_info ("%s: database update failed", msg); return; } } @@ -1020,7 +1020,7 @@ void ack_lease (packet, lease, offer, when, msg) offered_lease_time); i = DHO_DHCP_LEASE_TIME; if (lookup_option (state -> options.dhcp_hash, i)) - warn ("dhcp-lease-time option for %s overridden.", + log_error ("dhcp-lease-time option for %s overridden.", inet_ntoa (state -> ciaddr)); oc = (struct option_cache *)0; if (option_cache_allocate (&oc, "ack_lease")) { @@ -1039,7 +1039,7 @@ void ack_lease (packet, lease, offer, when, msg) offered_lease_time); i = DHO_DHCP_RENEWAL_TIME; if (lookup_option (state -> options.dhcp_hash, i)) - warn ("dhcp-renewal-time option for %s overridden.", + log_error ("dhcp-renewal-time option for %s overridden.", inet_ntoa (state -> ciaddr)); oc = (struct option_cache *)0; if (option_cache_allocate (&oc, "ack_lease")) { @@ -1060,7 +1060,7 @@ void ack_lease (packet, lease, offer, when, msg) offered_lease_time); i = DHO_DHCP_REBINDING_TIME; if (lookup_option (state -> options.dhcp_hash, i)) - warn ("dhcp-rebinding-time option for %s overridden.", + log_error ("dhcp-rebinding-time option for %s overridden.", inet_ntoa (state -> ciaddr)); oc = (struct option_cache *)0; if (option_cache_allocate (&oc, "ack_lease")) { @@ -1128,7 +1128,7 @@ void ack_lease (packet, lease, offer, when, msg) h = gethostbyaddr ((char *)&ia, sizeof ia, AF_INET); if (!h) - warn ("No hostname for %s", inet_ntoa (ia)); + log_error ("No hostname for %s", inet_ntoa (ia)); else { oc = (struct option_cache *)0; if (option_cache_allocate (&oc, "ack_lease")) { @@ -1183,7 +1183,7 @@ void ack_lease (packet, lease, offer, when, msg) lease -> state = state; - note ("%s", msg); + log_info ("%s", msg); /* If this is a DHCPOFFER, ping the lease address before actually sending the offer. */ @@ -1218,7 +1218,7 @@ void dhcp_reply (lease) struct option_cache *oc; if (!state) - error ("dhcp_reply was supplied lease with no state!"); + log_fatal ("dhcp_reply was supplied lease with no state!"); /* Compose a response for the client... */ memset (&raw, 0, sizeof raw); @@ -1307,7 +1307,7 @@ void dhcp_reply (lease) raw.op = BOOTREPLY; /* Say what we're doing... */ - note ("%s on %s to %s via %s", + log_info ("%s on %s to %s via %s", (state -> offer ? (state -> offer == DHCPACK ? "DHCPACK" : "DHCPOFFER") : "BOOTREPLY"), @@ -1350,7 +1350,7 @@ void dhcp_reply (lease) &raw, packet_length, raw.siaddr, &to, &hto); if (result < 0) - warn ("send_fallback: %m"); + log_error ("send_fallback: %m"); free_lease_state (state, "dhcp_reply fallback 1"); lease -> state = (struct lease_state *)0; @@ -1372,7 +1372,7 @@ void dhcp_reply (lease) &raw, packet_length, raw.siaddr, &to, &hto); if (result < 0) - warn ("send_fallback: %m"); + log_error ("send_fallback: %m"); free_lease_state (state, "dhcp_reply fallback 1"); lease -> state = (struct lease_state *)0; return; @@ -1390,7 +1390,7 @@ void dhcp_reply (lease) (struct packet *)0, &raw, packet_length, from, &to, &hto); if (result < 0) - warn ("sendpkt: %m"); + log_error ("sendpkt: %m"); free_lease_state (state, "dhcp_reply"); lease -> state = (struct lease_state *)0; @@ -1436,7 +1436,7 @@ struct lease *find_lease (packet, share, ours) if (fixed_lease) { #if defined (DEBUG_FIND_LEASE) - note ("Found host for client identifier: %s.", + log_info ("Found host for client identifier: %s.", piaddr (fixed_lease -> ip_addr)); #endif uid_lease = (struct lease *)0; @@ -1455,14 +1455,14 @@ struct lease *find_lease (packet, share, ours) fixed_lease = (struct lease *)0; #if defined (DEBUG_FIND_LEASE) if (uid_lease) - note ("Found lease for client identifier: %s.", + log_info ("Found lease for client identifier: %s.", piaddr (uid_lease -> ip_addr)); #endif if (uid_lease && (uid_lease -> flags & ABANDONED_LEASE)) { uid_lease = (struct lease *)0; #if defined (DEBUG_FIND_LEASE) - note ("...but it was abandoned."); + log_info ("...but it was abandoned."); #endif } } @@ -1484,7 +1484,7 @@ struct lease *find_lease (packet, share, ours) fixed_lease = mockup_lease (packet, share, hp); #if defined (DEBUG_FIND_LEASE) if (fixed_lease) { - note ("Found host for hardware address: %s.", + log_info ("Found host for hardware address: %s.", piaddr (fixed_lease -> ip_addr)); } #endif @@ -1513,7 +1513,7 @@ struct lease *find_lease (packet, share, ours) } #if defined (DEBUG_FIND_LEASE) if (hw_lease) - note ("Found lease for hardware address: %s.", + log_info ("Found lease for hardware address: %s.", piaddr (hw_lease -> ip_addr)); #endif @@ -1541,7 +1541,7 @@ struct lease *find_lease (packet, share, ours) #if defined (DEBUG_FIND_LEASE) if (ip_lease) - note ("Found lease for requested address: %s.", + log_info ("Found lease for requested address: %s.", piaddr (ip_lease -> ip_addr)); #endif @@ -1559,7 +1559,7 @@ struct lease *find_lease (packet, share, ours) lease to be abandoned. If so, this request probably came from that client. */ if (ip_lease && (ip_lease -> subnet -> shared_network != share)) { - note ("...but it was on the wrong shared network."); + log_info ("...but it was on the wrong shared network."); ip_lease = (struct lease *)0; } @@ -1574,7 +1574,7 @@ struct lease *find_lease (packet, share, ours) ip_lease -> uid_len))) { #if defined (DEBUG_FIND_LEASE) if (ip_lease) - note ("rejecting lease for requested address."); + log_info ("rejecting lease for requested address."); #endif ip_lease = (struct lease *)0; } @@ -1588,7 +1588,7 @@ struct lease *find_lease (packet, share, ours) !memcmp (client_identifier.data, ip_lease -> uid, ip_lease -> uid_len)) { if (uid_lease -> ends > cur_time) - warn ("client %s has duplicate leases on %s", + log_error ("client %s has duplicate leases on %s", print_hw_addr (packet -> raw -> htype, packet -> raw -> hlen, packet -> raw -> chaddr), @@ -1623,10 +1623,10 @@ struct lease *find_lease (packet, share, ours) hw_lease = hw_lease -> n_hw; #if defined (DEBUG_FIND_LEASE) if (hw_lease) - note ("trying next lease matching hw addr: %s", + log_info ("trying next lease matching hw addr: %s", piaddr (hw_lease -> ip_addr)); else - note ("rejecting lease for hardware address."); + log_info ("rejecting lease for hardware address."); #endif } @@ -1634,19 +1634,19 @@ struct lease *find_lease (packet, share, ours) if (ip_lease == hw_lease) { ip_lease = (struct lease *)0; #if defined (DEBUG_FIND_LEASE) - note ("hardware lease and ip lease are identical."); + log_info ("hardware lease and ip lease are identical."); #endif } if (hw_lease == uid_lease) { #if defined (DEBUG_FIND_LEASE) - note ("hardware lease and uid lease are identical."); + log_info ("hardware lease and uid lease are identical."); #endif hw_lease = (struct lease *)0; } if (ip_lease == uid_lease) { ip_lease = (struct lease *)0; #if defined (DEBUG_FIND_LEASE) - note ("uid lease and ip lease are identical."); + log_info ("uid lease and ip lease are identical."); #endif } @@ -1665,7 +1665,7 @@ struct lease *find_lease (packet, share, ours) release_lease (ip_lease); ip_lease = (struct lease *)0; #if defined (DEBUG_FIND_LEASE) - note ("lease on requested address is on wrong network."); + log_info ("lease on requested address is on wrong network."); #endif } if (uid_lease && @@ -1673,7 +1673,7 @@ struct lease *find_lease (packet, share, ours) release_lease (uid_lease); uid_lease = (struct lease *)0; #if defined (DEBUG_FIND_LEASE) - note ("lease matching uid is on wrong network."); + log_info ("lease matching uid is on wrong network."); #endif } if (hw_lease && @@ -1681,7 +1681,7 @@ struct lease *find_lease (packet, share, ours) release_lease (hw_lease); hw_lease = (struct lease *)0; #if defined (DEBUG_FIND_LEASE) - note ("lease matching hardware address is on wrong network."); + log_info ("lease matching hardware address is on wrong network."); #endif } @@ -1690,7 +1690,7 @@ struct lease *find_lease (packet, share, ours) if (fixed_lease) { lease = fixed_lease; #if defined (DEBUG_FIND_LEASE) - note ("choosing fixed address."); + log_info ("choosing fixed address."); #endif } @@ -1702,11 +1702,11 @@ struct lease *find_lease (packet, share, ours) if (packet -> packet_type == DHCPREQUEST) release_lease (ip_lease); #if defined (DEBUG_FIND_LEASE) - note ("not choosing requested address (!)."); + log_info ("not choosing requested address (!)."); #endif } else { #if defined (DEBUG_FIND_LEASE) - note ("choosing lease on requested address."); + log_info ("choosing lease on requested address."); #endif lease = ip_lease; lease -> host = (struct host_decl *)0; @@ -1721,13 +1721,13 @@ struct lease *find_lease (packet, share, ours) if (packet -> packet_type == DHCPREQUEST) dissociate_lease (uid_lease); #if defined (DEBUG_FIND_LEASE) - note ("not choosing uid lease."); + log_info ("not choosing uid lease."); #endif } else { lease = uid_lease; lease -> host = (struct host_decl *)0; #if defined (DEBUG_FIND_LEASE) - note ("choosing uid lease."); + log_info ("choosing uid lease."); #endif } } @@ -1738,13 +1738,13 @@ struct lease *find_lease (packet, share, ours) if (packet -> packet_type == DHCPREQUEST) dissociate_lease (hw_lease); #if defined (DEBUG_FIND_LEASE) - note ("not choosing hardware lease."); + log_info ("not choosing hardware lease."); #endif } else { lease = hw_lease; lease -> host = (struct host_decl *)0; #if defined (DEBUG_FIND_LEASE) - note ("choosing hardware lease."); + log_info ("choosing hardware lease."); #endif } } @@ -1767,10 +1767,10 @@ struct lease *find_lease (packet, share, ours) #if defined (DEBUG_FIND_LEASE) if (lease) - note ("Returning lease: %s.", + log_info ("Returning lease: %s.", piaddr (lease -> ip_addr)); else - note ("Not returning a lease."); + log_info ("Not returning a lease."); #endif /* If we find an abandoned lease, but it's the one the client @@ -1779,7 +1779,7 @@ struct lease *find_lease (packet, share, ours) be abandoned, so we reclaim it and let the client have it. */ if (lease && lease -> flags & ABANDONED_LEASE && lease == ip_lease && packet -> packet_type == DHCPREQUEST) { - warn ("Reclaiming REQUESTed abandoned IP address %s.", + log_error ("Reclaiming REQUESTed abandoned IP address %s.", piaddr (lease -> ip_addr)); lease -> flags &= ~ABANDONED_LEASE; } else if (lease && lease -> flags & ABANDONED_LEASE) { @@ -1859,7 +1859,7 @@ struct lease *allocate_lease (packet, pool, ok) return allocate_lease (packet, pool -> next, ok); lp = allocate_lease (packet, pool -> next, 0); if (!lp) { - warn ("Reclaiming abandoned IP address %s.", + log_error ("Reclaiming abandoned IP address %s.", piaddr (lease -> ip_addr)); lease -> flags &= ~ABANDONED_LEASE; return lease; diff --git a/server/dhcpd.c b/server/dhcpd.c index 8e49eb95..3a62b196 100644 --- a/server/dhcpd.c +++ b/server/dhcpd.c @@ -94,7 +94,7 @@ #ifndef lint static char ocopyright[] = -"$Id: dhcpd.c,v 1.54 1999/02/14 19:29:09 mellon Exp $ Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium."; +"$Id: dhcpd.c,v 1.55 1999/02/24 17:56:52 mellon Exp $ Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium."; #endif static char copyright[] = @@ -168,14 +168,14 @@ int main (argc, argv, envp) usage (); for (s = argv [i]; *s; s++) if (!isdigit (*s)) - error ("%s: not a valid UDP port", + log_fatal ("%s: not a valid UDP port", argv [i]); status = atoi (argv [i]); if (status < 1 || status > 65535) - error ("%s: not a valid UDP port", + log_fatal ("%s: not a valid UDP port", argv [i]); local_port = htons (status); - debug ("binding to user-specified port %d", + log_debug ("binding to user-specified port %d", ntohs (local_port)); } else if (!strcmp (argv [i], "-f")) { #ifndef DEBUG @@ -215,7 +215,7 @@ int main (argc, argv, envp) ((struct interface_info *) dmalloc (sizeof *tmp, "get_interface_list")); 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]); @@ -226,11 +226,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. */ @@ -264,7 +264,7 @@ int main (argc, argv, envp) /* Read the dhcpd.conf file... */ if (!readconf ()) - error ("Configuration file errors encountered -- exiting"); + log_fatal ("Configuration file errors encountered -- exiting"); /* test option should cause an early exit */ if (cftest) @@ -283,7 +283,7 @@ int main (argc, argv, envp) if (daemon) { /* First part of becoming a daemon... */ if ((pid = fork ()) < 0) - error ("Can't fork daemon: %m"); + log_fatal ("Can't fork daemon: %m"); else if (pid) exit (0); } @@ -307,7 +307,7 @@ int main (argc, argv, envp) pidfilewritten = 1; } } else - error ("There's already a DHCP server running.\n"); + log_fatal ("There's already a DHCP server running.\n"); } /* If we were requested to log to stdout on the command line, @@ -355,11 +355,11 @@ int main (argc, argv, envp) static void usage () { - note (message); - note (copyright); - note (arr); + log_info (message); + log_info (copyright); + log_info (arr); - error ("Usage: dhcpd [-p ] [-d] [-f] [-cf config-file]%s", + log_fatal ("Usage: dhcpd [-p ] [-d] [-f] [-cf config-file]%s", "\n [-lf lease-file] [if0 [...ifN]]"); } @@ -384,18 +384,18 @@ void lease_pinged (from, packet, length) lp = find_lease_by_ip_addr (from); if (!lp) { - note ("unexpected ICMP Echo Reply from %s", piaddr (from)); + log_info ("unexpected ICMP Echo Reply from %s", piaddr (from)); return; } if (!lp -> state) { - warn ("ICMP Echo Reply for %s arrived late or is spurious.\n", + log_error ("ICMP Echo Reply for %s arrived late or is spurious.\n", piaddr (from)); return; } if (lp -> ends > cur_time) { - warn ("ICMP Echo reply arrived while lease %s was valid.\n", + log_error ("ICMP Echo reply arrived while lease %s was valid.\n", piaddr (from)); } diff --git a/statmsg/main.c b/statmsg/main.c index a30bb731..22d4a0c4 100644 --- a/statmsg/main.c +++ b/statmsg/main.c @@ -44,7 +44,7 @@ #ifndef lint static char copyright[] = -"$Id: main.c,v 1.4 1998/03/16 06:18:50 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: main.c,v 1.5 1999/02/24 17:56:53 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -78,17 +78,17 @@ int main (argc, argv, envp) #endif if (argc < 2) - error ("usage: statmsg type [data]"); + log_fatal ("usage: statmsg type [data]"); hdr.length = 0; if (!strcmp (argv [1], "network-location-changed")) hdr.type = NETWORK_LOCATION_CHANGED; else - error ("unknown status message type %s", argv [1]); + log_fatal ("unknown status message type %s", argv [1]); sysconf_fd = socket (AF_UNIX, SOCK_STREAM, 0); if (sysconf_fd < 0) - error ("unable to create sysconf socket: %m"); + log_fatal ("unable to create sysconf socket: %m"); /* XXX for now... */ name.sun_family = PF_UNIX; @@ -100,20 +100,20 @@ int main (argc, argv, envp) strlen (name.sun_path)); if (connect (sysconf_fd, (struct sockaddr *)&name, len) < 0) - error ("can't connect to sysconf socket: %m"); + log_fatal ("can't connect to sysconf socket: %m"); status = write (sysconf_fd, &hdr, sizeof hdr); if (status < 0) - error ("sysconf: %m"); + log_fatal ("sysconf: %m"); if (status < sizeof (hdr)) - error ("sysconf: short write"); + log_fatal ("sysconf: short write"); if (hdr.length) { status = write (sysconf_fd, buf, hdr.length); if (status < 0) - error ("sysconf payload write: %m"); + log_fatal ("sysconf payload write: %m"); if (status != hdr.length) - error ("sysconf payload: short write"); + log_fatal ("sysconf payload: short write"); } exit (0); diff --git a/sysconfd/sysconfd.c b/sysconfd/sysconfd.c index 8434b148..14a105cb 100644 --- a/sysconfd/sysconfd.c +++ b/sysconfd/sysconfd.c @@ -44,7 +44,7 @@ #ifndef lint static char copyright[] = -"$Id: sysconfd.c,v 1.7 1999/02/14 19:40:19 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: sysconfd.c,v 1.8 1999/02/24 17:56:53 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -97,7 +97,7 @@ int main (argc, argv, envp) /* Make a socket... */ sysconf_fd = socket (AF_UNIX, SOCK_STREAM, 0); if (sysconf_fd < 0) - error ("unable to create sysconf socket: %m"); + log_fatal ("unable to create sysconf socket: %m"); /* XXX for now... */ name.sun_family = PF_UNIX; @@ -111,18 +111,18 @@ int main (argc, argv, envp) /* Bind to it... */ if (bind (sysconf_fd, (struct sockaddr *)&name, len) < 0) - error ("can't bind to sysconf socket: %m"); + log_fatal ("can't bind to sysconf socket: %m"); /* Listen for connections... */ if (listen (sysconf_fd, 1) < 0) - error ("can't listen on sysconf socket: %m"); + log_fatal ("can't listen on sysconf socket: %m"); /* Stop logging to stderr... */ log_perror = 0; /* 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); @@ -150,7 +150,7 @@ void new_connection (proto) tmp = (struct sysconf_client *)malloc (sizeof *tmp); if (!tmp) { - warn ("Can't find memory for new client!"); + log_error ("Can't find memory for new client!"); return; } memset (tmp, 0, sizeof *tmp); @@ -158,7 +158,7 @@ void new_connection (proto) namelen = sizeof name; new_fd = accept (proto -> fd, (struct sockaddr *)&name, &namelen); if (new_fd < 0) { - warn ("accept: %m"); + log_error ("accept: %m"); return; } @@ -181,29 +181,29 @@ void client_input (proto) status = read (proto -> fd, &hdr, sizeof hdr); if (status < 0) { blow: - warn ("client_input: %m"); + log_error ("client_input: %m"); close (proto -> fd); remove_protocol (proto); return; } if (status < sizeof (hdr)) { - warn ("client_input: short message"); + log_error ("client_input: short message"); goto blow; } if (hdr.length) { buf = malloc (hdr.length); if (!buf) { - warn ("client_input: can't buffer payload"); + log_error ("client_input: can't buffer payload"); goto blow; } status = read (proto -> fd, buf, hdr.length); if (status < 0) { - warn ("client_input payload read: %m"); + log_error ("client_input payload read: %m"); goto blow; } if (status != hdr.length) { - warn ("client_input payload: short read"); + log_error ("client_input payload: short read"); goto blow; } } else @@ -215,22 +215,22 @@ void client_input (proto) status = write (client -> fd, &hdr, sizeof hdr); if (status < 0) { - warn ("client_input: %m"); + log_error ("client_input: %m"); continue; } if (status < sizeof (hdr)) { - warn ("client_input: short write"); + log_error ("client_input: short write"); continue; } if (hdr.length) { status = write (client -> fd, buf, hdr.length); if (status < 0) { - warn ("client_input payload write: %m"); + log_error ("client_input payload write: %m"); continue; } if (status != hdr.length) { - warn ("client_input payload: short write"); + log_error ("client_input payload: short write"); continue; } }