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