Handbook:IA64/Networking/Extending/ko
기본 함수 훅
Four functions can be defined in /etc/conf.d/net:
preup()
, called before an interface is brought up;predown()
, called before an interface is brought down;postup()
, called after an interface is brought up; andpostdown()
, called after an interface is brought down.
Each of these these functions is called with the interface name, available within each function via the IFACE variable, so that one function can control multiple interfaces.
The return values for the preup()
and predown()
functions should be:
- 0 to indicate success, and that configuration or de-configuration of the interface can continue.
- A non-zero value otherwise.
If preup()
returns a non-zero value, interface configuration will be aborted. If predown()
returns a non-zero value, the interface will not be allowed to continue de-configuration.
Return values for the postup()
and postdown()
functions are ignored since there's nothing to do if they indicate failure.
${IFACE}는 올리고 내릴 인터페이스 설정 값입니다. ${IFVAR}는 배시에서 허용하는 변수 이름로 바꾼 ${IFACE}입니다.
preup() {
# Test for link on the interface prior to bringing it up. This
# only works on some network adapters and requires the ethtool
# package to be installed.
if ethtool ${IFACE} | grep -q 'Link detected: no'; then
ewarn "No link on ${IFACE}, aborting configuration"
return 1
fi
# Remember to return 0 on success
return 0
}
predown() {
# The default in the script is to test for NFS root and disallow
# downing interfaces in that case. Note that if you specify a
# predown() function you will override that logic. Here it is, in
# case you still want it...
if is_net_fs /; then
eerror "root filesystem is network mounted -- can't stop ${IFACE}"
return 1
fi
# Remember to return 0 on success
return 0
}
postup() {
# This function could be used, for example, to register with a
# dynamic DNS service. Another possibility would be to
# send/receive mail once the interface is brought up.
return 0
}
postdown() {
# This function is mostly here for completeness... I haven't
# thought of anything nifty to do with it yet ;-)
return 0
}
함수 작성에 대해 더 알아보려면 /usr/share/doc/netifrc-*/net.example.bz2를 살펴보십시오.
무선 네트워크 도구 함수 훅
이 부분은 WPA Supplicant와 동작하지 않습니다만 ${ESSID}와 ${ESSIDVAR} 변수는
postup()
함수에서 동작하는 변수입니다.Two functions can be defined in /etc/conf.d/net:
preassociate()
, called before association.postassociate()
, called after association.
Each of these these functions is called with the interface name, available within each function via the IFACE variable, so that one function can control multiple interfaces.
The return values for the preassociate() function should be:
- 0 to indicate success, and to continue configuration.
- A non-zero value otherwise.
If preassociate()
returns a non-zero value, interface configuration will be aborted.
postassociate()
함수의 반환 값은 실패했을 경우 아무런 조치를 취하지 않기 떄문이 무시합니다.
${ESSID}는 시스템이 연결한 AP에서 제공하는 정확한 ESSID 설정입니다. ${ESSIDVAR}는 배시에서 허용하는 변수 이름으로 바꾼 ${ESSID}입니다.
preassociate() {
# The below adds two configuration variables leap_user_ESSID
# and leap_pass_ESSID. When they are both configured for the ESSID
# being connected to then we run the CISCO LEAP script
local user pass
eval user=\"\$\{leap_user_${ESSIDVAR}\}\"
eval pass=\"\$\{leap_pass_${ESSIDVAR}\}\"
if [[ -n ${user} && -n ${pass} ]]; then
if [[ ! -x /opt/cisco/bin/leapscript ]]; then
eend "For LEAP support, please emerge net-misc/cisco-aironet-client-utils"
return 1
fi
einfo "Waiting for LEAP Authentication on \"${ESSID//\\\\//}\""
if /opt/cisco/bin/leapscript ${user} ${pass} | grep -q 'Login incorrect'; then
ewarn "Login Failed for ${user}"
return 1
fi
fi
return 0
}
postassociate() {
# This function is mostly here for completeness... I haven't
# thought of anything nifty to do with it yet
return 0
}
${ESSID}와 ${ESSIDVAR}는
predown()
과 postdown()
함수에서 사용할 수 없습니다.개별 정의 함수 작성에 대해 더 알아보려면 /usr/share/doc/netifrc-*/net.example.bz2를 살펴보십시오.