Révision 4cc2ae78
Ajouté par Renato Botelho il y a presque 10 ans
sbin/dhclient-script | ||
---|---|---|
27 | 27 |
SED=/usr/bin/sed |
28 | 28 |
ARP=/usr/sbin/arp |
29 | 29 |
IFCONFIG=/sbin/ifconfig |
30 |
PFCTL=/sbin/pfctl |
|
31 | 30 |
|
32 | 31 |
LOCALHOST=127.0.0.1 |
33 | 32 |
|
34 | 33 |
if [ -x /usr/bin/logger ]; then |
35 | 34 |
LOGGER="/usr/bin/logger -s -p user.notice -t dhclient" |
36 | 35 |
else |
37 |
LOGGER="echo"
|
|
36 |
LOGGER=echo
|
|
38 | 37 |
fi |
39 | 38 |
|
40 | 39 |
# |
... | ... | |
43 | 42 |
|
44 | 43 |
check_hostname() { |
45 | 44 |
current_hostname=`$HOSTNAME` |
46 |
if [ -z "$current_hostname" -o \ |
|
47 |
"$current_hostname" != "$new_host_name" ]; then |
|
45 |
if [ -z "$current_hostname" ]; then |
|
46 |
$LOGGER "New Hostname ($interface): $new_host_name" |
|
47 |
$HOSTNAME $new_host_name |
|
48 |
elif [ "$current_hostname" = "$old_host_name" -a \ |
|
49 |
"$new_host_name" != "$old_host_name" ]; then |
|
48 | 50 |
$LOGGER "New Hostname ($interface): $new_host_name" |
49 | 51 |
$HOSTNAME $new_host_name |
50 | 52 |
fi |
... | ... | |
58 | 60 |
|
59 | 61 |
delete_old_states() { |
60 | 62 |
$LOGGER "Starting delete_old_states()" |
61 |
_FLUSHED=0 |
|
62 | 63 |
# If the IP changed, remove states from the old one |
63 | 64 |
if [ -f /var/db/${interface}_ip ]; then |
64 |
OLD_IP=`cat /var/db/${interface}_ip`
|
|
65 |
OLD_IP = `cat /var/db/${interface}_ip`
|
|
65 | 66 |
$LOGGER "Comparing IPs: Old: ${OLD_IP} New: ${new_ip_address}" |
66 | 67 |
if [ -n "${OLD_IP}" ] && [ "${OLD_IP}" != "${new_ip_address}" ]; then |
67 | 68 |
$LOGGER "Removing states from old IP '${OLD_IP}' (new IP '${new_ip_address}')" |
68 |
${PFCTL} -i $interface -Fs |
|
69 |
${PFCTL} -K ${OLD_IP}/32 |
|
70 |
_FLUSHED=1 |
|
69 |
/sbin/pfctl -i $interface -Fs |
|
70 |
pfctl -K ${OLD_IP}/32 |
|
71 | 71 |
fi |
72 | 72 |
fi |
73 | 73 |
# Delete states through old gateway if it's not the same |
74 |
OLD_ROUTER="" |
|
75 | 74 |
if [ -n "${old_routers}" ]; then |
76 |
OLD_ROUTER=$old_routers |
|
77 |
elif [ -f /tmp/${interface}_router ]; then |
|
78 |
OLD_ROUTER=`cat /tmp/${interface}_router` |
|
75 |
OLD_ROUTER = $old_routers |
|
76 |
fi |
|
77 |
if [ -z "${OLD_ROUTER}" ] && [ -f /tmp/${interface}_router ]; then |
|
78 |
OLD_ROUTER = `cat /tmp/${interface}_router` |
|
79 | 79 |
fi |
80 |
if [ ${_FLUSHED} -eq 0 -a -n "${OLD_ROUTER}" ]; then
|
|
80 |
if [ -n "${OLD_ROUTER}" ]; then |
|
81 | 81 |
$LOGGER "Comparing Routers: Old: ${OLD_ROUTER} New: ${new_routers}" |
82 | 82 |
if [ "${OLD_ROUTER}" != "${new_routers}" ]; then |
83 | 83 |
$LOGGER "Removing states through old gateway '${OLD_ROUTER}' (new gateway '${new_routers}')" |
84 |
${PFCTL} -i $interface -Fs
|
|
84 |
/sbin/pfctl -i $interface -Fs -G ${OLD_ROUTER}
|
|
85 | 85 |
fi |
86 | 86 |
fi |
87 | 87 |
} |
Formats disponibles : Unified diff
Revert "Fix #3700 and other syntax issues:"
This reverts commit e912bfae186b6b657daf52607f9d027f46be0478.