[Toybox] Regarding dhcpd with -i option
Hyejin Kim
hj8296 at gmail.com
Thu Jun 11 04:55:01 PDT 2015
Hi Rob.
I have a question about belowing patch.
there is a case that dhcpd just wants to have other interface name.
Is adding i option for dhcpd reasonable?
Common dhcpd gets an interface name from argument, while toybox gets a
config file from argument.
plz have a look.
diff --git a/toys/pending/dhcpd.c b/toys/pending/dhcpd.c
index 9c3389c..46951cd 100644
--- a/toys/pending/dhcpd.c
+++ b/toys/pending/dhcpd.c
@@ -4,15 +4,16 @@
* Copyright 2013 Kyungwan Han <asura321 at gamil.com>
*
* No Standard
-USE_DHCPD(NEWTOY(dhcpd, ">1P#<0>65535=67fS",
TOYFLAG_SBIN|TOYFLAG_ROOTONLY))
+USE_DHCPD(NEWTOY(dhcpd, ">1P#<0>65535=67fi:S",
TOYFLAG_SBIN|TOYFLAG_ROOTONLY))
config DHCPD
bool "dhcpd"
default n
help
- usage: dhcpd [-fS] [-P N] [CONFFILE]
+ usage: dhcpd [-fS] [-i IFACE] [-P N] [CONFFILE]
-f Run in foreground
+ -i Interface to use (default eth0)
-S Log to syslog too
-P N Use port N (default 67)
@@ -79,6 +80,7 @@ config DEBUG_DHCP
#define DHCP_OPT_END 0xff
GLOBALS(
+ char *iface;
long port;
);
@@ -1104,7 +1106,8 @@ void dhcpd_main(void)
write_pid(gconfig.pidfile);
set_maxlease();
read_leasefile();
-
+ if(flag_chk(FLAG_i))
+ gconfig.interface = flag_get(FLAG_i, TT.iface, "eth0");
if (get_interface(gconfig.interface, &gconfig.ifindex,
&gconfig.server_nip,
gconfig.server_mac)<0)
perror_exit("Failed to get interface %s", gconfig.interface);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20150611/01fa2dca/attachment-0002.htm>
More information about the Toybox
mailing list