mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-04 22:53:02 +02:00
37 lines
810 B
Plaintext
Executable File
37 lines
810 B
Plaintext
Executable File
#!/bin/sh
|
|
# Command line arguments:
|
|
# $1 event that happened:
|
|
# BIND: Successfully claimed address
|
|
# CONFLICT: An IP address conflict happened
|
|
# UNBIND: The IP address is no longer needed
|
|
# STOP: The daemon is terminating
|
|
# $2 interface name
|
|
# $3 IP adddress
|
|
|
|
PATH="$PATH:/usr/bin:/usr/sbin:/bin:/sbin"
|
|
|
|
log()
|
|
{
|
|
logger -I $$ -t zeroconf -p user.notice "$*"
|
|
}
|
|
|
|
case "$1" in
|
|
BIND)
|
|
ip addr flush dev "$2" proto random
|
|
ip addr add "$3"/16 brd 169.254.255.255 scope link dev "$2" proto random
|
|
log "set ipv4ll $3 on iface $2"
|
|
;;
|
|
|
|
CONFLICT|UNBIND|STOP)
|
|
ip addr flush dev "$2" proto random
|
|
log "clr ipv4ll on iface $2"
|
|
;;
|
|
|
|
*)
|
|
log "Unknown event $1 on iface $2"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit 0
|