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