renew.c (7c478bd9) | renew.c (69bb4bb4) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the |
5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. | 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. |
8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22/* | 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* |
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. | 22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. |
24 * Use is subject to license terms. 25 */ 26 27#pragma ident "%Z%%M% %I% %E% SMI" 28 29#include <sys/types.h> 30#include <time.h> 31#include <unistd.h> --- 167 unchanged lines hidden (view full) --- 199 * we'll just end up in dhcp_expire(), but it sure sucks. 200 */ 201 202 dhcpmsg(MSG_CRIT, "dhcp_rebind: cannot reschedule another " 203 "rebind attempt; lease may expire for %s", ifsp->if_name); 204} 205 206/* | 23 * Use is subject to license terms. 24 */ 25 26#pragma ident "%Z%%M% %I% %E% SMI" 27 28#include <sys/types.h> 29#include <time.h> 30#include <unistd.h> --- 167 unchanged lines hidden (view full) --- 198 * we'll just end up in dhcp_expire(), but it sure sucks. 199 */ 200 201 dhcpmsg(MSG_CRIT, "dhcp_rebind: cannot reschedule another " 202 "rebind attempt; lease may expire for %s", ifsp->if_name); 203} 204 205/* |
207 * dhcp_restart(): callback function to script_start | 206 * dhcp_restart_lease(): callback function to script_start |
208 * 209 * input: struct ifslist *: the interface to be restarted 210 * const char *: unused 211 * output: int: always 1 212 */ 213 214/* ARGSUSED */ 215static int | 207 * 208 * input: struct ifslist *: the interface to be restarted 209 * const char *: unused 210 * output: int: always 1 211 */ 212 213/* ARGSUSED */ 214static int |
216dhcp_restart(struct ifslist *ifsp, const char *msg) | 215dhcp_restart_lease(struct ifslist *ifsp, const char *msg) |
217{ 218 dhcpmsg(MSG_INFO, "lease expired on %s -- restarting DHCP", 219 ifsp->if_name); 220 221 /* 222 * in the case where the lease is less than DHCP_REBIND_MIN 223 * seconds, we will never enter dhcp_renew() and thus the packet 224 * counters will not be reset. in that case, reset them here. --- 62 unchanged lines hidden (view full) --- 287 * to async_start() while we're actually busy with our own 288 * asynchronous transaction. better than not having a lease. 289 */ 290 291 if (async_start(ifsp, DHCP_START, B_FALSE) == 0) 292 dhcpmsg(MSG_WARNING, "dhcp_expire: cannot start asynchronous " 293 "transaction on %s, continuing...", ifsp->if_name); 294 | 216{ 217 dhcpmsg(MSG_INFO, "lease expired on %s -- restarting DHCP", 218 ifsp->if_name); 219 220 /* 221 * in the case where the lease is less than DHCP_REBIND_MIN 222 * seconds, we will never enter dhcp_renew() and thus the packet 223 * counters will not be reset. in that case, reset them here. --- 62 unchanged lines hidden (view full) --- 286 * to async_start() while we're actually busy with our own 287 * asynchronous transaction. better than not having a lease. 288 */ 289 290 if (async_start(ifsp, DHCP_START, B_FALSE) == 0) 291 dhcpmsg(MSG_WARNING, "dhcp_expire: cannot start asynchronous " 292 "transaction on %s, continuing...", ifsp->if_name); 293 |
295 (void) script_start(ifsp, EVENT_EXPIRE, dhcp_restart, NULL, NULL); | 294 (void) script_start(ifsp, EVENT_EXPIRE, dhcp_restart_lease, NULL, NULL); |
296} 297 298/* 299 * dhcp_extending(): sends a REQUEST to extend a lease on a given interface 300 * and registers to receive the ACK/NAK server reply 301 * 302 * input: struct ifslist *: the interface to send the REQUEST on 303 * output: int: 1 if the extension request was sent, 0 otherwise --- 64 unchanged lines hidden --- | 295} 296 297/* 298 * dhcp_extending(): sends a REQUEST to extend a lease on a given interface 299 * and registers to receive the ACK/NAK server reply 300 * 301 * input: struct ifslist *: the interface to send the REQUEST on 302 * output: int: 1 if the extension request was sent, 0 otherwise --- 64 unchanged lines hidden --- |