From 7ed07a553eaa62a184d4459d7933427b3d539dd88be9f7b8f0246f77fc3aef8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Fri, 2 Aug 2024 15:13:26 +0200 Subject: [PATCH] Sync from SUSE:SLFO:Main dhcp revision 7e62c3b1602585e643dfe0406e9f085c --- dhclient-script | 755 ++++++++++++++++++++++++++++++++++++++++++++++++ dhcp.changes | 23 ++ dhcp.spec | 102 +++---- 3 files changed, 822 insertions(+), 58 deletions(-) create mode 100644 dhclient-script diff --git a/dhclient-script b/dhclient-script new file mode 100644 index 0000000..6f9ef7f --- /dev/null +++ b/dhclient-script @@ -0,0 +1,755 @@ +#!/bin/bash +# +# Copyright (C) 2010-2013 SUSE LINUX Products GmbH / Novell Inc. +# Copyright (C) 2013-2014 SUSE LINUX GmbH +# +# 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 2 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 . +# +# Author: Marius Tomaschewski +# +# /sbin/dhclient-script for openSUSE / SUSE Linux Enterprise Server +# based on the scripts shipped with the ISC DHCP (4.1.1) client. +# +# Note: +# It is used by sysconfig alias netcontrol alias ifup-dhcp, +# but not by the NetworkManager that is using an own script. +# +# Wicked is using an another dhcp client (runtime conflict). +# As sysconfig-network is gone on sles12 and opensuse > 13.1, +# this script is obsolete and unsupported. +# + +## +## check mandatory parameters or ignore & exit +## +test "x$reason" = x -o "x$interface" = x && exit 1 + +# +# source sysconfig functions +# +SYSCONFIG_CFG_DIR="/etc/sysconfig/network" +if test -f "$SYSCONFIG_CFG_DIR/scripts/functions" ; then + . "$SYSCONFIG_CFG_DIR/scripts/functions" +fi +SYSCONFIG_RUN_DIR=${SYSCONFIG_RUN_DIR:-/dev/.sysconfig/network} + +# +# Debugging: +# logs entire run of dhclient-script to /var/log/${dhclient}-script.*.log, +# when DHCLIENT_DEBUG/DHCLIENT6_DEBUG are "yes" in sysconfig/network/dhcp +# +eval `grep '^DHCLIENT6\?_DEBUG=' "$SYSCONFIG_CFG_DIR/dhcp" 2>/dev/null` +case $reason in + *6) DEBUG=$DHCLIENT6_DEBUG ; dhclient=dhclient6 ; ipver=6 ;; + *) DEBUG=$DHCLIENT_DEBUG ; dhclient=dhclient ; ipver=4 ;; +esac +if [ "$DEBUG" = yes ]; then + set -a # allexport + ( + echo '****************' + echo "$0 $*" + date + echo '----------------' + env + echo '----------------' + ) >> /var/log/${dhclient}-script.$interface.log + exec 2>> /var/log/${dhclient}-script.$interface.log + set +a + set -x +fi + +network_service_conflicts() +{ + local _id=`/usr/bin/systemctl --no-pager -p Id show network.service 2>/dev/null` + case "${_id#Id=}" in + # wicked is using an another dhcp client - dhclient + # is not supported with enabled wicked and disabled. + wicked.service) + logger -t "${0##*/}" -p daemon.error -- \ + "dhclient conflicts with enabled ${_id#Id=} and disabled" + return 1 + ;; + + # NetworkManager is using an another script + # [disarmed except maintainer requests it] + #NetworkManager.service) + # logger -t "${0##*/}" -p daemon.error -- \ + # "dhclient-script conflicts with enabled ${_id#Id=} script and disabled" + # return 1 + #;; + + # sysconfig network [gone] were using it, other? + network.service|*) + return 0 + ;; + esac +} + +network_service_conflicts || exit 1 + +is_ifup_controlled() +{ + test -f "$SYSCONFIG_RUN_DIR/if-${interface}" +} +# netconfig makes all "additional" modifications as DNS or NTP +netconfig_modify() { + if test -x /sbin/netconfig -a -n "$interface" ; then + { + echo "INTERFACE='$interface'" + for v in ${!new_*}; do + case $ipver in + 6) + case $v in + (new_ip6_address) k='IPADDR' ;; + (new_ip6_prefixlen) k='PREFIXLEN' ;; + (new_dhcp6_client_id) k='DHCP6CID' ;; + (new_dhcp6_server_id) k='DHCP6SID' ;; + (new_dhcp6_domain_search) k='DNSSEARCH' ;; + (new_dhcp6_name_servers) k='DNSSERVERS' ;; + (new_dhcp6_sntp_servers) k='NTPSERVERS' ;; + #(new_dhcp6_nis_domain) k='NISDOMAIN' ;; + #(new_dhcp6_nis_servers) k='NISSERVERS' ;; + (*) k="dhclient6_${v#new_}" ;; + esac + ;; + 4) + case $v in + (new_ip_address) k='IPADDR' ;; + (new_subnet_mask) k='NETMASK' ;; + (new_network_number) k='NETWORK' ;; + (new_broadcast_address) k='BROADCAST' ;; + (new_interface_mtu) k='MTU' ;; + (new_rfc3442_classless_static_routes_formatted) + k='ROUTES' ;; + # (new_static_routes) k='ROUTES' ;; + (new_routers) k='GATEWAYS' ;; + (new_host_name) k='HOSTNAME' ;; + (new_domain_search) k='DNSSEARCH' ;; + (new_domain_name) k='DNSDOMAIN' ;; + (new_domain_name_servers) k='DNSSERVERS' ;; + (new_ntp_servers) k='NTPSERVERS' ;; + (new_nis_domain) k='NISDOMAIN' ;; + (new_nis_servers) k='NISSERVERS' ;; + (new_root_path) k='ROOTPATH' ;; + (new_dhcp_server_identifier)k='DHCPSID' ;; + (new_lpr_servers) k='LPRSERVER' ;; + (new_log_servers) k='LOGSERVER' ;; + (new_netbios_dd_server) k='NETBIOSDDSERVER' ;; + (new_netbios_name_servers) k='NETBIOSNAMESERVER' ;; + (new_netbios_node_type) k='NETBIOSNODETYPE' ;; + (new_netbios_scope) k='NETBIOSSCOPE' ;; + (*) k="dhclient_${v#new_}" ;; + esac + esac + [ "k${k}" != k ] && echo "${k}='${!v}'" + done + } | /sbin/netconfig modify -s "dhclient$ipver" -i "$interface" + fi +} +netconfig_remove() { + if test -x /sbin/netconfig -a -n "$interface" ; then + /sbin/netconfig remove -s "dhclient$ipver" -i "$interface" &1` && return 0 + case $err in + RTNETLINK*answers:*File*exists) ;; + RTNETLINK*answers:*No*such*process) + # + # The gateway seems to be not reachable via local network + # route (implicitly created by ifconfig based on the IP + # and netmask provided by dhcp). + # Check this, set an explicit host route to the gateway + # over the current interface and try again (bnc#266215). + # + retry=0 + for router in ${gate[@]} ; do + matches=$(/sbin/ip -f inet -o route list match $router | \ + grep -v ^default | grep -c -v "^$" 2>/dev/null) + if [ -n "$matches" -a $(($matches)) -eq 0 ] ; then + LC_ALL=C /sbin/ip route add $router/32 dev $interface || retry=1 + fi + done + if [ $retry -eq 0 ] ; then + LC_ALL=C /sbin/ip route replace ${args[*]} && return 0 + fi + ;; + esac + return 1 +} +get_ipv4_default_gw() +{ + if [ "x$new_rfc3442_classless_static_routes_formatted" != x ] ; then + local r route=() gw=() + for r in $new_rfc3442_classless_static_routes_formatted ; do + route=(${r//,/ }) + case ${route[0]}/${route[1]} in + 0.0.0.0/0.0.0.0) + [ "x${route[2]}" = "x0.0.0.0" ] || \ + gw+=(${route[2]}) + ;; + esac + done + echo "${gw[*]}" + elif [ "$new_routers" != x ] ; then + echo "$new_routers" + fi +} +set_ipv4_routes() +{ + if [ "x$new_rfc3442_classless_static_routes_formatted" != x ] ; then + local r route=() + # TODO: multiple gw's to one dest as in $new_routers? + for r in $new_rfc3442_classless_static_routes_formatted ; do + route=(${r//,/ }) + case ${route[0]}/${route[1]} in + 0.0.0.0/0.0.0.0) + [ "x$DHCLIENT_SET_DEFAULT_ROUTE" = xyes ] || continue ;; + esac + set_ipv4_route ${route[*]} + done + elif [ "$new_routers" != x ] ; then + if [ "x$DHCLIENT_SET_DEFAULT_ROUTE" = xyes ] ; then + set_ipv4_route default "" $new_routers + fi + fi +} +set_hostname() +{ + rx_host='^[[:alnum:]][[:alnum:]_-]{0,62}$' + if [ "$DHCLIENT_SET_HOSTNAME" = yes ] ; then + new_host_name="${new_host_name%%.*}" + [[ ${new_host_name} =~ ${rx_host} ]] || unset new_host_name + current_hostname=`hostname` + current_hostname="${current_hostname%%.*}" + [[ ${current_hostname} =~ ${rx_host} ]] || unset current_hostname + + if [ "x${current_hostname}" = "x" ] || \ + [ "x${current_hostname}" = "xlocalhost" ] || \ + [ "x${current_hostname}" != "x${new_host_name}" ]; then + if [ "x${new_host_name}" != "x" ]; then + hostname "${new_host_name}" + else + if [ -x /usr/bin/getent ] ; then + if out=`timeout 2s /usr/bin/getent hosts "$new_ip_address" 2>/dev/null` ; then + _hostname="`echo "$out" | sed 's:^.* ::; s:\..*::; s:.*[)]::'`" + [[ ${_hostname} =~ ${rx_host} ]] || unset _hostname + if [ "x${_hostname}" != "x" -a \ + "x${_hostname}" != "x${current_hostname}" ]; then + hostname "${_hostname}" + fi + fi + fi + fi + fi + fi + if is_ifup_controlled ; then + # check regardless the DHCLIENT_SET_HOSTNAME setting + # and whether we've set it above or not, because when + # it changed, we've to handle it anyway... + local OLD_HOSTNAME=`read_cached_config_data hostname $interface` + local CUR_HOSTNAME=`hostname 2>/dev/null` + CUR_HOSTNAME="${CUR_HOSTNAME%%.*}" + if [[ ${CUR_HOSTNAME} =~ ${rx_host} ]] && \ + [ "x$OLD_HOSTNAME" != "x$CUR_HOSTNAME" ] ; then + write_cached_config_data hostname "$CUR_HOSTNAME" $interface + commit_cached_config_data $interface + + # reload syslog so it knows the new hostname + if test -x /usr/bin/systemctl ; then + /usr/bin/systemctl reload syslog.service + fi + fi + fi +} +dhcp6_dad_check() +{ + local ifname="$1" word i + local ipaddr="$2" + local noaddr=1 nodad=0 tentative=0 dadfailed=0 + test -n "$ifname" -a -n "$ipaddr" || return 1 + + while read -a word ; do + test "${word[0]}" != "inet6" && continue + noaddr=0 + for((i=2; i<${#word[@]}; ++i)) ; do + case ${word[$i]} in + nodad) nodad=1 ;; + tentative) tentative=1 ;; + dadfailed) dadfailed=1 ;; + flags) ((i++)) + rx='^[[:xdigit:]]+$' + [[ "${word[$i]}" =~ $rx ]] || continue + hx="0x${word[$i]}" + ((hx & 0x02)) && nodad=1 + ((hx & 0x08)) && dadfailed=1 + ((hx & 0x40)) && tentative=1 + ;; + esac + done + ((nodad)) && continue + ((dadfailed)) && return 3 + ((tentative)) && return 2 + done < <(LC_ALL=C ip -6 addr show dev "${ifname}" to "${ipaddr}" 2>/dev/null) + # on dad failure of dynamic (non-persistent) address, + # the kernel deletes dad failed addresses + # that is, the address is tentative (2) and vanishes + # (4) and is not visible as dadfailed (3). + ((noaddr)) && return 4 || return 0 +} +dhcp6_dad_wait() +{ + local ifname="$1" + local ipaddr="$2" + local -i wsecs=${3:-0} + local -i uwait=25000 + local -i loops=$(((wsecs * 1000000) / uwait)) + local -i loop=0 ret=0 + + dhcp6_dad_check "$ifname" "$ipaddr" ; ret=$? + while ((ret == 2 && loop++ < loops)) ; do + sleep 0.25 + dhcp6_dad_check "$ifname" "$ipaddr" ; ret=$? + done + return $ret +} + +# Must be used on exit. Invokes the local dhcp client exit hooks, if any. +exit_with_hooks() { + exit_status=$1 + if [ -f /etc/${dhclient}-exit-hooks ]; then + . /etc/${dhclient}-exit-hooks + fi + # probably should do something with exit status of the local script + exit $exit_status +} + +# Invoke the local dhcp client enter hooks, if they exist. +if [ -f /etc/${dhclient}-enter-hooks ]; then + exit_status=0 + . /etc/${dhclient}-enter-hooks + # allow the local script to abort processing of this state + # local script must set exit_status variable to nonzero. + if [ $exit_status -ne 0 ]; then + exit $exit_status + fi +fi + +case $dhclient in +dhclient) + if is_ifup_controlled ; then + # STARTMODE + eval `grep --no-filename \ + '^[[:space:]]*STARTMODE=' \ + "$SYSCONFIG_CFG_DIR/ifcfg-${interface}" 2>/dev/null` + tmp_startmode=`read_cached_config_data startmode $INTERFACE` + [ -n "$tmp_startmode" ] && STARTMODE="$tmp_startmode" + + # DHCLIENT_SET_HOSTNAME and DHCLIENT_SET_DEFAULT_ROUTE + if grep -qs '^primary=yes' "$SYSCONFIG_RUN_DIR/if-${interface}" 2>/dev/null ; + then + eval `grep --no-filename \ + '^[[:space:]]*DHCLIENT_SET_\(HOSTNAME\|DEFAULT_ROUTE\)=' \ + "$SYSCONFIG_CFG_DIR/dhcp" \ + "$SYSCONFIG_CFG_DIR/ifcfg-${interface}" 2>/dev/null` + else + eval `grep --no-filename \ + '^[[:space:]]*DHCLIENT_SET_\(HOSTNAME\|DEFAULT_ROUTE\)=' \ + "$SYSCONFIG_CFG_DIR/ifcfg-${interface}" 2>/dev/null` + fi + else + STARTMODE=manual + eval `grep --no-filename \ + '^[[:space:]]*DHCLIENT_SET_\(HOSTNAME\|DEFAULT_ROUTE\)=' \ + "$SYSCONFIG_CFG_DIR/dhcp" 2>/dev/null` + fi + if [ "x$new_rfc3442_classless_static_routes" != x ] ; then + new_rfc3442_classless_static_routes_formatted=$( + parse_ipv4_classless_routes $new_rfc3442_classless_static_routes + ) + else + unset new_rfc3442_classless_static_routes_formatted + fi + if [ x$new_broadcast_address != x ] ; then + new_broadcast_arg="brd $new_broadcast_address" + elif [ "x$new_subnet_mask" != "x255.255.255.255" ] ; then + new_broadcast_arg="brd +" + fi + if [ x$new_interface_mtu != x -a \ + $(( $new_interface_mtu )) -le 576 ] ; + then + # 68 is the minimal legal value, but 576 the real life minimum + unset new_interface_mtu + fi + if [ x$IF_METRIC != x ]; then + metric_arg="metric $IF_METRIC" + fi +;; +dhclient6) + if is_ifup_controlled ; then + # STARTMODE + eval `grep --no-filename \ + '^[[:space:]]*STARTMODE=' \ + "$SYSCONFIG_CFG_DIR/ifcfg-${interface}" 2>/dev/null` + tmp_startmode=`read_cached_config_data startmode $INTERFACE` + [ -n "$tmp_startmode" ] && STARTMODE="$tmp_startmode" + else + STARTMODE=manual + fi +;; +esac + +case $reason in +###################################################################### +## DHCPv4 # +###################################################################### + +MEDIUM) + #################################################################### + exit_with_hooks 0 +;; + +PREINIT) + #################################################################### + if [ "x$alias_ip_address" != x ]; then + /sbin/ip addr del $alias_ip_address/$alias_subnet_mask dev $interface + fi + if [ "x$STARTMODE" != "xnfsroot" ] ; then + /sbin/ip -4 addr flush dev $interface + fi + /sbin/ip link set $interface up + + # We need to give the kernel some time to get the interface up. + sleep 1 + + exit_with_hooks 0 +;; + +ARPCHECK|ARPSEND) + #################################################################### + exit_with_hooks 0 +;; + +BOUND|RENEW|REBIND|REBOOT) + #################################################################### + + if [ x$alias_ip_address != x -a x$alias_ip_address != x$old_ip_address -a \ + x$new_ip_address != x$old_ip_address ] ; + then + # Possible new alias. Remove old alias. + /sbin/ip addr del $alias_ip_address/$alias_subnet_mask dev $interface + fi + if [ x$old_ip_address != x -a x$old_ip_address != x$new_ip_address ]; then + # IP address changed. Flush to clear routes and ARP cache. + if [ "x$STARTMODE" != "xnfsroot" ] ; then + /sbin/ip -4 addr flush dev $interface + fi + fi + + if [ x$new_interface_mtu != x ] ; then + /sbin/ip link set $interface mtu $new_interface_mtu + fi + if [ x$new_ip_address != x ] && \ + [ x$new_ip_address != x$old_ip_address -o \ + x$reason = xBOUND -o x$reason = xREBOOT ]; then + + /sbin/ip addr add $new_ip_address/${new_subnet_mask:-32} \ + ${new_broadcast_arg} \ + dev $interface + + set_ipv4_routes + fi + if [ x$new_ip_address != x$alias_ip_address -a x$alias_ip_address != x \ + -a x$new_ip_address != x$old_ip_address ]; + then + /sbin/ip addr add $alias_ip_address/$alias_subnet_mask \ + dev $interface + fi + + netconfig_modify + + if [ x$old_ip_address != x -a x$old_ip_address != x$new_ip_address ]; then + if is_ifup_controlled ; then + ifdown $interface -o dhcp + + write_cached_config_data dhcp4_state "up" $interface + commit_cached_config_data $interface + fi + else + if is_ifup_controlled ; then + write_cached_config_data dhcp4_state "new" $interface + commit_cached_config_data $interface + fi + fi + + set_hostname + + if is_ifup_controlled ; then + # execute ifservice and if-up.d scripts + ifup $interface -o dhcp + + write_cached_config_data dhcp4_state "complete" $interface + commit_cached_config_data $interface + fi + + exit_with_hooks 0 +;; + +EXPIRE|FAIL|RELEASE|STOP) + #################################################################### + if [ x$old_ip_address != x ]; then + if [ "x$STARTMODE" != "xnfsroot" ] ; then + /sbin/ip -4 addr flush dev $interface + fi + fi + if [ x$alias_ip_address != x ]; then + /sbin/ip addr add $alias_ip_address/$alias_subnet_mask \ + dev $interface + fi + + if is_ifup_controlled ; then + write_cached_config_data dhcp4_state "down" $interface + commit_cached_config_data $interface + fi + netconfig_remove + + exit_with_hooks 0 +;; + +TIMEOUT) + #################################################################### + if [ x$alias_ip_address != x ]; then + /sbin/ip addr del $alias_ip_address/$alias_subnet_mask \ + dev $interface + fi + + if [ x$new_ip_address != x -a x$old_ip_address != x$new_ip_address ]; + then + /sbin/ip addr add $new_ip_address/${new_subnet_mask:-32} \ + ${new_broadcast_arg} \ + dev $interface + + set -- $(get_ipv4_default_gw) + if [ -n "$1" ] && /usr/sbin/arping -q -c 1 -w 5 -I $interface $1 ; + then + if [ x$new_ip_address != x$alias_ip_address ] && \ + [ x$alias_ip_address != x ]; then + /sbin/ip addr add $alias_ip_address/$alias_subnet_arg + fi + + set_ipv4_routes + + netconfig_modify + + set_hostname + if is_ifup_controlled ; then + # execute ifservice and if-up.d scripts + ifup $interface -o dhcp + + write_cached_config_data dhcp4_state "complete" $interface + commit_cached_config_data $interface + fi + + exit_with_hooks 0 + else + if [ x$old_ip_address != x ]; then + if [ "x$STARTMODE" != "xnfsroot" ] ; then + /sbin/ip -4 addr flush dev $interface + fi + fi + + if is_ifup_controlled ; then + write_cached_config_data dhcp4_state "down" $interface + commit_cached_config_data $interface + fi + netconfig_remove + + exit_with_hooks 1 + fi + fi +;; + + +###################################################################### +## DHCPv6 # +###################################################################### + +PREINIT6) + #################################################################### + if [ "x$STARTMODE" != "xnfsroot" ] ; then + /sbin/ip -6 addr flush dev $interface scope global permanent + fi + /sbin/ip link set $interface up + + # We need to give the kernel some time to get the interface up. + sleep 1 + + exit_with_hooks 0 +;; + +BOUND6|RENEW6|REBIND6|REBOOT6) + #################################################################### + + if [ x$old_ip6_address != x -a x$old_ip6_address != x$new_ip6_address ]; + then + + /sbin/ip addr del "$old_ip6_address/$old_ip6_prefixlen" dev $interface + + if is_ifup_controlled ; then + write_cached_config_data dhcp6_state "up" $interface + commit_cached_config_data $interface + fi + else + if is_ifup_controlled ; then + write_cached_config_data dhcp6_state "new" $interface + commit_cached_config_data $interface + fi + fi + + if [ "x$new_ip6_address" != x -a "x$new_ip6_prefixlen" != x ] ; then + /sbin/ip addr replace "$new_ip6_address/$new_ip6_prefixlen" \ + scope global dev $interface \ + ${new_max_life:+valid_lft $new_max_life} \ + ${new_preferred_life:+preferred_lft $new_preferred_life} \ + || exit_with_hooks 2 + + echo >&2 "Checking DAD results for $new_ip6_address" + + if ! dhcp6_dad_wait "$interface" "$new_ip6_address/$new_ip6_prefixlen" 5 ; then + /sbin/ip addr del "$new_ip6_address/$new_ip6_prefixlen" dev $interface 2>/dev/null + exit_with_hooks 3 + fi + fi + + netconfig_modify + if [ x$old_ip6_address != x -a x$old_ip6_address != x$new_ip6_address ]; + then + if is_ifup_controlled ; then + /sbin/ifdown $interface -o dhcp + fi + fi + + #set_hostname + if is_ifup_controlled ; then + # execute ifservice and if-up.d scripts + /sbin/ifup $interface -o dhcp + + write_cached_config_data dhcp6_state "complete" $interface + commit_cached_config_data $interface + fi + + exit_with_hooks 0 +;; + +DEPREF6) + #################################################################### + if [ x$cur_ip6_address = x -o x$cur_ip6_prefixlen = x ] ; then + exit_with_hooks 2 + fi + + /sbin/ip addr change "$cur_ip6_address/$cur_ip6_prefixlen" \ + dev $interface scope global preferred_lft 0 + + exit_with_hooks 0 +;; + +EXPIRE6|RELEASE6|STOP6) + #################################################################### + if [ x$old_ip6_address != x -a x$old_ip6_prefixlen != x ] ; then + /sbin/ip addr del "$old_ip6_address/$old_ip6_prefixlen" \ + dev $interface + fi + + if is_ifup_controlled ; then + write_cached_config_data dhcp6_state "down" $interface + commit_cached_config_data $interface + fi + netconfig_remove + + exit_with_hooks 0 +;; +esac + +exit_with_hooks 0 diff --git a/dhcp.changes b/dhcp.changes index 1d48a00..398b1dc 100644 --- a/dhcp.changes +++ b/dhcp.changes @@ -1,3 +1,26 @@ +------------------------------------------------------------------- +Fri May 24 13:51:57 UTC 2024 - Thorsten Kukuk + +- Drop initscripts-legacy support [jsc#PED264] +- Drop rc symlinks [jsc#PED-264], [jsc#PED-266] + +------------------------------------------------------------------- +Mon Feb 26 07:45:20 UTC 2024 - Dominique Leuenberger + +- Use %patch -P N instead of deprecated %patchN. + +------------------------------------------------------------------- +Thu Dec 7 13:31:06 UTC 2023 - Jorik Cronenberg + +- Revert dhclient-script removal and instead change usleep to sleep + (boo#1216822) + +------------------------------------------------------------------- +Tue Dec 5 15:24:29 UTC 2023 - Jorik Cronenberg + +- Add new Kea migration assistant subpackage +- Switch doc subpackage to noarch + ------------------------------------------------------------------- Thu Nov 2 13:53:11 UTC 2023 - Petr Vorel diff --git a/dhcp.spec b/dhcp.spec index aebd4dc..4d5f5f9 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -1,7 +1,7 @@ # # spec file for package dhcp # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -57,6 +57,7 @@ Source21: dhclient6.conf Source22: dhcpd.conf Source23: dhcpd6.conf Source26: sysconfig.syslog-dhcpd +Source27: dhclient-script # Source41: dhcp.README Source43: DDNS-howto.txt @@ -151,6 +152,7 @@ Requires: dhcp = %{version} %package doc Summary: Documentation Group: Productivity/Networking/Boot/Servers +BuildArch: noarch %description This package contains common programs used by both the ISC DHCP @@ -167,7 +169,9 @@ configure the network setup. IP address, hostname, routing, nameserver, netmask, and broadcast can be dynamically assigned while booting the machine. -It is configurable via the configuration file %{_sysconfdir}/dhclient.conf. +It is configurable via the configuration file %{_sysconfdir}/dhclient.conf and +you can define your own 'hooks' to be used by the /sbin/dhclient-script +(which is called by the daemon). %description relay This is the ISC DHCP relay agent. It can be used as a 'gateway' for @@ -183,6 +187,13 @@ the software. The manual pages are in the corresponding packages. This package contains all of the libraries and headers for developing with the Internet Software Consortium (ISC) dhcpctl API. +%package keama +Summary: Migration assistant from dhcp to kea + +%description keama +This package provides a migration assistant for kea, the successor of the ISC +DHCP server. + %prep if test "%version" != $(echo %isc_version | tr "-" "."); then echo "error: %%version and %%isc_version are not in sync." @@ -190,26 +201,26 @@ if test "%version" != $(echo %isc_version | tr "-" "."); then fi %setup -q -n %{name}-%{isc_version} -a 44 -a 45 ## -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch6 -p1 -%patch7 -p1 -%patch8 -p1 -%patch9 -%patch10 -p1 -%patch12 -p1 -%patch14 -%patch15 -p1 -%patch16 -%patch17 -p1 -%patch18 -p1 -%patch20 -%patch21 -%patch22 -%patch23 +%patch -P 1 -p1 +%patch -P 2 -p1 +%patch -P 3 -p1 +%patch -P 4 -p1 +%patch -P 5 -p1 +%patch -P 6 -p1 +%patch -P 7 -p1 +%patch -P 8 -p1 +%patch -P 9 +%patch -P 10 -p1 +%patch -P 12 -p1 +%patch -P 14 +%patch -P 15 -p1 +%patch -P 16 +%patch -P 17 -p1 +%patch -P 18 -p1 +%patch -P 20 +%patch -P 21 +%patch -P 22 +%patch -P 23 ## find . -type f -name \*.cat\* -exec rm -f {} \; dos2unix contrib/ms2isc/* @@ -268,6 +279,7 @@ export CFLAGS LDFLAGS FFLAGS CXXFLAGS # SLE-12 compatbility still needed as of October 2021 %define make_build %{__make} %{?_smp_mflags} %endif +%make_build -j1 -C keama %make_build -j1 -C bind all cat bind/configure.log cat bind/build.log @@ -285,8 +297,10 @@ cat bind/install.log # check syntax in our scripts bash -n $RPM_SOURCE_DIR/dhcpd.script bash -n $RPM_SOURCE_DIR/dhcrelay.script +bash -n $RPM_SOURCE_DIR/dhclient-script %install +%make_install -C keama %make_install # # directories @@ -309,13 +323,12 @@ mv -f %{buildroot}%{_sbindir}/dhclient %{buildroot}/sbin/ ln -sf dhcpd %{buildroot}%{_sbindir}/dhcpd6 ln -sf dhcrelay %{buildroot}%{_sbindir}/dhcrelay6 ln -sf dhclient %{buildroot}%{sbindir}/dhclient6 -# install our adopted config examples: +# install our adopted config examples and dhclient-script: install -m0644 $RPM_SOURCE_DIR/dhcpd.conf %{buildroot}%{_sysconfdir}/ install -m0644 $RPM_SOURCE_DIR/dhcpd6.conf %{buildroot}%{_sysconfdir}/ install -m0644 $RPM_SOURCE_DIR/dhclient.conf %{buildroot}%{_sysconfdir}/ install -m0644 $RPM_SOURCE_DIR/dhclient6.conf %{buildroot}%{_sysconfdir}/ -# We don't ship dhclient-script any more (boo#1216822) -rm -f %{buildroot}%{_mandir}/man8/dhclient-script.8 +install -m0754 $RPM_SOURCE_DIR/dhclient-script %{buildroot}%{sbindir}/ # helper / wrapper scripts install -d -m0755 %{buildroot}%{_libexecdir}/dhcp install -m0755 $RPM_SOURCE_DIR/dhcpd.script \ @@ -334,31 +347,6 @@ install -m0644 $RPM_SOURCE_DIR/dhcrelay.service \ install -m0644 $RPM_SOURCE_DIR/dhcrelay6.service \ %{buildroot}%{_unitdir}/dhcrelay6.service sed -e 's,@LIBEXECDIR@,%{_libexecdir},g' -i %{buildroot}%{_unitdir}/d* -# rcservice links -ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rcdhcpd -ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rcdhcpd6 -ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rcdhcrelay -ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rcdhcrelay6 -# rcservice actions -legacy_actionsdir=%{buildroot}%{_libexecdir}/initscripts/legacy-actions -cat >dhcpd.action <<'EOF' -#!/bin/bash -exec %{_libexecdir}/dhcp/dhcpd -4 ${0##*/} -EOF -install -d -m0755 ${legacy_actionsdir}/dhcpd -install -m0755 dhcpd.action ${legacy_actionsdir}/dhcpd/syntax-check -ln -sf syntax-check ${legacy_actionsdir}/dhcpd/check-syntax -ln -sf syntax-check ${legacy_actionsdir}/dhcpd/check-lease -rm -f dhcpd.action -cat >dhcpd.action <<'EOF' -#!/bin/bash -exec %{_libexecdir}/dhcp/dhcpd -6 ${0##*/} -EOF -install -d -m0755 ${legacy_actionsdir}/dhcpd6 -install -m0755 dhcpd.action ${legacy_actionsdir}/dhcpd6/syntax-check -ln -sf syntax-check ${legacy_actionsdir}/dhcpd6/check-syntax -ln -sf syntax-check ${legacy_actionsdir}/dhcpd6/check-lease -rm -f dhcpd.action # sysconfig files install -m0644 $RPM_SOURCE_DIR/sysconfig.dhcpd \ %{buildroot}%{_fillupdir}/ @@ -484,17 +472,11 @@ fi %files server %{_sbindir}/dhcpd %{_sbindir}/dhcpd6 -%{_sbindir}/rcdhcpd -%{_sbindir}/rcdhcpd6 %{_unitdir}/dhcpd.service %{_unitdir}/dhcpd6.service %if %{with sysusers} %{_sysusersdir}/dhcp-user.conf %endif -%dir %{_libexecdir}/initscripts/legacy-actions/dhcpd -%{_libexecdir}/initscripts/legacy-actions/dhcpd/* -%dir %{_libexecdir}/initscripts/legacy-actions/dhcpd6 -%{_libexecdir}/initscripts/legacy-actions/dhcpd6/* %config(noreplace) %{_sysconfdir}/dhcpd.conf %config(noreplace) %{_sysconfdir}/dhcpd6.conf %attr(755,root,root) %dir %config(noreplace) %ghost %{_sysconfdir}/dhcpd.d/ @@ -537,19 +519,19 @@ fi %files client %{sbindir}/dhclient %{sbindir}/dhclient6 +%{sbindir}/dhclient-script %config(noreplace) %{_sysconfdir}/dhclient.conf %config(noreplace) %{_sysconfdir}/dhclient6.conf %{_mandir}/man5/dhclient.conf.5%{?ext_man} %{_mandir}/man5/dhclient.leases.5%{?ext_man} %{_mandir}/man8/dhclient.8%{?ext_man} +%{_mandir}/man8/dhclient-script.8%{?ext_man} %dir %{_localstatedir}/lib/dhcp %dir %{_localstatedir}/lib/dhcp6 %files relay %{_sbindir}/dhcrelay %{_sbindir}/dhcrelay6 -%{_sbindir}/rcdhcrelay -%{_sbindir}/rcdhcrelay6 %dir %{_libexecdir}/dhcp %{_libexecdir}/dhcp/dhcrelay %{_unitdir}/dhcrelay.service @@ -565,4 +547,8 @@ fi %{_mandir}/man3/omapi.3%{?ext_man} %{_mandir}/man3/dhcpctl.3%{?ext_man} +%files keama +%{_sbindir}/keama +%{_mandir}/man8/keama.8%{?ext_man} + %changelog