]> git.ipfire.org Git - people/ms/network.git/blame - src/dhclient-helper
wireless-ap: Allow to disable DFS in configuration
[people/ms/network.git] / src / dhclient-helper
CommitLineData
e9ea243e
MT
1#!/bin/bash
2
3. /usr/lib/network/functions
4
5action="${1}"
6assert isset action
7
8interface="${2}"
9assert isset interface
10
11proto=${3}
12assert isset proto
13
14# Check if the given interface is a zone.
15assert zone_exists ${interface}
16
17case "${action}" in
18 start)
7ad5252c
MT
19 leases_file=""
20
e9ea243e
MT
21 # Create dhclient configuration file.
22 case "${proto}" in
23 ipv4)
24 config_file="${RUN_DIR}/dhclient/${interface}/dhclient4.conf"
25 ;;
26 ipv6)
27 config_file="${RUN_DIR}/dhclient/${interface}/dhclient6.conf"
7ad5252c 28 leases_file="/var/lib/dhclient/dhclient6-${interface}.leases"
e9ea243e
MT
29 ;;
30 esac
31 assert isset config_file
32
7ad5252c
MT
33 # Update the dhclient configuration files
34 dhclient_write_config "${interface}" \
35 --config-file="${config_file}" \
36 --leases-file="${leases_file}" || exit $?
e9ea243e
MT
37
38 exit ${EXIT_OK}
39 ;;
40
41 stop)
42 case "${proto}" in
43 ipv4)
44 reason="STOP"
45 ;;
46 ipv6)
47 reason="STOP6"
48 ;;
49 esac
50 assert isset reason
51
52 export interface
53 export reason
54
55 exec /usr/sbin/dhclient-script
56
57 log ERROR $"execing dhclient-script has failed."
58 exit ${EXIT_ERROR}
59 ;;
60
61 *)
62 log ERROR "Unknown action passed: ${action}"
63 exit ${EXIT_ERROR}
64 ;;
65esac