summaryrefslogtreecommitdiff
blob: 6be0a4bfc642399760749dec44bd355eee958390 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Copyright (c) 2005-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Contributed by Roy Marples (uberlord@gentoo.org)
# Many thanks to all the people in the Gentoo forums for their ideas and
# motivation for me to make this and keep on improving it

# void macnet_depend(void)
#
# Sets up the dependancies for the module
macnet_depend() {
	before rename interface wireless
	after macchanger
	installed macchanger
	functions interface_get_mac_address
}

# bool macnet_start(char *iface)
#
# All interfaces and module scripts can depend on the variables function 
# which returns a space seperated list of user configuration variables
# We can override each variable here from a given MAC address of the interface
# Always returns 0
macnet_pre_start() {
	local iface="$1"

	interface_exists "${iface}" || return 0

	# We need to bring the interface up for some interfaces, otherwise the MAC
	# address isn't consistent - mainly wireless cards with firmware uploading.
	interface_up "${iface}"

	local mac="$(interface_get_mac_address "${iface}")"
	[[ -z ${mac} ]] && return 0

	vebegin "Configuring ${iface} for MAC address ${mac}" 2>/dev/null
	mac="${mac//:/}"
	configure_variables "${iface}" "${mac}"
	veend 0 2>/dev/null

	return 0
}

# vim: set ft=sh ts=4 :