Revision 67ee1ec5
Added by Ermal Luçi almost 17 years ago
etc/rc.newwanip | ||
---|---|---|
42 | 42 |
|
43 | 43 |
log_error("Informational: rc.newwanip is starting {$argument}."); |
44 | 44 |
|
45 |
if($argument <> "") { |
|
46 |
$interface = convert_real_interface_to_friendly_interface_name($argument); |
|
47 |
$interface_real = convert_friendly_interface_to_real_interface_name($argument); |
|
48 |
$curwanip = find_interface_ip($interface_real); |
|
49 |
if($curwanip == "") |
|
50 |
$curwanip = get_current_wan_address(); |
|
51 |
} else { |
|
45 |
if(empty($argument)) { |
|
52 | 46 |
$curwanip = get_current_wan_address(); |
53 | 47 |
$interface = "wan"; |
54 |
$interface_real = $config['interfaces']['wan']['if']; |
|
48 |
$interface_real = get_real_wan_interface(); |
|
49 |
} else { |
|
50 |
$interface = convert_real_interface_to_friendly_interface_name($argument); |
|
51 |
$interface_real = $argument; |
|
52 |
$curwanip = find_interface_ip($interface_real); |
|
53 |
if($curwanip == "") |
|
54 |
$curwanip = get_current_wan_address($interface); |
|
55 | 55 |
} |
56 | 56 |
|
57 | 57 |
log_error("rc.newwanip working with (IP address: {$curwanip}) (interface: {$interface}) (interface real: {$interface_real})."); |
... | ... | |
62 | 62 |
exit; |
63 | 63 |
} |
64 | 64 |
|
65 |
/* grab the prior ip for pftpx tests */ |
|
66 |
if(file_exists("/tmp/rc.newwanip_oldip")) { |
|
67 |
/* grab hint from dhclient */ |
|
68 |
$old_ip = trim(file_get_contents("/tmp/rc.newwanip_oldip", "\r")); |
|
69 |
unlink("/tmp/rc.newwanip_oldip"); |
|
70 |
} |
|
71 | 65 |
/* fallback to rc.newwanip ip if needed */ |
72 | 66 |
if(!$old_ip) |
73 | 67 |
if(file_exists("{$g['vardb_path']}/{$interface}_ip")) |
... | ... | |
122 | 116 |
if($old_ip <> $curwanip) |
123 | 117 |
exec("/etc/rc.start_packages"); |
124 | 118 |
|
125 |
|
|
126 | 119 |
/* reconfigure our gateway monitor */ |
127 | 120 |
setup_gateways_monitor(); |
128 | 121 |
|
129 |
return true; |
|
130 |
|
|
122 |
return 0; |
|
131 | 123 |
?> |
Also available in: Unified diff
NOTE: this is only half part of the changes the other half will come after