mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-06-12 07:02:05 +08:00
Revert "Add DHCP clients comments info (#2884)"
This reverts commit bb18798d22522711492a51288aee7f6c2e43738e.
This commit is contained in:
parent
bb18798d22
commit
8c696f1e9b
@ -19,7 +19,7 @@ BASEDHCPSTAMPFILE="/var/run/dnsmasq"
|
|||||||
DHCPBOGUSHOSTNAMEFILE="/usr/share/dnsmasq/dhcpbogushostname.conf"
|
DHCPBOGUSHOSTNAMEFILE="/usr/share/dnsmasq/dhcpbogushostname.conf"
|
||||||
RFC6761FILE="/usr/share/dnsmasq/rfc6761.conf"
|
RFC6761FILE="/usr/share/dnsmasq/rfc6761.conf"
|
||||||
DHCPSCRIPT="/usr/lib/dnsmasq/dhcp-script.sh"
|
DHCPSCRIPT="/usr/lib/dnsmasq/dhcp-script.sh"
|
||||||
CONFIGFILE_COMMENTS="/tmp/dhcp_comments.conf"
|
|
||||||
DNSMASQ_DHCP_VER=4
|
DNSMASQ_DHCP_VER=4
|
||||||
|
|
||||||
xappend() {
|
xappend() {
|
||||||
@ -28,12 +28,6 @@ xappend() {
|
|||||||
echo "${value#--}" >> $CONFIGFILE_TMP
|
echo "${value#--}" >> $CONFIGFILE_TMP
|
||||||
}
|
}
|
||||||
|
|
||||||
cappend() {
|
|
||||||
local value="$1"
|
|
||||||
|
|
||||||
echo "${value#--}" >> $CONFIGFILE_COMMENTS
|
|
||||||
}
|
|
||||||
|
|
||||||
hex_to_hostid() {
|
hex_to_hostid() {
|
||||||
local var="$1"
|
local var="$1"
|
||||||
local hex="${2#0x}" # strip optional "0x" prefix
|
local hex="${2#0x}" # strip optional "0x" prefix
|
||||||
@ -283,8 +277,7 @@ dhcp_match_add() {
|
|||||||
|
|
||||||
dhcp_host_add() {
|
dhcp_host_add() {
|
||||||
local cfg="$1"
|
local cfg="$1"
|
||||||
local hosttag nametime addrs duids macs tags
|
local hosttag nametime addrs duids macs tags
|
||||||
local comment_mac comment_ip
|
|
||||||
|
|
||||||
config_get_bool force "$cfg" force 0
|
config_get_bool force "$cfg" force 0
|
||||||
|
|
||||||
@ -295,17 +288,10 @@ dhcp_host_add() {
|
|||||||
[ "$enable" = "0" ] && return 0
|
[ "$enable" = "0" ] && return 0
|
||||||
|
|
||||||
config_get name "$cfg" name
|
config_get name "$cfg" name
|
||||||
config_get comments "$cfg" comments
|
|
||||||
config_get ip "$cfg" ip
|
config_get ip "$cfg" ip
|
||||||
config_get hostid "$cfg" hostid
|
config_get hostid "$cfg" hostid
|
||||||
|
|
||||||
if [ -z "$ip" -a -z "$name" -a -z "$hostid" ]; then
|
[ -n "$ip" -o -n "$name" -o -n "$hostid" ] || return 0
|
||||||
[ -n "$comments" ] || return 0
|
|
||||||
config_get mac "$cfg" mac
|
|
||||||
[ -n "$ip" ] || ip="-"
|
|
||||||
cappend "$comments $mac $ip"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
config_get_bool dns "$cfg" dns 0
|
config_get_bool dns "$cfg" dns 0
|
||||||
[ "$dns" = "1" -a -n "$ip" -a -n "$name" ] && {
|
[ "$dns" = "1" -a -n "$ip" -a -n "$name" ] && {
|
||||||
@ -321,7 +307,6 @@ dhcp_host_add() {
|
|||||||
# many MAC are possible to track a laptop ON/OFF dock
|
# many MAC are possible to track a laptop ON/OFF dock
|
||||||
for m in $mac; do append macs "$m" ","; done
|
for m in $mac; do append macs "$m" ","; done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ $DNSMASQ_DHCP_VER -eq 6 -a -n "$duid" ]; then
|
if [ $DNSMASQ_DHCP_VER -eq 6 -a -n "$duid" ]; then
|
||||||
# --dhcp-host=id:00:03:00:01:12:00:00:01:02:03,[::beef],lap
|
# --dhcp-host=id:00:03:00:01:12:00:00:01:02:03,[::beef],lap
|
||||||
@ -351,27 +336,12 @@ dhcp_host_add() {
|
|||||||
|
|
||||||
hosttag="${networkid:+,set:${networkid}}${tags:+,set:${tags}}$broadcast"
|
hosttag="${networkid:+,set:${networkid}}${tags:+,set:${tags}}$broadcast"
|
||||||
nametime="${name:+,$name}${leasetime:+,$leasetime}"
|
nametime="${name:+,$name}${leasetime:+,$leasetime}"
|
||||||
|
|
||||||
[ -n "$comments" ] || comments="-"
|
|
||||||
|
|
||||||
if [ -n "$macs" ]; then
|
|
||||||
comment_mac=$mac
|
|
||||||
else
|
|
||||||
comment_mac="-"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$ip" ]; then
|
|
||||||
comment_ip=${ip:+$ip}
|
|
||||||
else
|
|
||||||
comment_ip="-"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $DNSMASQ_DHCP_VER -eq 6 ]; then
|
if [ $DNSMASQ_DHCP_VER -eq 6 ]; then
|
||||||
addrs="${ip:+,$ip}${hostid:+,[::$hostid]}"
|
addrs="${ip:+,$ip}${hostid:+,[::$hostid]}"
|
||||||
xappend "--dhcp-host=$macs${duids:+,$duids}$hosttag$addrs$nametime"
|
xappend "--dhcp-host=$macs${duids:+,$duids}$hosttag$addrs$nametime"
|
||||||
else
|
else
|
||||||
xappend "--dhcp-host=$macs$hosttag${ip:+,$ip}$nametime"
|
xappend "--dhcp-host=$macs$hosttag${ip:+,$ip}$nametime"
|
||||||
cappend "$comments $comment_mac $comment_ip"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -783,7 +753,6 @@ dnsmasq_start()
|
|||||||
chown dnsmasq:dnsmasq /var/run/dnsmasq
|
chown dnsmasq:dnsmasq /var/run/dnsmasq
|
||||||
|
|
||||||
echo "# auto-generated config file from /etc/config/dhcp" > $CONFIGFILE_TMP
|
echo "# auto-generated config file from /etc/config/dhcp" > $CONFIGFILE_TMP
|
||||||
rm $CONFIGFILE_COMMENTS
|
|
||||||
echo "# auto-generated config file from /etc/config/dhcp" > $HOSTFILE_TMP
|
echo "# auto-generated config file from /etc/config/dhcp" > $HOSTFILE_TMP
|
||||||
|
|
||||||
local dnsmasqconffile="/etc/dnsmasq.${cfg}.conf"
|
local dnsmasqconffile="/etc/dnsmasq.${cfg}.conf"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user