submit patch for udhcpc - addition of Option 43
Krebs, Steven
steven.krebs at intel.com
Mon Mar 22 14:47:14 UTC 2010
On Sunday 21 March 2010 17:01, Denys Vlasenko wrote:
> You are using a config file specifically for option 43?
> What will happen when users will eventually want other options?
> 256 config files?
I don't think there are 255 options left to implement, quite a few are already implemented (option 1 is the sub mask, option 6 is the list of ip addresses of DNS servers, option 51 is lease time etc...), and very few of those are vendor defined multiple-strings (see reference below). I agree most of these can be handled by simple command line parameters, but I think this vendor_specific option is a little more difficult. That being said, I need to further clarify you idea for how the command line syntax would look:
> Then create a new option for udhcpc, say -x OPT, which allows
> udhcpc to add _any_ supported_ option_ (not only yours)
> to the emitted packet.
So for my OCAP use case would you expect the command line to look something like (example 1):
udhcpc -i eth1 -s etc/udhcpc.script -V "OpenCable2.1" -x "OPT 43 SUB 2 ESTB SUB 3 ECM:ESTB SUB 4 $SERIAL_NO SUB 5 HW_VER1.0.0 SUB 6 FW_VER1.0.0 SUB 7 Boot_ROM25.008 SUB 8 001320 SUB 9 MODEL_NO_3100 SUB 10 'VENDOR NAME' SUB 54 0A859B428"
OR would it look like this (example 2):
udhcpc -i eth1 -s etc/udhcpc.script -V "OpenCable2.1" -x "OPT43SUB2 ESTB OPT43SUB3 ECM:ESTB OPT43SUB4 $SERIAL_NO OPT43SUB5 HW_VER1.0.0 OPT43SUB6 FW_VER1.0.0 OPT43SUB7 Boot_ROM25.008 OPT43SUB8 001320 OPT43SUB9 MODEL_NO_3100 OPT43SUB10 'VENDOR NAME' OPT43SUB54 0A859B428"
OR this (example 3):
udhcpc -i eth1 -s etc/udhcpc.script -V "OpenCable2.1" -x "OPT43 2 'ESTB' OPT43 3 'ECM:ESTB' OPT43 4 $SERIAL_NO OPT43 5 'HW_VER1.0.0' OPT43 6 'FW_VER1.0.0' OPT43 7 'Boot_ROM25.008' OPT43 8 '001320' OPT43 9 'MODEL_NO_3100' OPT43 10 'VENDOR NAME' OPT43 54 '0A859B428'"
And you think read_opt() will handle the above syntax (specifically one of the first three examples). Then once the code reads the options and understands how many, I will dynamically allocate an array of options, with a dynamic array of sub strings and values, then based on a new type OPTION_VENDOR_SPECIFIC finally concat the final option 43 string (of 256 or less bytes).
OR are you expecting the user to specify the binary values for the sub-option and length bytes (example using octal escape sequences - which will make it hard to use environment variables - example 4):
udhcpc -i eth1 -s etc/udhcpc.script -V "OpenCable2.1" -x OPT43 "\002\004ESTB\003\008ECM:ESTB\004\014$SERIAL_NO\005\013HW_VER1.0.0\006\013FW_VER1.0.0\007\016Boot_ROM25.008\008\006001320\010\015MODEL_NO_3100\011\013VENDOR NAME\066\0100A859B428"
One thing I need help with, I used statically allocated arrays in my previous prototype because I was not clear as to where/when to de-allocate, can you help me with that?
Thanks,
Steve
For Reference: DHCP options:
Data
Tag Name Length Meaning Reference
-------- ------------------------------- ------ ------------------------------------------------ ---------
0 Pad 0 None [RFC2132]
1 Subnet Mask 4 Subnet Mask Value [RFC2132]
2 Time Offset 4 Time Offset in Seconds from UTC [RFC2132]
(note: deprecated by 100 and 101)
3 Router N N/4 Router addresses [RFC2132]
4 Time Server N N/4 Timeserver addresses [RFC2132]
5 Name Server N N/4 IEN-116 Server addresses [RFC2132]
6 Domain Server N N/4 DNS Server addresses [RFC2132]
7 Log Server N N/4 Logging Server addresses [RFC2132]
8 Quotes Server N N/4 Quotes Server addresses [RFC2132]
9 LPR Server N N/4 Printer Server addresses [RFC2132]
10 Impress Server N N/4 Impress Server addresses [RFC2132]
11 RLP Server N N/4 RLP Server addresses [RFC2132]
12 Hostname N Hostname string [RFC2132]
13 Boot File Size 2 Size of boot file in 512 byte chunks [RFC2132]
14 Merit Dump File N Client to dump and name the file to dump it to [RFC2132]
15 Domain Name N The DNS domain name of the client [RFC2132]
16 Swap Server N Swap Server address [RFC2132]
17 Root Path N Path name for root disk [RFC2132]
18 Extension File N Path name for more BOOTP info [RFC2132]
19 Forward On/Off 1 Enable/Disable IP Forwarding [RFC2132]
20 SrcRte On/Off 1 Enable/Disable Source Routing [RFC2132]
21 Policy Filter N Routing Policy Filters [RFC2132]
22 Max DG Assembly 2 Max Datagram Reassembly Size [RFC2132]
23 Default IP TTL 1 Default IP Time to Live [RFC2132]
24 MTU Timeout 4 Path MTU Aging Timeout [RFC2132]
25 MTU Plateau N Path MTU Plateau Table [RFC2132]
26 MTU Interface 2 Interface MTU Size [RFC2132]
27 MTU Subnet 1 All Subnets are Local [RFC2132]
28 Broadcast Address 4 Broadcast Address [RFC2132]
29 Mask Discovery 1 Perform Mask Discovery [RFC2132]
30 Mask Supplier 1 Provide Mask to Others [RFC2132]
31 Router Discovery 1 Perform Router Discovery [RFC2132]
32 Router Request 4 Router Solicitation Address [RFC2132]
33 Static Route N Static Routing Table [RFC2132]
34 Trailers 1 Trailer Encapsulation [RFC2132]
35 ARP Timeout 4 ARP Cache Timeout [RFC2132]
36 Ethernet 1 Ethernet Encapsulation [RFC2132]
37 Default TCP TTL 1 Default TCP Time to Live [RFC2132]
38 Keepalive Time 4 TCP Keepalive Interval [RFC2132]
39 Keepalive Data 1 TCP Keepalive Garbage [RFC2132]
40 NIS Domain N NIS Domain Name [RFC2132]
41 NIS Servers N NIS Server Addresses [RFC2132]
42 NTP Servers N NTP Server Addresses [RFC2132]
43 Vendor Specific N Vendor Specific Information [RFC2132]
44 NETBIOS Name Srv N NETBIOS Name Servers [RFC2132]
45 NETBIOS Dist Srv N NETBIOS Datagram Distribution [RFC2132]
46 NETBIOS Node Type 1 NETBIOS Node Type [RFC2132]
47 NETBIOS Scope N NETBIOS Scope [RFC2132]
48 X Window Font N X Window Font Server [RFC2132]
49 X Window Manager N X Window Display Manager [RFC2132]
50 Address Request 4 Requested IP Address [RFC2132]
51 Address Time 4 IP Address Lease Time [RFC2132]
52 Overload 1 Overload "sname" or "file" [RFC2132]
53 DHCP Msg Type 1 DHCP Message Type [RFC2132]
54 DHCP Server Id 4 DHCP Server Identification [RFC2132]
55 Parameter List N Parameter Request List [RFC2132]
56 DHCP Message N DHCP Error Message [RFC2132]
57 DHCP Max Msg Size 2 DHCP Maximum Message Size [RFC2132]
58 Renewal Time 4 DHCP Renewal (T1) Time [RFC2132]
59 Rebinding Time 4 DHCP Rebinding (T2) Time [RFC2132]
60 Class Id N Class Identifier [RFC2132]
61 Client Id N Client Identifier [RFC2132]
62 NetWare/IP Domain N NetWare/IP Domain Name [RFC2242]
63 NetWare/IP Option N NetWare/IP sub Options [RFC2242]
64 NIS-Domain-Name N NIS+ v3 Client Domain Name [RFC2132]
65 NIS-Server-Addr N NIS+ v3 Server Addresses [RFC2132]
66 Server-Name N TFTP Server Name [RFC2132]
67 Bootfile-Name N Boot File Name [RFC2132]
68 Home-Agent-Addrs N Home Agent Addresses [RFC2132]
69 SMTP-Server N Simple Mail Server Addresses [RFC2132]
70 POP3-Server N Post Office Server Addresses [RFC2132]
71 NNTP-Server N Network News Server Addresses [RFC2132]
72 WWW-Server N WWW Server Addresses [RFC2132]
73 Finger-Server N Finger Server Addresses [RFC2132]
74 IRC-Server N Chat Server Addresses [RFC2132]
75 StreetTalk-Server N StreetTalk Server Addresses [RFC2132]
76 STDA-Server N ST Directory Assist. Addresses [RFC2132]
77 User-Class N User Class Information [RFC3004]
78 Directory Agent N directory agent information [RFC2610]
79 Service Scope N service location agent scope [RFC2610]
80 Rapid Commit 0 Rapid Commit [RFC4039]
81 Client FQDN N Fully Qualified Domain Name [RFC4702]
82 Relay Agent Information N Relay Agent Information [RFC3046]
83 iSNS N Internet Storage Name Service [RFC4174]
84 REMOVED/Unassigned [RFC3679]
85 NDS Servers N Novell Directory Services [RFC2241]
86 NDS Tree Name N Novell Directory Services [RFC2241]
87 NDS Context N Novell Directory Services [RFC2241]
88 BCMCS Controller Domain Name list [RFC4280]
89 BCMCS Controller IPv4 address option [RFC4280]
90 Authentication N Authentication [RFC3118]
91 client-last-transaction-time option [RFC4388]
92 associated-ip option [RFC4388]
93 Client System N Client System Architecture [RFC4578]
94 Client NDI N Client Network Device Interface [RFC4578]
95 LDAP N Lightweight Directory Access Protocol [RFC3679]
96 REMOVED/Unassigned [RFC3679]
97 UUID/GUID N UUID/GUID-based Client Identifier [RFC4578]
98 User-Auth N Open Group's User Authentication [RFC2485]
99 GEOCONF_CIVIC [RFC4776]
100 PCode N IEEE 1003.1 TZ String [RFC4833]
101 TCode N Reference to the TZ Database [RFC4833]
102-107 REMOVED/Unassigned [RFC3679]
108 REMOVED/Unassigned [RFC3679]
109 Unassigned [RFC3679]
110 REMOVED/Unassigned [RFC3679]
111 Unassigned [RFC3679]
112 Netinfo Address N NetInfo Parent Server Address [RFC3679]
113 Netinfo Tag N NetInfo Parent Server Tag [RFC3679]
114 URL N URL [RFC3679]
115 REMOVED/Unassigned [RFC3679]
116 Auto-Config N DHCP Auto-Configuration [RFC2563]
117 Name Service Search N Name Service Search [RFC2937]
118 Subnet Selection Option 4 Subnet Selection Option [RFC3011]
119 Domain Search N DNS domain search list [RFC3397]
120 SIP Servers DHCP Option N SIP Servers DHCP Option [RFC3361]
121 Classless Static Route Option N Classless Static Route Option [RFC3442]
122 CCC N CableLabs Client Configuration [RFC3495]
123 GeoConf Option 16 GeoConf Option [RFC3825]
124 V-I Vendor Class Vendor-Identifying Vendor Class [RFC3925]
125 V-I Vendor-Specific Information Vendor-Identifying Vendor-Specific Information [RFC3925]
126 Removed/Unassigned [RFC3679]
127 Removed/Unassigned [RFC3679]
128 PXE - undefined (vendor specific) [RFC4578]
128 Etherboot signature. 6 bytes: E4:45:74:68:00:00
128 DOCSIS "full security" server IP address
128 TFTP Server IP address (for IP Phone software load)
129 PXE - undefined (vendor specific) [RFC4578]
129 Kernel options. Variable length string
129 Call Server IP address
130 PXE - undefined (vendor specific) [RFC4578]
130 Ethernet interface. Variable length string.
130 Discrimination string (to identify vendor)
131 PXE - undefined (vendor specific) [RFC4578]
131 Remote statistics server IP address
132 PXE - undefined (vendor specific) [RFC4578]
132 IEEE 802.1Q VLAN ID
133 PXE - undefined (vendor specific) [RFC4578]
133 IEEE 802.1D/p Layer 2 Priority
134 PXE - undefined (vendor specific) [RFC4578]
134 Diffserv Code Point (DSCP) for VoIP signalling and media streams
135 PXE - undefined (vendor specific) [RFC4578]
135 HTTP Proxy for phone-specific applications
136 OPTION_PANA_AGENT [RFC5192]
137 OPTION_V4_LOST [RFC5223]
138 OPTION_CAPWAP_AC_V4 N CAPWAP Access Controller addresses [RFC5417]
139 OPTION-IPv4_Address-MoS N a series of suboptions [RFC5678]
140 OPTION-IPv4_FQDN-MoS N a series of suboptions [RFC5678]
141-149 Unassigned [RFC3942]
150 TFTP server address [RFC-raj-dhc-tftp-addr-option-06.txt]
150 Etherboot
150 GRUB configuration path name
151-174 Unassigned [RFC3942]
175 Etherboot (Tentatively Assigned - 2005-06-23)
176 IP Telephone (Tentatively Assigned - 2005-06-23)
177 Etherboot (Tentatively Assigned - 2005-06-23)
177 PacketCable and CableHome (replaced by 122)
178-207 Unassigned [RFC3942]
208 PXELINUX Magic 4 magic string = F1:00:74:7E [RFC5071] Deprecated
209 Configuration File N Configuration file [RFC5071]
210 Path Prefix N Path Prefix Option [RFC5071]
211 Reboot Time 4 Reboot Time [RFC5071]
212-219 Unassigned
220 Subnet Allocation Option (Tentatively Assigned - 2005-06-23)
221 Virtual Subnet Selection Option (Tentatively Assigned - 2005-06-23)
222-223 Unassigned [RFC3942]
224-254 Reserved (Private Use)
255 End 0 None [RFC2132]
-----Original Message-----
From: Denys Vlasenko [mailto:vda.linux at googlemail.com]
Sent: Sunday, March 21, 2010 9:01 PM
To: Krebs, Steven
Cc: busybox at busybox.net
Subject: Re: submit patch for udhcpc - addition of Option 43
On Sunday 21 March 2010 13:53, Denys Vlasenko wrote:
> On Wednesday 17 March 2010 18:40, Krebs, Steven wrote:
> > Hi, you seem to be the main developer for the udhcpc functionality.
> > Have you had a chance to take a look at this patch yet?
>
> Thanks for pinging me, I somehow missed it.
>
> > All,
> >
> > Sorry if this is a little rough, this is my first submission for busybox.
> >
> > On some networks (in my case for a cable modem) the dhcp server requires
> > dhcp option 60 and option 43. dhcp option 60 is already supported
> > with the -V command line option in udhcpc. It looks to me like
> > option 43 is not supported. I have implemented a prototype for option 43.
Aha, understand what you want to achieve.
You want udhcpc to have more options in its DISCOVER and/or REQUEST
packets.
> > dhcp option 43 is known as the vendor specific option. I have chosen
> > the command line option -x (as -v was already taken).
> > I have made -x an optional argument with an optional value.
> > By default when -x is used, udhcpc will read the file
> > /etc/udhcpc.vendor_specific and parse the suboptions within
> > to create option 43. One may also optionally specify a path
> > and filename after -x. In my version of busybox (older) getopts32
> > does not allow a space after the -x when the value is optional.
> > So one could specific a different path for the file as so:
> >
> > udhcpc -x/tmp/udhcpc.vendor_specific
> >
> > Dhcp option 43 is a concatenation of substrings.
> > For my purposes I needed to implement it for (OpenCable)
> > OC-SP-HOST2.1-CFR-I10-091211 which requires suboptions
> > 2,3,4,5,6,7,8,9,10 and 54.
> > http://www.cablelabs.com/specifications/OC-SP-HOST2.1-CFR-I10-091211.pdf
> > So that is what is currently supported, but I tried to make
> > the implementation generic and it can be expanded fairly easily.
> >
> > The udhcpc.vendor_specific config file is KEY value string pairs
> > separated by whitespace. Example:
> >
> > SUBOPTION2 ESTB
> > SUBOPTION3 ECM:ESTB
You are using a config file specifically for option 43?
What will happen when users will eventually want other options?
256 config files?
I think at the very least the config file should be generic enough
to be extensible to more options. Or maybe we can avoid having
a file just yet - so far udhcpc was managing with command line options.
udhcp already has machinery for converting binary option representation
into string - it is used when udhcpc needs to export server's options
into environment variables
And it has machinery for converting strings into options -
this code is responsible for implementing "opt OPTION VALUE"
directive in udhcpd.conf file.
You need to extend this code - teach it to handle a new type
of option (since option 43 is neither a string nor an IP address),
and then hook this code up to a new udhcpc option.
To this end, add new #define DHCP_VENDOR_INFO to options.h,
and add the new _type_ of option, OPTION_VENDOR_INFO, in the same file.
Add it to dhcp_options[], dhcp_option_strings[], dhcp_option_lengths[].
Then teach read_opt() function to how to convert a string
into a binary representation of OPTION_VENDOR_INFO option,
and teach xmalloc_optname_optval() to do the opposite conversion.
Then create a new option for udhcpc, say -x OPT, which allows
udhcpc to add _any_ supported_ option_ (not only yours)
to the emitted packet.
This should be not so hard - use read_opt().
--
vda
More information about the busybox
mailing list