RFC 3442 - improved dhclient-script
This commit is contained in:
parent
d5a4ff8b46
commit
2560aa7e3c
@ -307,10 +307,6 @@ dhconfig() {
|
||||
[ -n "${new_static_routes}" ]; then
|
||||
if [ -n "${new_classless_static_routes}" ]; then
|
||||
IFS=', |' static_routes=(${new_classless_static_routes})
|
||||
|
||||
# If the DHCP server returns both a Classless Static Routes option and
|
||||
# a Router option, the DHCP client MUST ignore the Router option. (RFC3442)
|
||||
new_routers=""
|
||||
else
|
||||
IFS=', |' static_routes=(${new_static_routes})
|
||||
fi
|
||||
@ -319,19 +315,26 @@ dhconfig() {
|
||||
for((i=0; i<${#static_routes[@]}; i+=2)); do
|
||||
target=${static_routes[$i]}
|
||||
if [ -n "${new_classless_static_routes}" ]; then
|
||||
prefix=$(echo ${target} | cut -d "." -f 1)
|
||||
target=$(echo ${target} | cut -d "." -f 2-)
|
||||
IFS="." target_arr=(${target})
|
||||
unset IFS
|
||||
((pads=4-${#target_arr[@]}))
|
||||
for j in $(seq $pads); do
|
||||
target=${target}".0"
|
||||
done
|
||||
if [ ${target} = "0" ]; then
|
||||
# If the DHCP server returns both a Classless Static Routes option and
|
||||
# a Router option, the DHCP client MUST ignore the Router option. (RFC3442)
|
||||
new_routers=""
|
||||
prefix="0"
|
||||
else
|
||||
prefix=$(echo ${target} | cut -d "." -f 1)
|
||||
target=$(echo ${target} | cut -d "." -f 2-)
|
||||
IFS="." target_arr=(${target})
|
||||
unset IFS
|
||||
((pads=4-${#target_arr[@]}))
|
||||
for j in $(seq $pads); do
|
||||
target=${target}".0"
|
||||
done
|
||||
|
||||
# Client MUST zero any bits in the subnet number where the corresponding bit in the mask is zero.
|
||||
# In other words, the subnet number installed in the routing table is the logical AND of
|
||||
# the subnet number and subnet mask given in the Classless Static Routes option. (RFC3442)
|
||||
target="$(get_network_address ${target} ${prefix})"
|
||||
# Client MUST zero any bits in the subnet number where the corresponding bit in the mask is zero.
|
||||
# In other words, the subnet number installed in the routing table is the logical AND of
|
||||
# the subnet number and subnet mask given in the Classless Static Routes option. (RFC3442)
|
||||
target="$(get_network_address ${target} ${prefix})"
|
||||
fi
|
||||
else
|
||||
prefix=$(class_bits ${target})
|
||||
fi
|
||||
@ -353,7 +356,7 @@ dhconfig() {
|
||||
fi
|
||||
|
||||
if is_router_reachable ${gateway}; then
|
||||
ip -4 route replace ${target}/${prefix} via ${gateway} dev ${interface} ${metric}
|
||||
ip -4 route replace ${target}/${prefix} proto static via ${gateway} dev ${interface} ${metric}
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
logmessage "failed to create static route: ${target}/${prefix} via ${gateway} dev ${interface} ${metric}"
|
||||
|
@ -7,7 +7,7 @@
|
||||
Summary: Dynamic host configuration protocol software
|
||||
Name: dhcp
|
||||
Version: 4.2.0
|
||||
Release: 8%{?dist}
|
||||
Release: 9%{?dist}
|
||||
# NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to
|
||||
# dcantrell maintaining the package) made incorrect use of the epoch and
|
||||
# that's why it is at 12 now. It should have never been used, but it was.
|
||||
@ -515,6 +515,10 @@ fi
|
||||
%attr(0644,root,root) %{_mandir}/man3/omapi.3.gz
|
||||
|
||||
%changelog
|
||||
* Mon Oct 04 2010 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.0-9
|
||||
- RFC 3442 - ignore Router option only if
|
||||
Classless Static Routes option contains default router
|
||||
|
||||
* Thu Sep 30 2010 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.0-8
|
||||
- Explicitly clear the ARP cache and flush all addresses & routes
|
||||
instead of bringing the interface down (#574568)
|
||||
|
Loading…
Reference in New Issue
Block a user