diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-08-09 14:02:09 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-09-21 10:29:38 +0200 |
commit | bb80d9df8bac71eedee1a6787ca63aef972a7e48 (patch) | |
tree | 1b5cb9443c5ead5706c35afb618abbbd1592315e /freebsd/sbin/dhclient | |
parent | Update to FreeBSD head 2017-10-01 (diff) | |
download | rtems-libbsd-bb80d9df8bac71eedee1a6787ca63aef972a7e48.tar.bz2 |
Update to FreeBSD head 2017-12-01
Git mirror commit e724f51f811a4b2bd29447f8b85ab5c2f9b88266.
Update #3472.
Diffstat (limited to 'freebsd/sbin/dhclient')
-rw-r--r-- | freebsd/sbin/dhclient/alloc.c | 4 | ||||
-rw-r--r-- | freebsd/sbin/dhclient/bpf.c | 4 | ||||
-rw-r--r-- | freebsd/sbin/dhclient/clparse.c | 4 | ||||
-rw-r--r-- | freebsd/sbin/dhclient/conflex.c | 4 | ||||
-rw-r--r-- | freebsd/sbin/dhclient/convert.c | 4 | ||||
-rw-r--r-- | freebsd/sbin/dhclient/dhclient.c | 31 | ||||
-rw-r--r-- | freebsd/sbin/dhclient/dhcp.h | 4 | ||||
-rw-r--r-- | freebsd/sbin/dhclient/dhcpd.h | 8 | ||||
-rw-r--r-- | freebsd/sbin/dhclient/dhctoken.h | 6 | ||||
-rw-r--r-- | freebsd/sbin/dhclient/dispatch.c | 16 | ||||
-rw-r--r-- | freebsd/sbin/dhclient/errwarn.c | 20 | ||||
-rw-r--r-- | freebsd/sbin/dhclient/hash.c | 4 | ||||
-rw-r--r-- | freebsd/sbin/dhclient/inet.c | 4 | ||||
-rw-r--r-- | freebsd/sbin/dhclient/options.c | 4 | ||||
-rw-r--r-- | freebsd/sbin/dhclient/packet.c | 4 | ||||
-rw-r--r-- | freebsd/sbin/dhclient/parse.c | 4 | ||||
-rw-r--r-- | freebsd/sbin/dhclient/tables.c | 4 | ||||
-rw-r--r-- | freebsd/sbin/dhclient/tree.c | 4 | ||||
-rw-r--r-- | freebsd/sbin/dhclient/tree.h | 6 |
19 files changed, 102 insertions, 37 deletions
diff --git a/freebsd/sbin/dhclient/alloc.c b/freebsd/sbin/dhclient/alloc.c index 977deff1..03caf934 100644 --- a/freebsd/sbin/dhclient/alloc.c +++ b/freebsd/sbin/dhclient/alloc.c @@ -4,7 +4,9 @@ /* Memory allocation... */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995, 1996, 1998 The Internet Software Consortium. * All rights reserved. * diff --git a/freebsd/sbin/dhclient/bpf.c b/freebsd/sbin/dhclient/bpf.c index 4d3d2276..978faa58 100644 --- a/freebsd/sbin/dhclient/bpf.c +++ b/freebsd/sbin/dhclient/bpf.c @@ -4,7 +4,9 @@ /* BPF socket interface code, originally contributed by Archie Cobbs. */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995, 1996, 1998, 1999 * The Internet Software Consortium. All rights reserved. * diff --git a/freebsd/sbin/dhclient/clparse.c b/freebsd/sbin/dhclient/clparse.c index 1bb0f957..f35c9402 100644 --- a/freebsd/sbin/dhclient/clparse.c +++ b/freebsd/sbin/dhclient/clparse.c @@ -4,7 +4,9 @@ /* Parser for dhclient config and lease files... */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1997 The Internet Software Consortium. * All rights reserved. * diff --git a/freebsd/sbin/dhclient/conflex.c b/freebsd/sbin/dhclient/conflex.c index c4fd442c..fce0458c 100644 --- a/freebsd/sbin/dhclient/conflex.c +++ b/freebsd/sbin/dhclient/conflex.c @@ -4,7 +4,9 @@ /* Lexical scanner for dhcpd config file... */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995, 1996, 1997 The Internet Software Consortium. * All rights reserved. * diff --git a/freebsd/sbin/dhclient/convert.c b/freebsd/sbin/dhclient/convert.c index 27b24d3e..35058764 100644 --- a/freebsd/sbin/dhclient/convert.c +++ b/freebsd/sbin/dhclient/convert.c @@ -7,7 +7,9 @@ * which can't be assumed to be aligned. */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995, 1996 The Internet Software Consortium. * All rights reserved. * diff --git a/freebsd/sbin/dhclient/dhclient.c b/freebsd/sbin/dhclient/dhclient.c index b36fce4d..b0dabdb8 100644 --- a/freebsd/sbin/dhclient/dhclient.c +++ b/freebsd/sbin/dhclient/dhclient.c @@ -2,7 +2,9 @@ /* $OpenBSD: dhclient.c,v 1.63 2005/02/06 17:10:13 krw Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 1995, 1996, 1997, 1998, 1999 * The Internet Software Consortium. All rights reserved. @@ -86,6 +88,8 @@ __FBSDID("$FreeBSD$"); #define CLIENT_PATH "PATH=/usr/bin:/usr/sbin:/bin:/sbin" +cap_channel_t *capsyslog; + time_t cur_time; time_t default_lease_time = 43200; /* 12 hours... */ @@ -347,6 +351,21 @@ die: exit(1); } +static void +init_casper(void) +{ + cap_channel_t *casper; + + casper = cap_init(); + if (casper == NULL) + error("unable to start casper"); + + capsyslog = cap_service_open(casper, "system.syslog"); + cap_close(casper); + if (capsyslog == NULL) + error("unable to open system.syslog service"); +} + int main(int argc, char *argv[]) { @@ -358,9 +377,11 @@ main(int argc, char *argv[]) pid_t otherpid; cap_rights_t rights; + init_casper(); + /* Initially, log errors to stderr as well as to syslogd. */ - openlog(__progname, LOG_PID | LOG_NDELAY, DHCPD_LOG_FACILITY); - setlogmask(LOG_UPTO(LOG_DEBUG)); + cap_openlog(capsyslog, __progname, LOG_PID | LOG_NDELAY, DHCPD_LOG_FACILITY); + cap_setlogmask(capsyslog, LOG_UPTO(LOG_DEBUG)); while ((ch = getopt(argc, argv, "bc:dl:p:qu")) != -1) switch (ch) { @@ -520,7 +541,7 @@ main(int argc, char *argv[]) setproctitle("%s", ifi->name); - if (cap_enter() < 0 && errno != ENOSYS) + if (CASPER_SUPPORT && cap_enter() < 0 && errno != ENOSYS) error("can't enter capability mode: %m"); if (immediate_daemon) @@ -2406,7 +2427,7 @@ go_daemon(void) /* Stop logging to stderr... */ log_perror = 0; - if (daemon(1, 0) == -1) + if (daemon(1, 1) == -1) error("daemon"); cap_rights_init(&rights); diff --git a/freebsd/sbin/dhclient/dhcp.h b/freebsd/sbin/dhclient/dhcp.h index 6e7d1a74..e4dcfb93 100644 --- a/freebsd/sbin/dhclient/dhcp.h +++ b/freebsd/sbin/dhclient/dhcp.h @@ -3,7 +3,9 @@ /* Protocol structures... */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995, 1996 The Internet Software Consortium. * All rights reserved. * diff --git a/freebsd/sbin/dhclient/dhcpd.h b/freebsd/sbin/dhclient/dhcpd.h index 9210cd42..3fd51ee3 100644 --- a/freebsd/sbin/dhclient/dhcpd.h +++ b/freebsd/sbin/dhclient/dhcpd.h @@ -1,6 +1,8 @@ /* $OpenBSD: dhcpd.h,v 1.33 2004/05/06 22:29:15 deraadt Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 1995, 1996, 1997, 1998, 1999 * The Internet Software Consortium. All rights reserved. @@ -73,6 +75,9 @@ #include <time.h> #include <unistd.h> +#include <libcasper.h> +#include <casper/cap_syslog.h> + #include "dhcp.h" #include "tree.h" @@ -352,6 +357,7 @@ int addr_eq(struct iaddr, struct iaddr); char *piaddr(struct iaddr); /* dhclient.c */ +extern cap_channel_t *capsyslog; extern char *path_dhclient_conf; extern char *path_dhclient_db; extern time_t cur_time; diff --git a/freebsd/sbin/dhclient/dhctoken.h b/freebsd/sbin/dhclient/dhctoken.h index 7b23242f..26c81aa7 100644 --- a/freebsd/sbin/dhclient/dhctoken.h +++ b/freebsd/sbin/dhclient/dhctoken.h @@ -2,7 +2,9 @@ /* Tokens for config file lexer and parser. */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995, 1996, 1997, 1998, 1999 * The Internet Software Consortium. All rights reserved. * @@ -38,6 +40,8 @@ * Enterprises. To learn more about the Internet Software Consortium, * see ``http://www.vix.com/isc''. To learn more about Vixie * Enterprises, see ``http://www.vix.com''. + * + * $FreeBSD$ */ #define SEMI ';' diff --git a/freebsd/sbin/dhclient/dispatch.c b/freebsd/sbin/dhclient/dispatch.c index c0eee929..958e38c7 100644 --- a/freebsd/sbin/dhclient/dispatch.c +++ b/freebsd/sbin/dhclient/dispatch.c @@ -2,7 +2,9 @@ /* $OpenBSD: dispatch.c,v 1.31 2004/09/21 04:07:03 david Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 1995, 1996, 1997, 1998, 1999 * The Internet Software Consortium. All rights reserved. @@ -300,7 +302,8 @@ interface_status(struct interface_info *ifinfo) memset(&ifr, 0, sizeof(ifr)); strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); if (ioctl(ifsock, SIOCGIFFLAGS, &ifr) < 0) { - syslog(LOG_ERR, "ioctl(SIOCGIFFLAGS) on %s: %m", ifname); + cap_syslog(capsyslog, LOG_ERR, "ioctl(SIOCGIFFLAGS) on %s: %m", + ifname); goto inactive; } @@ -318,9 +321,8 @@ interface_status(struct interface_info *ifinfo) strlcpy(ifmr.ifm_name, ifname, sizeof(ifmr.ifm_name)); if (ioctl(ifsock, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) { if (errno != EINVAL) { - syslog(LOG_DEBUG, "ioctl(SIOCGIFMEDIA) on %s: %m", - ifname); - + cap_syslog(capsyslog, LOG_DEBUG, + "ioctl(SIOCGIFMEDIA) on %s: %m", ifname); ifinfo->noifmedia = 1; goto active; } @@ -481,8 +483,8 @@ interface_link_status(char *ifname) if (ioctl(sock, SIOCGIFMEDIA, (caddr_t)&ifmr) == -1) { /* EINVAL -> link state unknown. treat as active */ if (errno != EINVAL) - syslog(LOG_DEBUG, "ioctl(SIOCGIFMEDIA) on %s: %m", - ifname); + cap_syslog(capsyslog, LOG_DEBUG, + "ioctl(SIOCGIFMEDIA) on %s: %m", ifname); close(sock); return (1); } diff --git a/freebsd/sbin/dhclient/errwarn.c b/freebsd/sbin/dhclient/errwarn.c index fe184997..e99f5f50 100644 --- a/freebsd/sbin/dhclient/errwarn.c +++ b/freebsd/sbin/dhclient/errwarn.c @@ -4,7 +4,9 @@ /* Errors and warnings... */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1996 The Internet Software Consortium. * All Rights Reserved. * Copyright (c) 1995 RadioMail Corporation. All rights reserved. @@ -71,7 +73,7 @@ error(char *fmt, ...) va_end(list); #ifndef DEBUG - syslog(log_priority | LOG_ERR, "%s", mbuf); + cap_syslog(capsyslog, log_priority | LOG_ERR, "%s", mbuf); #endif /* Also log it to stderr? */ @@ -80,7 +82,7 @@ error(char *fmt, ...) write(2, "\n", 1); } - syslog(LOG_CRIT, "exiting."); + cap_syslog(capsyslog, LOG_CRIT, "exiting."); if (log_perror) { fprintf(stderr, "exiting.\n"); fflush(stderr); @@ -105,7 +107,7 @@ warning(char *fmt, ...) va_end(list); #ifndef DEBUG - syslog(log_priority | LOG_ERR, "%s", mbuf); + cap_syslog(capsyslog, log_priority | LOG_ERR, "%s", mbuf); #endif if (log_perror) { @@ -131,7 +133,7 @@ note(char *fmt, ...) va_end(list); #ifndef DEBUG - syslog(log_priority | LOG_INFO, "%s", mbuf); + cap_syslog(capsyslog, log_priority | LOG_INFO, "%s", mbuf); #endif if (log_perror) { @@ -157,7 +159,7 @@ debug(char *fmt, ...) va_end(list); #ifndef DEBUG - syslog(log_priority | LOG_DEBUG, "%s", mbuf); + cap_syslog(capsyslog, log_priority | LOG_DEBUG, "%s", mbuf); #endif if (log_perror) { @@ -219,10 +221,10 @@ parse_warn(char *fmt, ...) va_end(list); #ifndef DEBUG - syslog(log_priority | LOG_ERR, "%s", mbuf); - syslog(log_priority | LOG_ERR, "%s", token_line); + cap_syslog(capsyslog, log_priority | LOG_ERR, "%s", mbuf); + cap_syslog(capsyslog, log_priority | LOG_ERR, "%s", token_line); if (lexline < 81) - syslog(log_priority | LOG_ERR, + cap_syslog(capsyslog, log_priority | LOG_ERR, "%s^", &spaces[sizeof(spaces) - lexchar]); #endif diff --git a/freebsd/sbin/dhclient/hash.c b/freebsd/sbin/dhclient/hash.c index 9bac94cf..879edbfc 100644 --- a/freebsd/sbin/dhclient/hash.c +++ b/freebsd/sbin/dhclient/hash.c @@ -4,7 +4,9 @@ /* Routines for manipulating hash tables... */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. * All rights reserved. * diff --git a/freebsd/sbin/dhclient/inet.c b/freebsd/sbin/dhclient/inet.c index 1a5c0360..8ed88886 100644 --- a/freebsd/sbin/dhclient/inet.c +++ b/freebsd/sbin/dhclient/inet.c @@ -7,7 +7,9 @@ * way... */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1996 The Internet Software Consortium. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sbin/dhclient/options.c b/freebsd/sbin/dhclient/options.c index 8dac0039..c08c5c53 100644 --- a/freebsd/sbin/dhclient/options.c +++ b/freebsd/sbin/dhclient/options.c @@ -4,7 +4,9 @@ /* DHCP options parsing and reassembly. */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. * All rights reserved. * diff --git a/freebsd/sbin/dhclient/packet.c b/freebsd/sbin/dhclient/packet.c index 28a9ccec..40e969ae 100644 --- a/freebsd/sbin/dhclient/packet.c +++ b/freebsd/sbin/dhclient/packet.c @@ -4,7 +4,9 @@ /* Packet assembly code, originally contributed by Archie Cobbs. */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995, 1996, 1999 The Internet Software Consortium. * All rights reserved. * diff --git a/freebsd/sbin/dhclient/parse.c b/freebsd/sbin/dhclient/parse.c index 88853312..45234e58 100644 --- a/freebsd/sbin/dhclient/parse.c +++ b/freebsd/sbin/dhclient/parse.c @@ -4,7 +4,9 @@ /* Common parser code for dhcpd and dhclient. */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. * All rights reserved. * diff --git a/freebsd/sbin/dhclient/tables.c b/freebsd/sbin/dhclient/tables.c index 6339898c..d33ab6fa 100644 --- a/freebsd/sbin/dhclient/tables.c +++ b/freebsd/sbin/dhclient/tables.c @@ -4,7 +4,9 @@ /* Tables of information... */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995, 1996 The Internet Software Consortium. * All rights reserved. * diff --git a/freebsd/sbin/dhclient/tree.c b/freebsd/sbin/dhclient/tree.c index f540e717..bc94e2aa 100644 --- a/freebsd/sbin/dhclient/tree.c +++ b/freebsd/sbin/dhclient/tree.c @@ -4,7 +4,9 @@ /* Routines for manipulating parse trees... */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995, 1996, 1997 The Internet Software Consortium. * All rights reserved. * diff --git a/freebsd/sbin/dhclient/tree.h b/freebsd/sbin/dhclient/tree.h index 04e08e7c..9fdcc0d3 100644 --- a/freebsd/sbin/dhclient/tree.h +++ b/freebsd/sbin/dhclient/tree.h @@ -2,7 +2,9 @@ /* Definitions for address trees... */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995 The Internet Software Consortium. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,6 +39,8 @@ * Enterprises. To learn more about the Internet Software Consortium, * see ``http://www.vix.com/isc''. To learn more about Vixie * Enterprises, see ``http://www.vix.com''. + * + * $FreeBSD$ */ /* A pair of pointers, suitable for making a linked list. */ |