summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* interface: apply device config passed through interface configFelix Fietkau2015-01-241-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* device: simplify config blob memory allocation handlingFelix Fietkau2015-01-242-6/+6
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* interface: do not set device_config where only the ifname option matchesFelix Fietkau2015-01-241-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* vlan: reset device state on initFelix Fietkau2015-01-241-0/+3
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* device: apply config changes from device sectionsFelix Fietkau2015-01-241-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* device: move config apply handling to a helper functionFelix Fietkau2015-01-242-29/+44
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* device: set dev->default_config to false for devices parsed from configFelix Fietkau2015-01-231-1/+4
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* device: add support for specifying a configuration for simple vlan devicesFelix Fietkau2015-01-231-4/+16
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* bridge: fix retrying member enable when the bridge is otherwise emptyFelix Fietkau2015-01-231-8/+40
| | | | | | Ensure that the bridge gets created before retrying Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* bridge: mark tested members as present during enable retryFelix Fietkau2015-01-231-0/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* bridge: release failed member devicesFelix Fietkau2015-01-231-0/+2
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* netifd: Make interface identifier of delegated IPv6 address configurableHans Dedecker2015-01-194-3/+107
| | | | | | | | | | | | | The ip6ifaceid UCI interface parameter makes the interface identifier of the delegated IPv6 address configurable. The parameter can have the following values: eui64 : Interface identifier is generated from the interface's MAC address random : Interface identifier is generated randomly fixed value : Interface identifier is a fixed value (eg ::1:2) The latter is the default value with a fixed value of ::1 for backwards compatibility Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> Signed-off-by: Joeri Barbarien <joeri.barbarien@gmail.com>
* handler: replace calls to deprecated json_object_object_getSteven Barth2014-12-231-1/+2
| | | | Signed-off-by: Steven Barth <steven@midlink.org>
* netifd: Add mldversion config supportSteven Barth2014-12-235-20/+39
| | | | | | | | | | | | Config support to set the MLD host version on device level; possible values are : 1 : MLDv1 2 : MLDv2 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> Cleaned up and simplified. Signed-off-by: Steven Barth <steven@midlink.org>
* netifd: Handle link down event in interface setup state as wellHans Dedecker2014-12-231-0/+1
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* Enable callers to pass the source IP of an IPv4 route when usingKristian Evensen2014-12-081-1/+2
| | | | | | | | | proto_add_ipv4_route(). This is useful with for example DHCP in a multihomed scenario, as it provides an easy way to match default routes with the correct IP address. One use case for this are applications that monitor the state of the WAN port, and the WAN port is assigned multiple addresses. Signed-off-by: Kristian Evensen <kristian.evensen at gmail.com>
* netifd: Add igmpversion config supportHans Dedecker2014-12-085-0/+55
| | | | | | | | | | | | | Config support to set the IGMP host version on device level; possible values are : 1 : IGMPv1 2 : IGMPv2 3 : IGMPv3 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> Cleand up and simplified Signed-off-by: Steven Barth <steven@midlink.org>
* netifd: Fix interface auto disable when doing network reloadHans Dedecker2014-12-081-2/+6
| | | | | | Keep interface down when interface auto parameter is set to 0 when doing network reload Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: Make possible state transitions more clear when handling teardown eventHans Dedecker2014-12-081-13/+20
| | | | | | Improve code readibility regarding state transitions when handling teardown event Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: Fix proto shell setup/teardwon race conditionHans Dedecker2014-12-081-4/+16
| | | | | | | | | | Fix setup race condition when proto shell is in teardown or setup_abort state when setup cmd is received. Don't change the proto shell state and launch no setup in these conditions so the proto shell teardown timeout handler does not kill the wrong processes and proto_shell_task_finish takes action on the correct teardown state. Don't launch a new setup action when already in setup state. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: Fix restore of original device settingsHans Dedecker2014-12-081-1/+2
| | | | | | | | Don't restore original device settings based on the device settings flags in system_if_down as device flags are already reset when the device config is deleted. Therefore move the masking of the relevant original device settings to system_if_up. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd v2: Fix source routing for IPv4Kristian Evensen2014-11-271-2/+6
| | | | | | | | | | | | | | | | | According to the OpenWRT Network documentation for route, the 'source' option is "The preferred source address when sending to destinations covered by the target". However, netifd currently stores this value in RTA_SRC on NEWROUTE/DELROUTE. RTA_SRC is not used by kernel when handling NEWROUTE nor DELROUTE for IPv4 routes. When adding a new IPv4 route, the source is stored in RTA_PREFSRC and the option works as specified in documentation. For IPv6, the address is still stored in RTA_SRC as to not break source-destination routing for IPv6. v2: Limit patch to IPv4, to prevent breaking IPv6 configurations (thanks Steven Barth) Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
* Fix setting blackhole-routes to kernelSteven Barth2014-11-251-3/+8
| | | | Signed-off-by: Steven Barth <steven@midlink.org>
* bridge: retry adding members after config reload / device startFelix Fietkau2014-11-231-0/+36
| | | | | | | | The kernel will refuse to add a vlan device to a bridge when the base device of that vlan is already a member. This can happen on config reload. Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* netifd: Add acceptlocal config supportHans Dedecker2014-11-193-0/+30
| | | | | | Adds support to accept packets with local source address. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: Add rpfilter config supportHans Dedecker2014-11-195-0/+62
| | | | | | | | | | | Reverse path filtering config support; possible values are: 0: no source validation 1|strict: strict mode as packet will be dropped if the incoming interface is not the best reverse path 2|loose: loose mode as packet will be dropped if the source address is not reachable via any interface Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: Remove superfluous system_if_resolve callsHans Dedecker2014-11-191-10/+2
| | | | | | | | Don't resolve the ifindex of the parent device again when adding vlandev and macvlan devices as the ifindex has already been resolved. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: Fix device ifindex overwrite when processing netlink event messagesHans Dedecker2014-11-194-7/+17
| | | | | | | | | | | When a device with the same name is deleted and created again in the kernel the ifindex changes. A race condition will occur when netlink event messages linked to the old device are processed and will thus overwrite the correct ifindex of the new device. Further make sure a valid ifindex is in place for both external and internal devices when setting the state to enabled. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd : Apply interface metric on subnet routes when reloading ipHans Dedecker2014-10-241-3/+9
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd : Reinsert ip parameters (addresses/routes) based on old interface ↵Hans Dedecker2014-10-241-2/+5
| | | | | | | | | | | config state Reinserts the config IP parameters as the config_ip parameter of the new interface is set to false in interface_alloc and thus not loading the config ip options of the old interface Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: Read current link state when processing netlink eventHans Dedecker2014-10-241-6/+13
| | | | | | | | | | | | | | | | | Netifd commit b2dcb02570939d98b92c7c55db1c328693a5d52a introduces a race condition resulting into infinite toggling interfaces (eg static interfaces with linksensing enabled, vlan interfaces with proto none (#18106)) when linksensing is enabled resulting into a crash. As netlink event messages will be queued on the netlink event socket the included lower up interface flag will not always represent the current link state when netifd processes the netlink messages; by reading the current link state when a netlink event message is parsed the correct info is passed to the device layer. This will avoid continuous interface toggling (down/up) triggered by link state changes based on outdated netlink interface info. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* wireless: use strdup for vif sectionsFelix Fietkau2014-10-241-5/+7
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* system-linux: fix a glob related memleakFelix Fietkau2014-10-241-4/+5
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* config: use sprintf instead of asprintfFelix Fietkau2014-10-241-6/+4
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* device: make link status detection optional for vlan devicesFelix Fietkau2014-10-205-1/+7
| | | | | | | Fixes a race condition that triggers endless link loss / detect calls when VLAN devices are created. Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* proto-shell: fix for not handling switch from DHCP to static raceMichel Stam2014-10-161-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a shell script call is finished, proto_shell_task_finish( ) is called to monitor processes, and determine the next interface state. When the interface is brought up after a reconfiguration from dhcp to static, it will first try to (erroneously?) reconfigure the interface for DHCP. Upon doing this, it realises the mistake and kills off the script by setting the state to S_SETUP_ABORT. This is done by the proto_shell_handler. When this happens. the scripts have 1 second to finish. When this happens, S_SETUP_ABORT in proto_shell_task_finish( ) should issue a 'teardown' event to the shell script to deconfigure the interface. It is here that things go wrong. Shell scripts do not execute commands themselves, they should finish as quick as possible. This is very race condition sensitive, though; Instead of executing commands, they post messages to execute commands. It is therefore possible that when the script finishes, there's still commands to execute. The dhcp protocol handler script, one of the scripts involved, notifies netifd of changes by (indirectly) calling proto_shell_update_link( ). Once every so often, the dhcp script will not be finished in time, and proto_shell_task_finish( ) cannot immediately continue, because (in this case) the proto_task is still pending. If this happens, the proto_shell_task_finish( ) will wait, but if the proto_shell_update_link( ) notification is then received, it will set the statemachine to idle, thus breaking the S_SETUP_ABORT. Furthermore, an event is generated to indicate that the network interface should be set to UP, rather than DOWN. This confuses netifd, and the result is a stuck process that does not respond to UCI calls anymore. Note that a similar situation happens in the S_TEARDOWN state in proto_shell_task_finish( ). The fix, although a bit ugly, is to prevent the UP event from being sent, and not to reset the state machine to idle in proto_shell_update_link( ). Signed-off-by: Michel Stam <m.stam@fugro.nl>
* netifd: Fix lost interface device config for devices having default configHans Dedecker2014-10-121-2/+4
| | | | | | | As the PPP main device (either a simple or old style vlan device) is freed when PPP interfaces are reloaded; interface device specific config (eg mtu/macaddr/...) is lost as the interface config is not re-applied on the newly created device. Patch fixes the issue by re-applying the interface device config after the main device is claimed and is having default config. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd : Line up device.h include guardHans Dedecker2014-10-121-2/+2
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* config: define _GNU_SOURCE for asprintfFelix Fietkau2014-10-071-0/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* wireless: print the active configuration in status infoFelix Fietkau2014-10-041-2/+2
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* wireless: fix blob buf in put_container()Felix Fietkau2014-10-041-3/+3
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* wireless: display anonymous interface section names using index based ↵Felix Fietkau2014-10-041-1/+27
| | | | | | extended syntax Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* wireless: copy the vif section name instead of keeping a reference that ↵Felix Fietkau2014-10-041-3/+5
| | | | | | might go stale Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* netifd: IPIP tunnel supportHans Dedecker2014-10-021-29/+82
| | | | | | | | | | | | | | Adds IPIP tunnel support to netifd. Following IPIP tunnel parameters can be configured : -peeraddr (IPv4 remote address) -ipaddr (IPv4 local address) -mtu (IPIP tunnel mtu) -ttl (time to live of encapsulting packets) -tos (type of service either inherit (outer header inherits the value of the inner header) or hex value) -df (don't fragment flag of encapsulating packets) -tunlink (bind tunnel to this interface) Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: GRE Tos supportHans Dedecker2014-09-293-1/+36
| | | | | | | | Tos support is added as a generic gre parameter which can have the following values : -inherit (outer header inherits the tos value of the inner header) -hex value Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd-device: add support for promisc settingMartin Hundebøll2014-09-173-0/+22
| | | | Signed-off-by: Martin Hundebøll <martin@hundeboll.net>
* ipv6: work around kernel on-link handling issueSteven Barth2014-09-081-1/+1
| | | | Signed-off-by: Steven Barth <steven@midlink.org>
* interface: call proto teardown before marking the interface as downFelix Fietkau2014-08-311-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* interface: do not try to bring up an unavailable interfaceFelix Fietkau2014-08-311-0/+3
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* interface: cancel the remove timer on cleanupFelix Fietkau2014-08-311-0/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>