Modify

Opened 6 years ago

Last modified 2 years ago

#7952 new defect

dhcptoption splitting entries with space (patch proposal included)

Reported by: thomas@… Owned by: developers
Priority: normal Milestone: Chaos Calmer 15.05
Component: base system Version: Backfire 10.03.1 RC2
Keywords: Cc:

Description (last modified by jow)

Using Backupfire 10.03.1.RC3 (could only select RC2 in the webinterface to trac):

When dhcp-options in /etc/config/dhcp contains spaces, e.g.
dhcp-option=151,"/CONNECT:
server\share$ /user:username pw"
dnsmasq fails after /etc/init.d/dnsmasq start (or restart)

I have found, that /etc/init.d/dnsmasq incorrectly splits the option, into -O lan,151,"/CONNECT:
server\share$ -O lan,/user:username -O lan,pw"

I have made a patch, which works for me, but I am unsure, if it has any unwanted siteeffects.

--- dnsmasq.org Thu Aug 19 02:47:13 2010
+++ dnsmasq     Thu Aug 19 02:48:06 2010
@@ -299,9 +299,7 @@
        local networkid="$2"

        config_get dhcp_option "$cfg" dhcp_option
-       for o in $dhcp_option; do
-               append args "-O $networkid","$o"
-       done
+       append args "-O $networkid","$dhcp_option"

 }
 

Attachments (2)

dnsmasq.patch (303 bytes) - added by thomas@… 6 years ago.
The patch proposal
dnsmasq.2.patch (449 bytes) - added by thomas@… 6 years ago.
Now using config_list_foreach

Download all attachments as: .zip

Change History (5)

Changed 6 years ago by thomas@…

The patch proposal

comment:1 Changed 6 years ago by jow

  • Description modified (diff)

That will basically destroy the ability to set multiple options.
Weshould turn "dhcp_option" into a UCI list and use config_list_foreach.

See http://wiki.openwrt.org/doc/devel/config-scripting#reading.lists

Can you attempt to create such a patch?

comment:2 Changed 6 years ago by thomas@…

Thank you for pointing me in the right direction. I have made a patch as you suggested.

--- dnsmasq.org Wed Jul 21 12:49:29 2010
+++ dnsmasq Sun Aug 22 11:17:05 2010
@@ -298,10 +298,13 @@

local cfg="$1"
local networkid="$2"


  • config_get dhcp_option "$cfg" dhcp_option
  • for o in $dhcp_option; do
  • append args "-O $networkid","$o"
  • done

+ config_list_foreach "$cfg" dhcp_option dhcp_option_add_one "$networkid"
+
+}
+
+dhcp_option_add_one() {
+ local networkid="$2"
+ append args "-O $networkid","$1"

}


Changed 6 years ago by thomas@…

Now using config_list_foreach

comment:3 Changed 2 years ago by jow

  • Milestone changed from Backfire 10.03.2 to Chaos Calmer (trunk)

Milestone Backfire 10.03.2 deleted

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.