dnsmasq: add support for multiple tags for each host.
Currently, dnsmasq support assigning multiple tags to a host record
(--dhcp-host), but we only support only 1 tag for a host. The commit
makes the following config to be valid:
  config host
      option name 'computer'
      option mac '00:11:22:33:44:55'
      option ip '192.168.1.100'
      list tag 'vendor_class'
      list tag 'vendor_id'
  config tag 'vendor_class'
      list dhcp_option 'option:vendor-class,00:...<omitted>'
  config tag 'vendor_id'
      option force '1'
      list dhcp_option 'option:vendor-id-encap,00:...<omitted>'
Signed-off-by: Kuang Rufan <kuangrufan@pset.suntec.net>
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
			
			
This commit is contained in:
		 Kuang Rufan
					Kuang Rufan
				
			
				
					committed by
					
						 Hans Dedecker
						Hans Dedecker
					
				
			
			
				
	
			
			
			 Hans Dedecker
						Hans Dedecker
					
				
			
						parent
						
							cdb494fdc2
						
					
				
				
					commit
					1e6e37c4f6
				
			| @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk | |||||||
|  |  | ||||||
| PKG_NAME:=dnsmasq | PKG_NAME:=dnsmasq | ||||||
| PKG_VERSION:=2.77 | PKG_VERSION:=2.77 | ||||||
| PKG_RELEASE:=8 | PKG_RELEASE:=9 | ||||||
|  |  | ||||||
| PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz | ||||||
| PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq/ | PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq/ | ||||||
|   | |||||||
| @@ -322,12 +322,17 @@ dhcp_host_add() { | |||||||
| 			hex_to_hostid hostid "$hostid" | 			hex_to_hostid hostid "$hostid" | ||||||
| 	fi | 	fi | ||||||
|  |  | ||||||
|  | 	tags="" | ||||||
|  | 	if [ -n "$tag" ]; then | ||||||
|  | 		for t in $tag; do append tags "$t" ",set:"; done | ||||||
|  | 	fi | ||||||
|  |  | ||||||
| 	config_get_bool broadcast "$cfg" broadcast 0 | 	config_get_bool broadcast "$cfg" broadcast 0 | ||||||
| 	config_get leasetime "$cfg" leasetime | 	config_get leasetime "$cfg" leasetime | ||||||
|  |  | ||||||
| 	[ "$broadcast" = "0" ] && broadcast= || broadcast=",set:needs-broadcast" | 	[ "$broadcast" = "0" ] && broadcast= || broadcast=",set:needs-broadcast" | ||||||
|  |  | ||||||
| 	hosttag="${networkid:+,set:${networkid}}${tag:+,set:${tag}}$broadcast" | 	hosttag="${networkid:+,set:${networkid}}${tags:+,set:${tags}}$broadcast" | ||||||
| 	nametime="${name:+,$name}${leasetime:+,$leasetime}" | 	nametime="${name:+,$name}${leasetime:+,$leasetime}" | ||||||
|  |  | ||||||
| 	if [ $DNSMASQ_DHCP_VER -eq 6 ]; then | 	if [ $DNSMASQ_DHCP_VER -eq 6 ]; then | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user