diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-26 17:41:00 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-26 17:41:00 +0000 |
commit | e175ff252f9abb7267000571207c9d612728e1b9 (patch) | |
tree | bc6843cbc8ca3d0d2257a9e2349c03358b70b85a /networking/udhcp | |
parent | 22f6dcb47c32909ca0a3d720b11df5ea86b1e76c (diff) | |
download | busybox-e175ff252f9abb7267000571207c9d612728e1b9.tar.gz |
several fixes from openWRT project
Diffstat (limited to 'networking/udhcp')
-rw-r--r-- | networking/udhcp/dhcpc.c | 14 | ||||
-rw-r--r-- | networking/udhcp/dhcpc.h | 1 | ||||
-rw-r--r-- | networking/udhcp/options.c | 3 | ||||
-rw-r--r-- | networking/udhcp/options.h | 2 |
4 files changed, 17 insertions, 3 deletions
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index ff4d5018c..499183f18 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c @@ -53,6 +53,7 @@ struct client_config_t client_config = { .abort_if_no_lease = 0, .foreground = 0, .quit_after_lease = 0, + .release_on_quit = 0, .background_if_no_lease = 0, .interface = "eth0", .pidfile = NULL, @@ -169,6 +170,7 @@ int udhcpc_main(int argc, char *argv[]) {"now", no_argument, 0, 'n'}, {"pidfile", required_argument, 0, 'p'}, {"quit", no_argument, 0, 'q'}, + {"release", no_argument, 0, 'R'}, {"request", required_argument, 0, 'r'}, {"script", required_argument, 0, 's'}, {"timeout", required_argument, 0, 'T'}, @@ -180,7 +182,7 @@ int udhcpc_main(int argc, char *argv[]) /* get options */ while (1) { int option_index = 0; - c = getopt_long(argc, argv, "c:CV:fbH:h:F:i:np:qr:s:T:t:v", arg_options, &option_index); + c = getopt_long(argc, argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:v", arg_options, &option_index); if (c == -1) break; switch (c) { @@ -250,6 +252,9 @@ int udhcpc_main(int argc, char *argv[]) case 'q': client_config.quit_after_lease = 1; break; + case 'R': + client_config.release_on_quit = 1; + break; case 'r': requested_ip = inet_addr(optarg); break; @@ -495,8 +500,11 @@ int udhcpc_main(int argc, char *argv[]) state = BOUND; change_mode(LISTEN_NONE); - if (client_config.quit_after_lease) + if (client_config.quit_after_lease) { + if (client_config.release_on_quit) + perform_release(); return 0; + } if (!client_config.foreground) client_background(); @@ -526,6 +534,8 @@ int udhcpc_main(int argc, char *argv[]) break; case SIGTERM: bb_info_msg("Received SIGTERM"); + if (client_config.release_on_quit) + perform_release(); return 0; } } else if (retval == -1 && errno == EINTR) { diff --git a/networking/udhcp/dhcpc.h b/networking/udhcp/dhcpc.h index 3dff11ab0..6cf59a950 100644 --- a/networking/udhcp/dhcpc.h +++ b/networking/udhcp/dhcpc.h @@ -19,6 +19,7 @@ struct client_config_t { char foreground; /* Do not fork */ char quit_after_lease; /* Quit after obtaining lease */ + char release_on_quit; /* perform release on quit */ char abort_if_no_lease; /* Abort if no lease */ char background_if_no_lease; /* Fork to background if no lease */ char *interface; /* The name of the interface to use */ diff --git a/networking/udhcp/options.c b/networking/udhcp/options.c index 652647229..ded0f7b9b 100644 --- a/networking/udhcp/options.c +++ b/networking/udhcp/options.c @@ -42,8 +42,11 @@ struct dhcp_option dhcp_options[] = { {"dhcptype", OPTION_U8, 0x35}, {"serverid", OPTION_IP, 0x36}, {"message", OPTION_STRING, 0x38}, + {"vendorclass", OPTION_STRING, 0x3C}, + {"clientid", OPTION_STRING, 0x3D}, {"tftp", OPTION_STRING, 0x42}, {"bootfile", OPTION_STRING, 0x43}, + {"userclass", OPTION_STRING, 0x4D}, {"", 0x00, 0x00} }; diff --git a/networking/udhcp/options.h b/networking/udhcp/options.h index b0a649fef..3c1f5b921 100644 --- a/networking/udhcp/options.h +++ b/networking/udhcp/options.h @@ -23,7 +23,7 @@ enum { #define OPTION_LIST 0x20 /* There can be a list of 1 or more of these */ struct dhcp_option { - char name[10]; + char name[12]; char flags; uint8_t code; }; |