summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* interface-ip: fix device name for IPv6 link-local DNS serverHans Dedecker2017-04-051-2/+3
| | | | | | | | | | Commit 235a02424c3ab1b59308895c4f00395dacf2557c adds support for IPv6 link-local DNS server by appending the device name; however the interface ifname parameter does not always contain the layer 3 device name (e.g it can hold the aliased interface name) Fix this by passing the device name of the referenced layer 3 device. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface-ip: set prefix indicator flag when IPv6 prefix lifetime changesHans Dedecker2017-03-211-0/+4
| | | | | | | | Trigger interface update event when IPv6 prefix lifetime changes by setting the prefix indicator flag to inform external subsystems (eg hnetd) about IPv6 prefix lifetime changes. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: parse vti specific settings as nested json data objectHans Dedecker2017-03-213-15/+33
| | | | | | | Parse vti specific settings ikey and okey as nested json data object. At the same time remove the now obsolete TUNNEL_ATTR_INFO attribute. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: parse gre specific settings as nested json data objectHans Dedecker2017-03-213-19/+54
| | | | | | | Parse gre specific settings ikey, okey, icsum, ocsum, iseqno and oseqno as nested json data object Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: add VXLAN supportMatthias Schiffer2017-03-073-1/+181
| | | | | | | | | | | | VXLAN shares many attributes with the tunnel devices, so it is implemented as a new tunnel type. The 'remote' attribute can be used for an unicast peer or a multicast group. The IANA-assigned port 4789 is used by default, instead of the non-standard port Linux defaults to. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net> Acked-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: Add option to configure locktime for each deviceAlin Năstac2017-02-113-0/+33
| | | | | | | | | | | The UCI parameter neighlocktime allows to control the hardware address to IP mapping lock time in the IPv4 neighbour table. The IPv6 lock time was not set because it is not used at all in any kernel versions, hardware address override being controlled in this case by the override flag present in the NA packet. Signed-off-by: Alin Nastac <alin.nastac@gmail.com>
* interface: add prefix assignment priority supportHans Dedecker2017-02-115-17/+52
| | | | | | | | | | | | | | | | | | | | | | | | | In case of prefix delegation prefixes are assigned to one or more configured downstream interfaces. The delegated prefix length in combination with the assignment length of the downstream interfaces determines the number of subnets which can be allocated from the delegated prefix. The interface ip6weight parameter allows to prioritize the allocation of subnets to interfaces in case of multiple configured downstream interfaces. The order of interface prefix assignment from a delegated prefix is based on the following parameters: - Primary key is prefix assignment based on the configured interface ip6hint - Secondary key is the requested downstream interface prefix length, interfaces configured with the smallest ip6hint will be assigned first - Third key is the assigned interface ip6weight in case of equal prefix assignment length; interfaces having the highest ip6weight will be assigned first - Finally the alphabetical order of the interfaces in case of equal ip6weight Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> Signed-off-by: Felix Fietkau <nbd@nbd.name> [cleanup]
* device: add veth supportMatthias Schiffer2017-02-115-1/+337
| | | | | | | | | | | | | The veth config code mostly handles the primary interface of a veth pair, the secondary interface is not explicitly referenced and will be found as an unrelated interface after the pair has been created. This doesn't only allow us to keep the veth code simple (and similar to existing device handlers), but will also avoid complicating handling unnecessarily in case the secondary interface is moved into another network namespace. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* wireless: fix _wireless_add_processGünther Kelleter2017-02-111-2/+2
| | | | | | | The pid is in $1, not $pid. Use proper test condition for nonmatching exe warning. Signed-off-by: Günther Kelleter <guenther.kelleter@devolo.de>
* treewide: fix white space errorsHans Dedecker2017-01-315-26/+23
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface-ip: route proto config support (FS#170)Hans Dedecker2017-01-256-8/+70
| | | | | | | | | | | Route proto support is usefull when using route distribution via a routing daemon. The route proto parameter can be specified via the route proto uci config parameter, it can hold a numerical value or the string values unspec, kernel, boot, static or a string present in /etc/iproute2/rt_protos. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* device: fix DEV_OPT_SENDREDIRECTS definitionHans Dedecker2017-01-171-1/+1
| | | | | | | | Commit abf52371db75eb449f12209ca1b7ffaa9d2baa22 adds sendredirects device config support by defining DEV_OPT_SENDREDIRECTS. Fix definition overlap of DEV_OPT_SENREDIRECTS with DEV_OPT_LEARNING. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* bridge: disable IGMP snooping by defaultFelix Fietkau2017-01-131-2/+0
| | | | | | | | | Lots of configurations have triggered various issues in this feature, any many people don't even need this. Let's disable it by default until it has become more stable Signed-off-by: Felix Fietkau <nbd@nbd.name>
* netifd: Add sendredirects config supportDaniel Golle2017-01-103-0/+31
| | | | | | | | | | | | | | | | | | | | | | Setting /proc/sys/net/ipv4/conf/*/send_redirects is useful if a single layer-2 domain is shared among routed subnets. Sending redirects will prevents traffic from taking unnessesary detours through a gateway in cases where direct connectivity on layer 2 exists. This is commonly the case if an existing LAN infratructure with dump switches is used to additionally carry routing protocols like OLSR which are supported only by some nodes on the network. It's important to note that the default value for send_redirects differs for interface types (it's enabled on physical ethernet interfaces, but disabled e.g. on VLANs) due to olsrd changing /proc/sys/net/ipv4/conf/default/send_redirects during boot, thus the default differs also depending e.g. on the way an on-board switch is integrated on specific boards (as eth0 exists before olsrd is started, eth0.1 gets created by netifd later on...) Having a way to explicitely enable or disable send_redirects is thus desireable also to unify the default behaviour among different, but seemingly similar devices supported. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* proto: allow configuring deprecated static IPv6 addressesMatthias Schiffer2016-12-241-5/+14
| | | | | | | | | Add a new boolean attribute ip6deprecated to the static protocol which can be used to mark IPv6 addresses as deprecated (i.e., set the preferred lifetime to 0). This is useful to configure addresses that may be used for incoming, but not for outgoing connections unless bound explicitly. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* remove obsolete /opt/local prefix on Mac OS XFelix Fietkau2016-12-241-5/+0
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* system-linux: Don't set gre tunnel ttl by default to 64 (#FS312)Hans Dedecker2016-12-241-8/+15
| | | | | | | | | | As the ttl of a gre tunnel was set by default to 64 the gre tunnel failed to get active if don't fragment was disabled as setting nopmtudisc and ttl is incompatible. Fix this by setting the default ttl value after don't fragment and ttl config values have been parsed. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* ubus: Display the IPv6 prefix assigned addressHans Dedecker2016-12-121-1/+10
| | | | | | | | | Display the IPv6 address obtained from a prefix assignment as local-address element in the ubus ipv6-prefix-assignment list so it's explicitly clear which IPv6 address from the delegated prefix is assigned to interface. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* device: Use device_find for better readibility in device_createHans Dedecker2016-11-221-1/+1
| | | | | | | Use device_find in device_create so it's clear a device lookup is being done in the device list. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* ubus: Use device_find to find a device when displaying device infoHans Dedecker2016-11-221-1/+1
| | | | | | | | | | | | Replace device_get by device_find in netifd_dev_status as device_get will fail to find the device if it's created via config as an aliased vlan device in dotted notation (eg @iface.200). In such case get_vlan_device_chain will figure out the layer3 device but get_vlan_device will not find the vlan device in the dependency list of the layer 3 device as it has been created as a dependency of the aliased device. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* bridge: fix MAC address override on config reloadFelix Fietkau2016-11-221-0/+3
| | | | | | | | | When no MAC address option is given, the MAC address of bst->primary_port is used to override the bridge device address. When the config changes and a new MAC address is provided in the config, bridge_reset_primary needs to stop overriding it Signed-off-by: Felix Fietkau <nbd@nbd.name>
* system-linux: cosmetic cleanupFelix Fietkau2016-11-041-1/+3
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* system-linux: check for open failureGünther Kelleter2016-11-041-0/+2
| | | | Signed-off-by: Günther Kelleter <guenther.kelleter@devolo.de>
* interface: Fix triggering of interface update eventHans Dedecker2016-11-043-8/+10
| | | | | | | | | | | | | | | | | In case the keep flag is set in proto_shell_update_link no interface update event is triggered when IPv4/6 addresses/routes/... are updated as the proto_event callback is not called due to keep being set. Unconditionally call the proto_event callback handler in proto_shell_update_link but let the proto_event callback handler; in this case interface_proto_event_cb, decide which actions need to be taken dependant on the interface state. In case the interface is already in the up state trigger an update event only if the interface updated flag actually indicates either an IP address/ route/data change; before interface update events were actually sent wihtout any parameter change. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* wireless: Call wireless_interface_handle_link before deleting the vifHans Dedecker2016-11-041-0/+1
| | | | | | | Similar as when updating a vif; call wireless_interface_handle_link removing the vif from the network when deleting a vif Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* bridge: Don't use device name as bridge member nameHans Dedecker2016-11-041-7/+12
| | | | | | | | | | | The bridge name is a copy of the device name; but the device name can change which is the case when an aliased interface is used as bridge member. This will result into unwanted side effects like bridge reload triggering a topology change effect after doing network reload; therefore use the configured ifname as fixed bridge member name. Also don't display bridge member devices which are hidden Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* proto-shell: add helpers for generic options in proto handlersMarcin Jurkowski2016-10-271-0/+13
| | | | | | | | Adding helpers for virtual interfaces generic options in ncm, qmi, mbim and directip protocols as suggested by Felix in https://lists.openwrt.org/pipermail/openwrt-devel/2016-February/039794.html Signed-off-by: Marcin Jurkowski <marcin1j@gmail.com>
* device: ignore MTU values below minimumFelix Fietkau2016-09-281-2/+2
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* device: Drop device down event during device release if device gets active againHans Dedecker2016-09-261-0/+4
| | | | | | | | | | | | Fixes a race condition as the device can be active again; due to a device_claim; by the logic behind the set_state device type function. In this case the down event cannot be sent anymore as it would bring down the interface(s) referencing the device. This can be the case for an aliased device when the underlying device is switched during a reload; the alias_set_device function can add a new dependency on the new active device which will put the aliased device in active mode again as the aliased device is already claimed by the interface using it. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* vlandev: Rework 8021ad/8021q detection based on vlandevice typeHans Dedecker2016-09-261-9/+4
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* vlandev: Register 8021ad and 8021q s device typesHans Dedecker2016-09-261-3/+14
| | | | | | Fixes creation of vlan 8021ad/8021q devices by UCI due to device handlers rework Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* tunnel: Use tunnel as device type nameHans Dedecker2016-09-261-1/+1
| | | | | | Fixes creation of tunnel devices by UCI due to device handlers rework Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* macvlan: Use macvlan as device type nameHans Dedecker2016-09-261-1/+1
| | | | | | Fixes creation of macvlan devices by UCI due to device handlers rework Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* bridge: Make bridge_device_type staticHans Dedecker2016-09-263-3/+2
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* device: Move the different device type registrations to the device type fileHans Dedecker2016-09-267-17/+26
| | | | | | While at it; make device_types static if only used in the device type file Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface-event: Don't dequeue hotplug event in case of interface reload eventHans Dedecker2016-09-141-1/+2
| | | | | | | | | | | | | | Dropping hotplug event in case of interface reload results into hotplug scripts not being being run for the interface and thus external actors not being informed about the actual state of the interface. This is clearly visible if the interface auto parameter is set to disabled for multiple interfaces resulting into no hotplug down event for all interfaces. Therefore don't flush the interface hotplug queue in case an interface reload event is observed. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface-ip: DNS name server sorting support in resolv.conf.autoHans Dedecker2016-09-144-13/+68
| | | | | | | | | | | | | | | | | | Interface name servers when being written to resolv.conf.auto are sorted based on the following parameters: -Primary sorting key is interface dns_metric; name servers having lowest interface dns_metric are listed first -Secondary sorting key is interface metric; in case of equal interface dns_metric name servers having lowest interface metric are listed first -Finally alphabetical order of the interface names in case of equal interface dns_metric and metric In case the resolver queries the multiple servers in the order listed; sorting is usefull in the following scenarios : -Name resolving over a main and backup interface -Assign priority to IPv6 name servers over IPv4 or vice versa Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* bridge: Allow setting multicast_fast_leave_optionHans Dedecker2016-09-143-0/+21
| | | | | | | | | | | | | | | | Setting the multicast_fast_leave option of a bridge allows to control the forwarding of multicast traffic when an IGMP/MLD leave is received. In case multicast_leave_option is enabled and a leave is received the multicast membership will immediately be dropped on the bridge port while in the other case the multicast membership will time out in the bridge. This could be usefull in scenarios where explicit multicast membership host tracking is not supported in the upstream network. In this case the multicast stream is still flowing after a leave is received resulting into possible bandwidth saturation on the lan if a new stream is joined as multiple multicast streams are received. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* device: add device handler listArne Kappen2016-08-264-21/+68
| | | | | | | | Device handlers now also declare if they have bridge capabilities and include a string to prefix device names for their types. Signed-off-by: Arne Kappen <akappen@inet.tu-berlin.de> Signed-off-by: Felix Fietkau <nbd@nbd.name> [cleanup/fixes]
* device: prepare for adding device handlers dynamicallyArne Kappen2016-08-2610-42/+53
| | | | | | | | - remove const from device handler struct - pass device handler type to create function Signed-off-by: Arne Kappen <akappen@inet.tu-berlin.de> Signed-off-by: Felix Fietkau <nbd@nbd.name> [cleanup]
* wireless: remove config_autostartEduardo Abinader2016-08-252-3/+1
| | | | | | just a cleanup for an unused member. Signed-off-by: Eduardo Abinader <eduardoabinader@gmail.com>
* wireless: add retry_setup_failed to status notificationEduardo Abinader2016-08-241-0/+1
| | | | | | | | As autostart is now more aligned to user intention of automatic starting the wdev, to add retry_setup_failed to status msg may be of a help for current stating how setup is proceeding. Signed-off-by: Eduardo Abinader <eduardoabinader@gmail.com>
* netifd: track when wdev setup failsEduardo Abinader2016-08-232-5/+14
| | | | | | | | | | | When netifd failed to load a valid configuration, after an invalid one, it was not possible to setup the wireless device. This patch aims to track this situation and behave acordingly, by keeping track of failed setup without affecting autostart behavior. Also block the restart of the wdev, when not applied. Signed-off-by: Eduardo Abinader <eduardoabinader@gmail.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* Prevent premature device free in interface_claim_deviceFelix Fietkau2016-08-111-0/+4
| | | | | | | | | | | interface_set_device_config can trigger a device free (for example if the device is here only present in a bridge), which renders dev invalid and leads to segfault. Add a lock to prevent this and clean-up the code for readability. Signed-off-by: Gino Peeters <peeters.gino@gmail.com> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* utils: Move IP address validation to parse_addr functionHans Dedecker2016-08-112-23/+16
| | | | | | | | | | | Commit 7a51f23e adds IP address validation in the function parse_ip_and_netmask; however the added check is too restrictive as the function is used on several places resulting into the problem multicast routes cannot be added anymore via UCI. Therefore move the IP host address validation to the function parse_addr so experimantal/multicast addresses cannot be added as a host IP address while multicast routes can be added again. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* proto: Display proto flags when dumping the protocol handlers in ubusHans Dedecker2016-08-111-0/+7
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* proto-shell: Model config parameter "no-proto-task" as a proto flagHans Dedecker2016-08-112-3/+4
| | | | | | | Export the config parameter "no-proto-task" as a proto flag so it's available for other other netifd modules Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* proto-shell: Support teardown on layer 3 link lossHans Dedecker2016-08-114-1/+9
| | | | | | | | | | | | | Commit c6858766 added interface teardown support on layer 3 device link loss mainly for shell protocols who have no proto task like xl2tp. However for shell protocols having a proto task it is not always the correct action to teardown the interface; as an example the PPP daemon can be put into persist state trying to re-establish the link via a hold-off mechanism if layer 3 link loss is detected. Therefore shell handlers can enable via TEARDOWN_ON_L3_LINK_DOWN a proto flag which will teardown the interface when layer 3 link loss is detected Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface: do not process hotplug events for link up eventFelix Fietkau2016-07-291-0/+4
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* interface: report link up events for force_link interfacesFelix Fietkau2016-07-293-3/+18
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>