diff options
-rw-r--r-- | configure.ac | 13 | ||||
-rw-r--r-- | m4/ax_compiler_vendor.m4 | 87 | ||||
-rw-r--r-- | man/systemd-path.xml | 4 | ||||
-rw-r--r-- | man/systemd-run.xml | 7 | ||||
-rw-r--r-- | man/systemd.netdev.xml | 13 | ||||
-rw-r--r-- | shell-completion/bash/systemd-run | 2 | ||||
-rw-r--r-- | src/basic/time-util.c | 4 | ||||
-rw-r--r-- | src/libsystemd-network/sd-dhcp-lease.c | 6 | ||||
-rw-r--r-- | src/libsystemd-network/sd-dhcp-server.c | 8 | ||||
-rw-r--r-- | src/login/70-power-switch.rules | 1 | ||||
-rw-r--r-- | src/network/networkctl.c | 8 | ||||
-rw-r--r-- | src/network/networkd-link.c | 8 | ||||
-rw-r--r-- | src/network/networkd-netdev-gperf.gperf | 1 | ||||
-rw-r--r-- | src/network/networkd-netdev-tunnel.c | 45 | ||||
-rw-r--r-- | src/network/networkd-netdev-tunnel.h | 6 | ||||
-rw-r--r-- | src/network/networkd-network.c | 6 | ||||
-rw-r--r-- | src/run/run.c | 39 |
17 files changed, 230 insertions, 28 deletions
diff --git a/configure.ac b/configure.ac index d9ab3624dd..10e42c07be 100644 --- a/configure.ac +++ b/configure.ac @@ -39,9 +39,14 @@ AM_SILENT_RULES([yes]) AC_CANONICAL_HOST AC_DEFINE_UNQUOTED([CANONICAL_HOST], "$host", [Canonical host string.]) -AC_CHECK_TOOLS([AR], [gcc-ar ar], [:]) -AC_CHECK_TOOLS([NM], [gcc-nm nm], [:]) -AC_CHECK_TOOLS([RANLIB], [gcc-ranlib ranlib], [:]) +AC_PROG_CC_C99 + +AX_COMPILER_VENDOR +AS_IF([test "x$ax_cv_c_compiler_vendor" = "xgnu"], [ + AC_CHECK_TOOLS([AR], [gcc-ar ar], [:]) + AC_CHECK_TOOLS([NM], [gcc-nm nm], [:]) + AC_CHECK_TOOLS([RANLIB], [gcc-ranlib ranlib], [:]) +]) LT_PREREQ(2.2) LT_INIT([disable-static]) @@ -87,8 +92,6 @@ AC_PROG_SED AC_PROG_GREP AC_PROG_AWK -AC_PROG_CC_C99 - AC_PATH_PROG([M4], [m4]) AC_PATH_PROG([XSLTPROC], [xsltproc]) diff --git a/m4/ax_compiler_vendor.m4 b/m4/ax_compiler_vendor.m4 new file mode 100644 index 0000000000..39ca3c0f33 --- /dev/null +++ b/m4/ax_compiler_vendor.m4 @@ -0,0 +1,87 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_compiler_vendor.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_COMPILER_VENDOR +# +# DESCRIPTION +# +# Determine the vendor of the C/C++ compiler, e.g., gnu, intel, ibm, sun, +# hp, borland, comeau, dec, cray, kai, lcc, metrowerks, sgi, microsoft, +# watcom, etc. The vendor is returned in the cache variable +# $ax_cv_c_compiler_vendor for C and $ax_cv_cxx_compiler_vendor for C++. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu> +# Copyright (c) 2008 Matteo Frigo +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see <http://www.gnu.org/licenses/>. +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 15 + +AC_DEFUN([AX_COMPILER_VENDOR], +[AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, + dnl Please add if possible support to ax_compiler_version.m4 + [# note: don't check for gcc first since some other compilers define __GNUC__ + vendors="intel: __ICC,__ECC,__INTEL_COMPILER + ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__ + pathscale: __PATHCC__,__PATHSCALE__ + clang: __clang__ + cray: _CRAYC + fujitsu: __FUJITSU + gnu: __GNUC__ + sun: __SUNPRO_C,__SUNPRO_CC + hp: __HP_cc,__HP_aCC + dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER + borland: __BORLANDC__,__CODEGEARC__,__TURBOC__ + comeau: __COMO__ + kai: __KCC + lcc: __LCC__ + sgi: __sgi,sgi + microsoft: _MSC_VER + metrowerks: __MWERKS__ + watcom: __WATCOMC__ + portland: __PGI + tcc: __TINYC__ + unknown: UNKNOWN" + for ventest in $vendors; do + case $ventest in + *:) vendor=$ventest; continue ;; + *) vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")" ;; + esac + AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ + #if !($vencpp) + thisisanerror; + #endif + ])], [break]) + done + ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1` + ]) +]) diff --git a/man/systemd-path.xml b/man/systemd-path.xml index dfc75ee0ff..4f790d2cda 100644 --- a/man/systemd-path.xml +++ b/man/systemd-path.xml @@ -64,9 +64,9 @@ <para>When invoked without arguments a list of known paths and their current values is shown. When at least one argument is - passed the path with this is name is queried and its value shown. + passed the path with this name is queried and its value shown. The variables whose name begins with <literal>search-</literal> - don't refer to individual paths, but instead a to a list of + don't refer to individual paths, but instead to a list of colon-separated search paths, in their order of precedence.</para> </refsect1> diff --git a/man/systemd-run.xml b/man/systemd-run.xml index 80db148702..b220e0dce1 100644 --- a/man/systemd-run.xml +++ b/man/systemd-run.xml @@ -113,6 +113,13 @@ <variablelist> <varlistentry> + <term><option>--no-ask-password</option></term> + + <listitem><para>Do not query the user for authentication for + privileged operations.</para></listitem> + </varlistentry> + + <varlistentry> <term><option>--scope</option></term> <listitem> diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml index 2680627a78..05bbad7f65 100644 --- a/man/systemd.netdev.xml +++ b/man/systemd.netdev.xml @@ -535,6 +535,19 @@ </listitem> </varlistentry> <varlistentry> + <term><varname>EncapsulationLimit=</varname></term> + <listitem> + <para>The Tunnel Encapsulation Limit option specifies how many additional + levels of encapsulation are permitted to be prepended to the packet. + For example, a Tunnel Encapsulation Limit option containing a limit + value of zero means that a packet carrying that option may not enter + another tunnel before exiting the current tunnel. + (see <ulink url="https://tools.ietf.org/html/rfc2473#section-4.1.1"> RFC 2473</ulink>). + The valid range is 0-255 and <literal>none</literal>. Defaults to 4. + </para> + </listitem> + </varlistentry> + <varlistentry> <term><varname>Mode=</varname></term> <listitem> <para>An <literal>ip6tnl</literal> tunnels can have three diff --git a/shell-completion/bash/systemd-run b/shell-completion/bash/systemd-run index 63c831b8f1..a948677516 100644 --- a/shell-completion/bash/systemd-run +++ b/shell-completion/bash/systemd-run @@ -36,7 +36,7 @@ _systemd_run() { -r --remain-after-exit --send-sighup -H --host -M --machine --service-type --on-active --on-boot --on-startup --on-unit-active --on-unit-inactive --on-calendar --timer-property -t --pty -q --quiet --no-block - --uid --gid --nice --setenv -p --property' + --uid --gid --nice --setenv -p --property --no-ask-password' local mode=--system local i diff --git a/src/basic/time-util.c b/src/basic/time-util.c index afc6a6eb24..531931f6e1 100644 --- a/src/basic/time-util.c +++ b/src/basic/time-util.c @@ -1046,7 +1046,7 @@ clockid_t clock_boottime_or_monotonic(void) { return clock; } -int get_timezone(char **timezone) { +int get_timezone(char **tz) { _cleanup_free_ char *t = NULL; const char *e; char *z; @@ -1069,6 +1069,6 @@ int get_timezone(char **timezone) { if (!z) return -ENOMEM; - *timezone = z; + *tz = z; return 0; } diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c index 6551e7c94c..aa07846693 100644 --- a/src/libsystemd-network/sd-dhcp-lease.c +++ b/src/libsystemd-network/sd-dhcp-lease.c @@ -1121,13 +1121,13 @@ int dhcp_lease_set_client_id(sd_dhcp_lease *lease, const void *client_id, size_t return 0; } -int sd_dhcp_lease_get_timezone(sd_dhcp_lease *lease, const char **timezone) { +int sd_dhcp_lease_get_timezone(sd_dhcp_lease *lease, const char **tz) { assert_return(lease, -EINVAL); - assert_return(timezone, -EINVAL); + assert_return(tz, -EINVAL); if (!lease->timezone) return -ENODATA; - *timezone = lease->timezone; + *tz = lease->timezone; return 0; } diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c index 7a8b298b51..1f167485e3 100644 --- a/src/libsystemd-network/sd-dhcp-server.c +++ b/src/libsystemd-network/sd-dhcp-server.c @@ -1062,16 +1062,16 @@ int sd_dhcp_server_forcerenew(sd_dhcp_server *server) { return r; } -int sd_dhcp_server_set_timezone(sd_dhcp_server *server, const char *timezone) { +int sd_dhcp_server_set_timezone(sd_dhcp_server *server, const char *tz) { int r; assert_return(server, -EINVAL); - assert_return(timezone_is_valid(timezone), -EINVAL); + assert_return(timezone_is_valid(tz), -EINVAL); - if (streq_ptr(timezone, server->timezone)) + if (streq_ptr(tz, server->timezone)) return 0; - r = free_and_strdup(&server->timezone, timezone); + r = free_and_strdup(&server->timezone, tz); if (r < 0) return r; diff --git a/src/login/70-power-switch.rules b/src/login/70-power-switch.rules index 71f9fe6c72..36d2a3eb40 100644 --- a/src/login/70-power-switch.rules +++ b/src/login/70-power-switch.rules @@ -11,6 +11,7 @@ SUBSYSTEM=="input", KERNEL=="event*", SUBSYSTEMS=="acpi", TAG+="power-switch" SUBSYSTEM=="input", KERNEL=="event*", KERNELS=="thinkpad_acpi", TAG+="power-switch" SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="twl4030_pwrbutton", TAG+="power-switch" SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="tps65217_pwr_but", TAG+="power-switch" +SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="* WMI hotkeys", TAG+="power-switch" SUBSYSTEM=="input", KERNEL=="event*", \ SUBSYSTEMS=="platform", DRIVERS=="gpio-keys", ATTRS{keys}=="116", TAG+="power-switch" diff --git a/src/network/networkctl.c b/src/network/networkctl.c index 2281d4b718..786579def0 100644 --- a/src/network/networkctl.c +++ b/src/network/networkctl.c @@ -497,7 +497,7 @@ static int link_status_one( sd_hwdb *hwdb, const char *name) { _cleanup_strv_free_ char **dns = NULL, **ntp = NULL, **domains = NULL; - _cleanup_free_ char *setup_state = NULL, *operational_state = NULL, *timezone = NULL; + _cleanup_free_ char *setup_state = NULL, *operational_state = NULL, *tz = NULL; _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL; _cleanup_device_unref_ sd_device *d = NULL; char devid[2 + DECIMAL_STR_MAX(int)]; @@ -662,9 +662,9 @@ static int link_status_one( if (!strv_isempty(carrier_bound_by)) dump_list("Carrier Bound By: ", carrier_bound_by); - (void) sd_network_link_get_timezone(ifindex, &timezone); - if (timezone) - printf(" Time Zone: %s", timezone); + (void) sd_network_link_get_timezone(ifindex, &tz); + if (tz) + printf(" Time Zone: %s", tz); return 0; } diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 979f3115f6..1dc9db0fca 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -967,14 +967,14 @@ static int set_timezone_handler(sd_bus_message *m, void *userdata, sd_bus_error return 1; } -int link_set_timezone(Link *link, const char *timezone) { +int link_set_timezone(Link *link, const char *tz) { int r; assert(link); assert(link->manager); - assert(timezone); + assert(tz); - log_link_debug(link, "Setting system timezone: '%s'", timezone); + log_link_debug(link, "Setting system timezone: '%s'", tz); if (!link->manager->bus) { log_link_info(link, "Not connected to system bus, ignoring timezone."); @@ -991,7 +991,7 @@ int link_set_timezone(Link *link, const char *timezone) { set_timezone_handler, link, "sb", - timezone, + tz, false); if (r < 0) return log_link_error_errno(link, r, "Could not set timezone: %m"); diff --git a/src/network/networkd-netdev-gperf.gperf b/src/network/networkd-netdev-gperf.gperf index 9469160eba..e0bd0e024a 100644 --- a/src/network/networkd-netdev-gperf.gperf +++ b/src/network/networkd-netdev-gperf.gperf @@ -39,6 +39,7 @@ Tunnel.DiscoverPathMTU, config_parse_bool, 0, Tunnel.Mode, config_parse_ip6tnl_mode, 0, offsetof(Tunnel, ip6tnl_mode) Tunnel.IPv6FlowLabel, config_parse_ipv6_flowlabel, 0, offsetof(Tunnel, ipv6_flowlabel) Tunnel.CopyDSCP, config_parse_bool, 0, offsetof(Tunnel, copy_dscp) +Tunnel.EncapsulationLimit, config_parse_encap_limit, 0, offsetof(Tunnel, encap_limit) Peer.Name, config_parse_ifname, 0, offsetof(Veth, ifname_peer) Peer.MACAddress, config_parse_hwaddr, 0, offsetof(Veth, mac_peer) VXLAN.Id, config_parse_uint64, 0, offsetof(VxLan, id) diff --git a/src/network/networkd-netdev-tunnel.c b/src/network/networkd-netdev-tunnel.c index 265e67b7e3..a906e473b6 100644 --- a/src/network/networkd-netdev-tunnel.c +++ b/src/network/networkd-netdev-tunnel.c @@ -284,6 +284,12 @@ static int netdev_ip6tnl_fill_message_create(NetDev *netdev, Link *link, sd_netl if (t->copy_dscp) t->flags |= IP6_TNL_F_RCV_DSCP_COPY; + if (t->encap_limit != IPV6_DEFAULT_TNL_ENCAP_LIMIT) { + r = sd_netlink_message_append_u8(m, IFLA_IPTUN_ENCAP_LIMIT, t->encap_limit); + if (r < 0) + return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_ENCAP_LIMIT attribute: %m"); + } + r = sd_netlink_message_append_u32(m, IFLA_IPTUN_FLAGS, t->flags); if (r < 0) return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_FLAGS attribute: %m"); @@ -442,6 +448,45 @@ int config_parse_ipv6_flowlabel(const char* unit, return 0; } +int config_parse_encap_limit(const char* unit, + const char *filename, + unsigned line, + const char *section, + unsigned section_line, + const char *lvalue, + int ltype, + const char *rvalue, + void *data, + void *userdata) { + Tunnel *t = userdata; + int k = 0; + int r; + + assert(filename); + assert(lvalue); + assert(rvalue); + + if (streq(rvalue, "none")) + t->flags |= IP6_TNL_F_IGN_ENCAP_LIMIT; + else { + r = safe_atoi(rvalue, &k); + if (r < 0) { + log_syntax(unit, LOG_ERR, filename, line, r, + "Failed to parse Tunnel Encapsulation Limit option, ignoring: %s", rvalue); + return 0; + } + + if (k > 255 || k < 0) + log_syntax(unit, LOG_ERR, filename, line, k, "Invalid Tunnel Encapsulation value, ignoring: %d", k); + else { + t->encap_limit = k; + t->flags &= ~IP6_TNL_F_IGN_ENCAP_LIMIT; + } + } + + return 0; +} + static void ipip_init(NetDev *n) { Tunnel *t = IPIP(n); diff --git a/src/network/networkd-netdev-tunnel.h b/src/network/networkd-netdev-tunnel.h index e4fa74aef4..fa7decce18 100644 --- a/src/network/networkd-netdev-tunnel.h +++ b/src/network/networkd-netdev-tunnel.h @@ -95,3 +95,9 @@ int config_parse_ipv6_flowlabel(const char *unit, const char *filename, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); + +int config_parse_encap_limit(const char *unit, const char *filename, + unsigned line, const char *section, + unsigned section_line, const char *lvalue, + int ltype, const char *rvalue, void *data, + void *userdata); diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 2a77242013..ee14401982 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -786,7 +786,7 @@ int config_parse_timezone( void *data, void *userdata) { - char **timezone = data, *tz = NULL; + char **datap = data, *tz = NULL; int r; assert(filename); @@ -803,8 +803,8 @@ int config_parse_timezone( return 0; } - free(*timezone); - *timezone = tz; + free(*datap); + *datap = tz; return 0; } diff --git a/src/run/run.c b/src/run/run.c index 3dd97022de..a69560208c 100644 --- a/src/run/run.c +++ b/src/run/run.c @@ -36,7 +36,9 @@ #include "ptyfwd.h" #include "formats-util.h" #include "signal-util.h" +#include "spawn-polkit-agent.h" +static bool arg_ask_password = true; static bool arg_scope = false; static bool arg_remain_after_exit = false; static bool arg_no_block = false; @@ -64,6 +66,18 @@ static char *arg_on_calendar = NULL; static char **arg_timer_property = NULL; static bool arg_quiet = false; +static void polkit_agent_open_if_enabled(void) { + + /* Open the polkit agent as a child process if necessary */ + if (!arg_ask_password) + return; + + if (arg_transport != BUS_TRANSPORT_LOCAL) + return; + + polkit_agent_open(); +} + static void help(void) { printf("%s [OPTIONS...] {COMMAND} [ARGS...]\n\n" "Run the specified command in a transient scope or service or timer\n" @@ -71,6 +85,7 @@ static void help(void) { "specified with --unit option then command can be omitted.\n\n" " -h --help Show this help\n" " --version Show package version\n" + " --no-ask-password Do not prompt for password\n" " --user Run as user unit\n" " -H --host=[USER@]HOST Operate on remote host\n" " -M --machine=CONTAINER Operate on local container\n" @@ -108,6 +123,7 @@ static int parse_argv(int argc, char *argv[]) { enum { ARG_VERSION = 0x100, + ARG_NO_ASK_PASSWORD, ARG_USER, ARG_SYSTEM, ARG_SCOPE, @@ -160,6 +176,7 @@ static int parse_argv(int argc, char *argv[]) { { "on-calendar", required_argument, NULL, ARG_ON_CALENDAR }, { "timer-property", required_argument, NULL, ARG_TIMER_PROPERTY }, { "no-block", no_argument, NULL, ARG_NO_BLOCK }, + { "no-ask-password", no_argument, NULL, ARG_NO_ASK_PASSWORD }, {}, }; @@ -177,6 +194,10 @@ static int parse_argv(int argc, char *argv[]) { help(); return 0; + case ARG_NO_ASK_PASSWORD: + arg_ask_password = false; + break; + case ARG_VERSION: puts(PACKAGE_STRING); puts(SYSTEMD_FEATURES); @@ -745,6 +766,10 @@ static int start_transient_service( if (r < 0) return bus_log_create_error(r); + r = sd_bus_message_set_allow_interactive_authorization(m, arg_ask_password); + if (r < 0) + return bus_log_create_error(r); + /* Name and mode */ r = sd_bus_message_append(m, "ss", service, "fail"); if (r < 0) @@ -768,6 +793,8 @@ static int start_transient_service( if (r < 0) return bus_log_create_error(r); + polkit_agent_open_if_enabled(); + r = sd_bus_call(bus, m, 0, &error, &reply); if (r < 0) { log_error("Failed to start transient service unit: %s", bus_error_message(&error, -r)); @@ -860,6 +887,10 @@ static int start_transient_scope( if (r < 0) return bus_log_create_error(r); + r = sd_bus_message_set_allow_interactive_authorization(m, arg_ask_password); + if (r < 0) + return bus_log_create_error(r); + /* Name and Mode */ r = sd_bus_message_append(m, "ss", scope, "fail"); if (r < 0) @@ -883,6 +914,8 @@ static int start_transient_scope( if (r < 0) return bus_log_create_error(r); + polkit_agent_open_if_enabled(); + r = sd_bus_call(bus, m, 0, &error, &reply); if (r < 0) { log_error("Failed to start transient scope unit: %s", bus_error_message(&error, -r)); @@ -1025,6 +1058,10 @@ static int start_transient_timer( if (r < 0) return bus_log_create_error(r); + r = sd_bus_message_set_allow_interactive_authorization(m, arg_ask_password); + if (r < 0) + return bus_log_create_error(r); + /* Name and Mode */ r = sd_bus_message_append(m, "ss", timer, "fail"); if (r < 0) @@ -1077,6 +1114,8 @@ static int start_transient_timer( if (r < 0) return bus_log_create_error(r); + polkit_agent_open_if_enabled(); + r = sd_bus_call(bus, m, 0, &error, &reply); if (r < 0) { log_error("Failed to start transient timer unit: %s", bus_error_message(&error, -r)); |