1 Structure of the network scripts in buildroot-ng
6 To be able to access the network functions, you need to include
7 the necessary shell scripts by running:
9 . /etc/functions.sh # common functions
10 include /lib/network # include /lib/network/*.sh
11 scan_interfaces # read and parse the network config
13 Some protocols, such as PPP might change the configured interface names
14 at run time (e.g. eth0 => ppp0 for PPPoE). That's why you have to run
15 scan_interfaces instead of reading the values from the config directly.
16 After running scan_interfaces, the 'ifname' option will always contain
17 the effective interface name (which is used for IP traffic) and if the
18 physical device name differs from it, it will be stored in the 'device'
20 That means that running 'config_get lan ifname' after scan_interfaces
21 might not return the same result as running it before.
23 After running scan_interfaces, the following functions are available:
25 - find_config <interface> looks for a network configuration that includes
26 the specified network interface.
28 - setup_interface <interface> [<config>] [<protocol>] will set up the
29 specified interface, optionally overriding the network configuration
30 name or the protocol that it uses.
34 2) Writing protocol handlers
36 You can add custom protocol handlers by adding shell scripts to
37 /lib/network. They provide the following two shell functions:
39 scan_<protocolname>() {
41 # change the interface names if necessary
44 setup_interface_<protocolname>() {
47 # set up the interface
50 scan_<protocolname> is optional and only necessary if your protocol
51 uses a custom device, e.g. a tunnel or a PPP device.