diff options
author | Ted Lemon <source@isc.org> | 1999-02-24 17:56:53 +0000 |
---|---|---|
committer | Ted Lemon <source@isc.org> | 1999-02-24 17:56:53 +0000 |
commit | 8ae2d59584635a17803f292a1fb1924dfb6754c5 (patch) | |
tree | 77acd5078fbe5d32fac6686de3eb8db63edc3c69 /common | |
parent | c68d2a87b103a922bd81716a54968335d995b21c (diff) | |
download | isc-dhcp-8ae2d59584635a17803f292a1fb1924dfb6754c5.tar.gz |
Change names of error functions to be more consistent.
Diffstat (limited to 'common')
-rw-r--r-- | common/alloc.c | 26 | ||||
-rw-r--r-- | common/bpf.c | 30 | ||||
-rw-r--r-- | common/discover.c | 36 | ||||
-rw-r--r-- | common/dispatch.c | 12 | ||||
-rw-r--r-- | common/dlpi.c | 34 | ||||
-rw-r--r-- | common/dns.c | 16 | ||||
-rw-r--r-- | common/errwarn.c | 12 | ||||
-rw-r--r-- | common/execute.c | 20 | ||||
-rw-r--r-- | common/hash.c | 4 | ||||
-rw-r--r-- | common/icmp.c | 14 | ||||
-rw-r--r-- | common/interact.c | 22 | ||||
-rw-r--r-- | common/lpf.c | 14 | ||||
-rw-r--r-- | common/memory.c | 38 | ||||
-rw-r--r-- | common/nit.c | 28 | ||||
-rw-r--r-- | common/options.c | 38 | ||||
-rw-r--r-- | common/packet.c | 22 | ||||
-rw-r--r-- | common/parse.c | 72 | ||||
-rw-r--r-- | common/print.c | 48 | ||||
-rw-r--r-- | common/raw.c | 12 | ||||
-rw-r--r-- | common/resolv.c | 10 | ||||
-rw-r--r-- | common/socket.c | 18 | ||||
-rw-r--r-- | common/sysconf.c | 18 | ||||
-rw-r--r-- | common/tables.c | 8 | ||||
-rw-r--r-- | common/tree.c | 112 | ||||
-rw-r--r-- | common/upf.c | 24 |
25 files changed, 344 insertions, 344 deletions
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 : "<unnamed class>")); #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 "<error>"; } /* 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 : "<none>"); } @@ -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, |