|
@@ -32,27 +32,30 @@
|
32
|
32
|
*
|
33
|
33
|
*/
|
34
|
34
|
|
35
|
|
-static struct dhcp_option_block *dhcp_options = NULL;
|
36
|
|
-
|
37
|
35
|
static int dhcp_success ( struct net_device *netdev,
|
38
|
36
|
struct dhcp_option_block *options ) {
|
39
|
|
- dhcp_options = dhcpopt_get ( options );
|
|
37
|
+ DBGC ( options, "DHCP client registering options %p\n", options );
|
40
|
38
|
register_dhcp_options ( options );
|
41
|
39
|
return dhcp_configure_netdev ( netdev, options );
|
42
|
40
|
}
|
43
|
41
|
|
44
|
42
|
int dhcp ( struct net_device *netdev ) {
|
|
43
|
+ struct dhcp_option_block *options;
|
|
44
|
+ struct dhcp_option_block *tmp;
|
45
|
45
|
int rc;
|
46
|
46
|
|
47
|
47
|
/* Check we can open the interface first */
|
48
|
48
|
if ( ( rc = ifopen ( netdev ) ) != 0 )
|
49
|
49
|
return rc;
|
50
|
50
|
|
51
|
|
- /* Unregister any previously acquired options */
|
52
|
|
- if ( dhcp_options ) {
|
53
|
|
- unregister_dhcp_options ( dhcp_options );
|
54
|
|
- dhcpopt_put ( dhcp_options );
|
55
|
|
- dhcp_options = NULL;
|
|
51
|
+ /* Unregister any option blocks acquired via DHCP */
|
|
52
|
+ list_for_each_entry_safe ( options, tmp, &dhcp_option_blocks, list ) {
|
|
53
|
+ /* Skip static option blocks (e.g. from NVS) */
|
|
54
|
+ if ( find_dhcp_option ( options, DHCP_MESSAGE_TYPE ) ) {
|
|
55
|
+ DBGC ( options, "DHCP client unregistering options "
|
|
56
|
+ "%p\n", options );
|
|
57
|
+ unregister_dhcp_options ( options );
|
|
58
|
+ }
|
56
|
59
|
}
|
57
|
60
|
|
58
|
61
|
/* Perform DHCP */
|