--- networking/udhcp/dhcpc.c.orig	2007-04-05 03:00:19.394909196 +0900
+++ networking/udhcp/dhcpc.c	2007-04-05 02:57:44.261600956 +0900
@@ -125,7 +125,7 @@
 int udhcpc_main(int argc, char *argv[])
 {
 	uint8_t *temp, *message;
-	char *str_c, *str_V, *str_h, *str_F, *str_r, *str_T, *str_t;
+	char *str_c, *str_V, *str_h, *str_F, *str_r, *str_T, *str_t, *str_L;
 	unsigned long t1 = 0, t2 = 0, xid = 0;
 	unsigned long start = 0, lease = 0;
 	long now;
@@ -159,6 +159,7 @@
 		OPT_T = 1 << 15,
 		OPT_t = 1 << 16,
 		OPT_v = 1 << 17,
+		OPT_L = 1 << 18,
 	};
 #if ENABLE_GETOPT_LONG
 	static const struct option arg_options[] = {
@@ -180,6 +181,7 @@
 		{ "timeout",    required_argument,      0, 'T' },
 		{ "version",    no_argument,            0, 'v' },
 		{ "retries",    required_argument,      0, 't' },
+		{ "selectbylease", required_argument,   0, 'L' },
 		{ 0, 0, 0, 0 }
 	};
 #endif
@@ -188,6 +190,7 @@
 	client_config.script = DEFAULT_SCRIPT;
 	client_config.retries = 3;
 	client_config.timeout = 3;
+	client_config.selectbylease = 0;
 
 	/* Parse command line */
 	opt_complementary = "?:c--C:C--c" // mutually exclusive
@@ -195,10 +198,10 @@
 #if ENABLE_GETOPT_LONG
 	applet_long_options = arg_options;
 #endif
-	opt = getopt32(argc, argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:v",
+	opt = getopt32(argc, argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:vL:",
 		&str_c, &str_V, &str_h, &str_h, &str_F,
 		&client_config.interface, &client_config.pidfile, &str_r,
-		&client_config.script, &str_T, &str_t
+		&client_config.script, &str_T, &str_t, &str_L
 		);
 
 	if (opt & OPT_c)
@@ -240,6 +243,8 @@
 		client_config.timeout = xatoi_u(str_T);
 	if (opt & OPT_t)
 		client_config.retries = xatoi_u(str_t);
+	if (opt & OPT_L)
+		client_config.selectbylease = xatoi_u(str_L);
 	if (opt & OPT_v) {
 		printf("version %s\n\n", BB_VER);
 		return 0;
@@ -440,6 +445,11 @@
 						/* can be misaligned, thus memcpy */
 						memcpy(&lease, temp, 4);
 						lease = ntohl(lease);
+						if (client_config.selectbylease && lease != client_config.selectbylease) {
+							bb_info_msg("Lease time is not %ld but %ld, ignoring", client_config.selectbylease, lease);
+							state = INIT_SELECTING;
+							break;
+						}
 					}
 
 					/* enter bound state */
