]> git.ipfire.org Git - people/stevee/network.git/blob - hooks/README
network: New package.
[people/stevee/network.git] / hooks / README
1 HOOKS README
2
3 A hook is file that can configure a specific network connection (e.g. ethernet)
4 or protocol (e.g. ipv4-static).
5
6 They are expandable and standalone. Means, when you call a file, you will
7 run it and pass some options and an action to it.
8
9 /lib/network/hooks/HOOOK [options] <action> [options to action]
10
11 There are two types of hooks:
12 zone
13 These hooks applies to a zone and does configuration on it.
14 Mainly, it configures the IP protocol or something else.
15
16 port
17 These hooks add ports to zones.
18
19 DEFINES:
20 So, to know what type of hook this is, we have to define some variables
21 in the header of the file.
22
23 HOOK_NAME
24 The name of the hook. This is normally the file name.
25
26 HOOK_TYPE
27 zone or port. See section above.
28
29
30 INLCUDES:
31 These files get included in the header.
32
33 /lib/lsb/init-functions
34 For pretty messages
35
36 /lib/network/functions
37 Our networking funktions.
38
39
40 OPTIONS:
41 Options have at least to be for zone file:
42
43 --config=CONFIG
44 Includes the given config file CONFIG.
45 If there is an error when loading the config file or the parameters are
46 wrong or invalid, the script will pass an error with code ${EXIT_CONF_ERROR}!
47
48 --port=PORT
49 Takes a port (either as device (eth0) or as mac (00:11:22:33:44:55)).
50
51 --zone=ZONE
52 Takes the name of a zone.
53
54
55 ACTION:
56 Actions that always have to be defined:
57 help
58 Gives the user a short help how to use the command and its arguments.
59
60 info
61 Gives some information about the hook (mainly for internal use of the scripts).
62 See below.
63
64 status
65 Gives information if the hook is active or not.
66
67 config
68 This is the command that creates the configuration for each hook.
69 It will accept some more arguments in the command line
70 and return either ${EXIT_OK} or ${EXIT_ERROR}.
71
72 Actions that have to be defined for a zone hook:
73 pre-up
74 This gets runned before the zone gets up.
75
76 pre-down.
77 This is runned before the zone is set down.
78
79 post-up
80 After setting up the zone, this command will be executed.
81
82 post-down
83 After the zone has vanished, this part of the script is called.
84
85 All these actions will return ${EXIT_OK} when everything went fine.
86 If not, they will return ${EXIT_ERROR}.