3 A hook is file that can configure a specific network connection (e.g. ethernet)
4 or protocol (e.g. ipv4-static).
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.
9 /lib/network/hooks/HOOOK [options] <action> [options to action]
11 There are two types of hooks:
13 These hooks applies to a zone and does configuration on it.
14 Mainly, it configures the IP protocol or something else.
17 These hooks add ports to zones.
20 So, to know what type of hook this is, we have to define some variables
21 in the header of the file.
24 The name of the hook. This is normally the file name.
27 zone or port. See section above.
31 These files get included in the header.
33 /lib/lsb/init-functions
36 /lib/network/functions
37 Our networking funktions.
41 Options have at least to be for zone file:
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}!
49 Takes a port (either as device (eth0) or as mac (00:11:22:33:44:55)).
52 Takes the name of a zone.
56 Actions that always have to be defined:
58 Gives the user a short help how to use the command and its arguments.
61 Gives some information about the hook (mainly for internal use of the scripts).
65 Gives information if the hook is active or not.
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}.
72 Actions that have to be defined for a zone hook:
74 This gets runned before the zone gets up.
77 This is runned before the zone is set down.
80 After setting up the zone, this command will be executed.
83 After the zone has vanished, this part of the script is called.
85 All these actions will return ${EXIT_OK} when everything went fine.
86 If not, they will return ${EXIT_ERROR}.