Lines 62-67
Link Here
|
62 |
dhcpcd_start() { |
62 |
dhcpcd_start() { |
63 |
local iface="$1" opts= pidfile="/var/run/dhcpcd-$1.pid" |
63 |
local iface="$1" opts= pidfile="/var/run/dhcpcd-$1.pid" |
64 |
local ifvar=$(bash_variable "${iface}") metric= d= |
64 |
local ifvar=$(bash_variable "${iface}") metric= d= |
|
|
65 |
local new= |
66 |
local dhcpopts= |
65 |
|
67 |
|
66 |
interface_exists "${iface}" true || return 1 |
68 |
interface_exists "${iface}" true || return 1 |
67 |
|
69 |
|
Lines 69-91
Link Here
|
69 |
opts="dhcpcd_${ifvar}" |
71 |
opts="dhcpcd_${ifvar}" |
70 |
opts="${dhcpcd} ${!opts}" |
72 |
opts="${dhcpcd} ${!opts}" |
71 |
|
73 |
|
72 |
# Map some generic options to dhcpcd |
74 |
case "$(/sbin/dhcpcd --version)" in |
73 |
d="dhcp_${ifvar}" |
75 |
"dhcpcd "[123]*) new=false ;; |
74 |
d=" ${!d} " |
76 |
*) new=true ;; |
75 |
[[ ${d} == " " ]] && d=" ${dhcp} " |
77 |
esac |
76 |
[[ ${d} == *" nodns "* ]] && opts="${opts} -R" |
78 |
|
77 |
[[ ${d} == *" nontp "* ]] && opts="${opts} -N" |
79 |
# Map some dhcp generic options to dhcpcd |
78 |
[[ ${d} == *" nonis "* ]] && opts="${opts} -Y" |
80 |
eval dhcpopts=\$dhcp_${ifvar} |
79 |
[[ ${d} == *" nogateway "* ]] && opts="${opts} -G" |
81 |
[ -z "${dhcpopts}" ] && dhcpopts=${dhcp} |
80 |
if [[ ${d} == *" nosendhost "* ]] ; then |
82 |
for opt in ${dhcpopts}; do |
81 |
opts="${opts} -h ''" |
83 |
case "${opt}" in |
82 |
else |
84 |
nodns) |
83 |
# We transmit the hostname by default |
85 |
if ${new}; then |
84 |
if [[ " ${opts} " != *" -h "* ]]; then |
86 |
opts="${opts} -C resolv.conf" |
85 |
local hname=$(hostname) |
87 |
else |
86 |
[[ -n ${hname} && ${hname} != "(none)" && ${hname} != "localhost" ]] \ |
88 |
opts="${opts} -R" |
87 |
&& opts="-h \"${hname}\" ${opts}" |
89 |
fi |
88 |
fi |
90 |
;; |
|
|
91 |
nontp) |
92 |
if ${new}; then |
93 |
opts="${opts} -C ntp.conf" |
94 |
else |
95 |
opts="${opts} -N" |
96 |
fi |
97 |
;; |
98 |
nonis) |
99 |
if ${new}; then |
100 |
opts="${opts} -C yp.conf" |
101 |
else |
102 |
opts="${opts} -Y" |
103 |
fi |
104 |
;; |
105 |
nogateway) opts="${opts} -G";; |
106 |
nosendhost) opts="${opts} -h ''"; |
107 |
esac |
108 |
done |
109 |
|
110 |
# We transmit the hostname by default |
111 |
if [[ " ${opts} " != *" -h "* ]]; then |
112 |
local hname=$(hostname) |
113 |
[[ -n ${hname} && ${hname} != "(none)" && ${hname} != "localhost" ]] \ |
114 |
&& opts="-h \"${hname}\" ${opts}" |
89 |
fi |
115 |
fi |
90 |
|
116 |
|
91 |
# Add our route metric |
117 |
# Add our route metric |