[[TableOfContents]] == 기능적 추가 == === 표준 함수 훅 === start/stop 동작 주변에 있는 네개의 함수가 정의될 수 있습니다. 함수들은 인터페이스 이름이 먼저와서 하나의 함수로 하여금 다중 어탭터를 제어할 수 있습니다. preup()과 predown() 함수의 반환값은 인터페이스의 환경설정/해제가 계속될 수 있는 0(성공)이 될 것입니다. 만약 preup()이 0이 아닌 값을 리턴하면 인터페이스 환경설정은 중단될 것입니다. predown()이 0이 아닌 값을 반환하면 인터페이스는 환경설정 취소가 더이상 진행되지 않을 것입니다. postup()과 postdown()함수의 반환값은 실패징후를 보인다면 아무것도 안하기 때문에 무시됩니다. ${IFACE} 는 인터페이스가 up/down되는 것을 설정합니다. ${IFVAR}는 ${IFACE} 가 배시에서 허용하는 변수로 변형된 것입니다. '''예제 1-1: pre/post up/down 함수 예제''' {{{ 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 } }}} === 무선 도구 함수 훅 === '''유의사항: WPA 요청과는 동작하지 않을 것입니다. 그러나 ${ESSID} 와 ${ESSIDVAR} 변수들은 postup() 함수내에서 사용 가능합니다.''' 참여 동작 주변에 있는 네개의 함수가 정의될 수 있습니다. 함수들은 인터페이스 이름이 먼저와서 하나의 함수로 하여금 다중 어탭터를 제어할 수 있습니다. preassociate() 함수의 반환값은 앞으로도 계속 인터페이스의 환경설정/해제가 가능할때 0(성공)을 반환할 것입니다. 만약 preassociate()가 0이 아닌 값을 리턴하게 되면 환경설정은 중단될 것입니다. postassociate() 함수의 반환값은 이상증세가 발견될 경우 아무것도 안하기 때문에 무시됩니다. ${ESSID} 는 연결하고자하는 AP의 정확한 ESSID에 맞춰집니다. ${ESSIDVAR}은 ${ESSID}가 배시에서 허용하는 변수로 변환된 것입니다. '''예제 2-2 : pre/post 참여 함수''' {{{ 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()함수에서 사용 불가능합니다.''' [http://wiki.kldp.org/wiki.php/GentooX86Handbook_Ko 이전으로 가기]