[PATCH] udhcpd static route support
Dan Fandrich
dan at coneharvesters.com
Fri Dec 16 01:14:22 UTC 2011
On Thu, Dec 15, 2011 at 10:57:19PM +0000, Michael McTernan wrote:
> + case OPTION_STATIC_ROUTES: {
> + char *bits;
> +
> + /* expect a.b.c.d/m format */
> + bits = strchr(val, '/');
> + if(!bits) {
> + retval = 0;
> + } else {
> + *bits = '\0';
> + buffer[0] = strtoul(bits + 1, NULL, 0);
> +
> + retval = udhcp_str2nip(val, buffer + 1);
> + val = strtok(NULL, ", \t/-");
/ and - seems like they would be confusing as separators in this
context (e.g. 1.2.3.4/5.6.7.8/9.8.7.6 would be parsed the same way
as 1.2.3.4/5, 9.8.7.6) but I can also see that it maintains compatibility
with OPTION_IP_PAIR.
> + if (!val || (unsigned char)buffer[0] > 32)
> + retval = 0;
> + }
> +
> + if (retval) {
This block could be moved one line up into the previous else block.
> + length = ((buffer[0] + 7) >> 3) + 5;
> + retval = udhcp_str2nip(val, buffer + (length - 4));
> + opt = buffer;
> + }
> + break;
How about adding an example in examples/udhcp/udhcpd.conf?
>>> Dan
More information about the busybox
mailing list