summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* netifd: rework/fix device free handlingFelix Fietkau2021-09-279-76/+30
| | | | | | | | | Instead of explicitly preventing free in specific code sections using device_lock/device_unlock, defer all device free handling via uloop timeout This avoids an entire class of lurking use-after-free bugs triggered by device event processing and simplifies the code Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bonding: claim the port device before creating the bonding deviceFelix Fietkau2021-09-211-5/+6
| | | | | | Avoids create/destroy cycles of the bonding device if the port devices are unavailable Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: only enable proxyarp/isolate for AP vifsFelix Fietkau2021-09-201-3/+7
| | | | | | | | The settings might be present in the config as leftovers when switching a vif from AP to sta mode. In that case, they will not be applied by wpad, so they also must not be used by netifd Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: only apply wireless device attributes to the base vif interfaceFelix Fietkau2021-09-201-2/+2
| | | | | | | Per-station interfaces in 4-addr AP mode must not inherit them, because this can cause reflected packets by enabling hairpin mode. Signed-off-by: Felix Fietkau <nbd@nbd.name>
* device: add support for configuring bonding devicesFelix Fietkau2021-09-037-1/+914
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Supported options: - ports: member devices - policy: bonding policy supported values: - balance-rr - active-backup - balance-xor - broadcast - 802.3ad - balance-tlb - balance-alb - xmit_hash_policy: slave selection tx hash policy supported values: - layer2 - layer2+3 - layer3+4 - encap2+3 - encap3+4 - all_ports_active: allow receiving on inactive ports - min_links: minimum number of active links - ad_actor_system: LACPDU exchange MAC address - ad_actor_sys_prio: LACPDU priority value - ad_select: 802.3ad aggregation logic supported values: - stable - bandwidth - count - lacp_rate: 802.3ad LACPDU packet rate supported values: - slow (every 30 seconds) - fast (every second) - packets_per_port: number of packets before switching ports (balance-rr mode). - lp_interval: number of seconds between sent learning packets - dynamic_lb: distribute traffic according to port load - resend_igmp: number if IGMP membership updates after failover event - num_peer_notif: number of tx unsolicited ARP/NA after failover event - primary: name of the primary port - primary_reselect: primary port reselection policy supported values: - always - better - failure - failover_mac: MAC address selection policy supported values: - none - active - follow - monitor_mode: select ARP or MII link monitor: supported values: - arp - mii - monitor_interval: link monitor update interval (msec) - arp_target: ARP monitor target IP address (list) - arp_all_targets: all targets must be reachable to consider the link valid - arp_validate: ARP validation policy supported values: - none - active - backup - all - filter - filter_active - filter_backup - use_carrier: use carrier status instead of MII ioctl result - updelay: delay before enabling port after MII link up event (msec) - downdelay: delay before disabling port after MII link down event (msec) Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: improve reliability of proxyarp supportFelix Fietkau2021-09-015-4/+20
| | | | | | | | instead of relying on hostapd to manipulate bridge attributes (which can race against netifd adding/removing of member ports), set the proxyarp related attributes in netifd directly when bringing up the member port Signed-off-by: Felix Fietkau <nbd@nbd.name>
* system-linux: remove copy&paste from /proc and /sys path namesFelix Fietkau2021-09-011-140/+149
| | | | | | | Preparation for making the /proc and /sys path configurable for configuring containers Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: always enable bpdu filter for AP interfaces and VLANsFelix Fietkau2021-08-273-0/+11
| | | | | | | | | | Regular AP/VLAN interfaces using 3-address modes should transmit any STP packets, since devices behind them can not be part of any working bridge topology. Enable a feature that drops any incoming or outgoing STP packets. This does not apply to WDS AP VLAN or client mode interfaces, since they could act as a proper bridge link Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bridge: tune default stp parametersFelix Fietkau2021-08-243-28/+19
| | | | | | | | | | The default forwarding delay 2 is broken and makes STP non-functional by default. The kernel's default of 15 is rather long. This commit changes makes the timer settings more aggressive than the kernel's default while still being consistent and allowing proper convergence for a network diameter up to 4 Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bridge: add support for an external STP daemonFelix Fietkau2021-08-248-3/+94
| | | | | | | | netifd notifies the stp daemon through the network.device object and sends STP related configuration parameters. The daemon can also trigger a STP restart in order to close the race on init Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bridge: memset bst->config by default to avoid stale config valuesFelix Fietkau2021-08-241-0/+1
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* device: add support for configuring device link speed/duplexFelix Fietkau2021-08-023-0/+72
| | | | | | | The 'speed' option can be set to the speed in Mbps The 'duplex' option can be 1 or 0 for full or half duplex Signed-off-by: Felix Fietkau <nbd@nbd.name>
* device: extend device settings flags to 64 bitFelix Fietkau2021-07-294-35/+35
| | | | | | The previous 32 bit limit is almost used up Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bridge: fix regression in bringing up bridge portsFelix Fietkau2021-07-261-4/+5
| | | | | | | | Move the DEV_EVENT_LINK_UP case to avoid messing with a fallthrough Only restart members if the vlan check returns a positive result Fixes: 85f01c44a950 ("bridge: check bridge port vlan membership on link-up events") Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: add back regular virtual interfaces on hotplug-add events as wellFelix Fietkau2021-07-231-5/+8
| | | | | | | When hostapd does a DFS channel switch, it tears down all vifs except for the primary one, which causes them got get dropped from the device configuration Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bridge: check bridge port vlan membership on link-up eventsFelix Fietkau2021-07-235-5/+225
| | | | | | | | When changing to a dfs channel, hostapd can bring down wlan interfaces and reset their bridge membership. If that happens, the port loses its vlan membership settings and needs to be reconfigured by netifd. Signed-off-by: Felix Fietkau <nbd@nbd.name>
* vlan: fix device vlan alias handlingFelix Fietkau2021-07-141-8/+23
| | | | | | | | | | | | A recent commit changed the vlan chain handling to not treat devices with non-digit characters after "." as vlan devices. This broke aliases, which rely on names after the "." component. Fix dealing with both cases by first trying to set up a vlan regardless of the non-digit characters, but for the first component allow falling back to treating the first two parts as a full device name Fixes: 013a1171e9b0 ("device: do not treat devices with non-digit characters after . as vlan devices") Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bridge: fix hotplug vlan overwrite on big-endian systemsFelix Fietkau2021-07-131-1/+1
| | | | | | | | The avl key type for bridge vlans is uint16_t, so any lookup with a wider type is going to fail on big-endian systems This resulted in hotplug-added devices replacing configured member ports Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bridge: bring up pre-existing vlans on hotplug as wellFelix Fietkau2021-06-231-5/+5
| | | | | | When adding a member to an existing VLAN, it needs to be updated as well Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bridge: fix enabling hotplug-added VLANs on the bridge portFelix Fietkau2021-06-221-0/+5
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: handle WDS per-sta devicesFelix Fietkau2021-06-193-7/+44
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* device: do not treat devices with non-digit characters after . as vlan devicesFelix Fietkau2021-06-193-16/+24
| | | | | | Fixes corner cases related to AP WDS station interfaces Signed-off-by: Felix Fietkau <nbd@nbd.name>
* examples: make dummy wireless vif names shorterFelix Fietkau2021-06-191-1/+4
| | | | | | avoids running into ifname size limits Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ubus: add a dummy mode ubus call to simulate hotplug eventsFelix Fietkau2021-06-191-0/+36
| | | | | | Can be used to test the device hotplug handling Signed-off-by: Felix Fietkau <nbd@nbd.name>
* device: move hotplug handling logic from system-linux.c to device.cFelix Fietkau2021-06-193-34/+18
| | | | | | Preparation for dealing with wifi per-station devices Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bridge: fix setting pvid for updated vlansFelix Fietkau2021-06-173-1/+23
| | | | | | defer adding back changed vlans until config processing is done Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: add some comments to functionsAlexander Couzens2021-06-081-0/+42
| | | | Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
* bridge: allow adding/removing VLANs to configured member ports via hotplugFelix Fietkau2021-06-046-27/+80
| | | | | | | This is useful for a dynamic VLAN setup, where extra tags need to be created on the trunking port on demand Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: pass the real network ifname to the setup scriptFelix Fietkau2021-06-042-1/+4
| | | | | | | If the network ifname is a VLAN on top of a VLAN-filtering bridge, hostapd needs to know the VLAN ifname to communicate with other APs, if 802.11r is enabled. Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bridge: fix dynamic delete of hotplug vlansFelix Fietkau2021-06-021-1/+3
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bridge: dynamically create vlans for hotplug membersFelix Fietkau2021-06-021-1/+28
| | | | | | This makes it possible to use dynamic tags without changing the configuration Signed-off-by: Felix Fietkau <nbd@nbd.name>
* interface: support "device" attribute and deprecate "ifname"Rafał Miłecki2021-05-262-11/+16
| | | | | | | | | | | | | | | | | | | | | Interfaces need to be assigned to devices. For that purpose a "device" option should be more accurate than "ifname" one. For backward compatibility old option remains supported too. Config example: config device option name 'br-lan' option type 'bridge' list ports 'lan1' list ports 'lan2' config interface 'lan' option device 'br-lan' option proto 'static' Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* scripts/netifd-wireless.sh: add support for specifying the operating bandFelix Fietkau2021-05-241-14/+14
| | | | | | Add the new 'band' option, which supports the following values: 2g, 5g, 6g, 60g Signed-off-by: Felix Fietkau <nbd@nbd.name>
* config: fix ifname->ports compat renameFelix Fietkau2021-05-201-4/+11
| | | | | | | Instead of looking it up as a string, use uci_rename. That way it works both on list and string options Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bridge: rename "ifname" attribute to "ports"Rafał Miłecki2021-05-182-9/+30
| | | | | | | | | | | | | | Bridge aggregates multiple ports so use a more accurate name ("ports"). For backward compatibility add a temporary config translation. Config example: config interface 'lan' option type 'bridge' list ports 'lan1' list ports 'lan2' Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* wireless: fix memory corruption bug when using vlans/station entries in the ↵Felix Fietkau2021-05-181-1/+2
| | | | | | | | | | | config On config reload, any vif entries in the config added to the vlist will be matched against existing ones, and the old entries preserved. This means that the vif pointer is no longer valid after vlist_add. Look up the vif again before using it for vlan/station entries. Signed-off-by: Felix Fietkau <nbd@nbd.name>
* device: add support for configuring devices with external auth handlerFelix Fietkau2021-05-175-23/+113
| | | | | | | | | | | This can be used to support 802.1x on wired devices. In order to use this, the device section for each port needing authentication needs to contain the option auth 1 When set, this option prevents devices from being added to bridges or configured with IP settings by default, until the set_state ubus call on network.device sets "auth_status" to true for the device. Signed-off-by: Felix Fietkau <nbd@nbd.name>
* extdev: remove unused functionFelix Fietkau2021-05-161-7/+0
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* fix unannotated fall-through warningsFelix Fietkau2021-05-162-4/+5
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* netifd: add possibility to switch off route configFlorian Eckert2021-04-031-0/+5
| | | | | | | | | | | | This change adds the new configuration option `disabled` for the route section, which can be used to temporarily disable the section so that the route is not set. The advantage is that we do not have to delete this route configuration section to achieve this. config route option disabled '1 Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* netifd: bridge: set default value for igmp_snoopZheng Qian2021-04-031-0/+2
| | | | | | | | | | | | | | When unchecked the igmp snoop option for a bridge by luci, it just delete the igmp_snooping key from the config file. So netifd can't change /sys/devices/virtual/net/br-lan/bridge/multicast_snooping from "1" to "0". Option multicast_querier seems no input entry in luci, but it's an related option. This patch will set a default value to false for the bridge option to fix this bug. Signed-off-by: Zheng Qian <sotux82@gmail.com>
* system-linux: add device options used by wpadDaniel Golle2021-03-313-0/+156
| | | | | | | | | | | | | Add device options used by wpad in preparation of running hostapd and wpa_supplicant non-root (and hence those options will need to be taken care of by netifd as sysctl is root-only): * drop_v4_unicast_in_l2_multicast * drop_v6_unicast_in_l2_multicast * drop_gratuitous_arp * drop_unsolicited_na * arp_accept Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* system-linux: reorder sysctl functionsDaniel Golle2021-03-311-5/+5
| | | | | | | Move system_set_sendredirects up to the other non-bridge-related sysctl functions. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* extdev: add support for external device handlersArne Kappen2021-03-316-1/+1417
| | | | | | | | | | This allows to integrate external daemons that configure network devices with netifd. At startup, netifd generates device handler stubs from descriptions in /lib/netifd/extdev-config via the mechanism in handler.c. These are then added to the list of device handlers. Device handlers stubs act as relays forwarding calls against the device handler interface to the external daemon. Signed-off-by: Arne Kappen <arne.kappen@hhi.fraunhofer.de>
* handler: add mechanism to generate external device handler stubsArne Kappen2021-03-312-0/+119
| | | | | | | | | | | | | | | Parse JSON files in a given directory and pass the information on to a callback function for creation of an external device handler stub. The description contains: - 'name': the name of the device type, - 'ubus_name': the name of the external device handler daemon on ubus, - 'bridge': a flag indicating whether the devices are bridge-like, - optionally 'br_prefix': a prefix for created devices (only for bridge-like, defaults to type name), - 'config': the UCI config options for devices of this type, and - optionally 'info' and 'stats': the format of calls to info() and dump(). Signed-off-by: Arne Kappen <arne.kappen@hhi.fraunhofer.de>
* device: remove left-over commentArne Kappen2021-03-311-3/+0
| | | | Signed-off-by: Arne Kappen <arne.kappen@hhi.fraunhofer.de>
* interface-ip: add unreachable route if address is offlinkHans Dedecker2021-01-111-0/+69
| | | | | | | | | | | | | | | | | | | In order to avoid a routing loop add an unreachable route for the address prefix is the offlink flag is set for an address. This fixes a routing loop which is currently present on point-to-point links (e.g PPP) when the wan interface is assigned a globally unique prefix (e.g. 2001:db8:1:0::/64) from which an IPv6 address is picked and installed on the wan interface (e.g. 2001:db8:1:0:5054:ff:feab:d87c/64) The prefix route 2001:db8:1::/64 would be present in the routing table which will route any packet with as destination 2001:db8:1::/64 to the wan interface and would be routed back by the upstream router due to the wan interface due to the assigned global unique prefix. Besides not installing the prefix route 2001:db8:1::/64 on point-to-point links adding an unreachable route is required to avoid the routing loop. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface-ip: coding style fixesHans Dedecker2021-01-091-1/+2
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: wireless: default to GCMP WPA cipher on 802.11adDaniel Golle2021-01-051-1/+7
| | | | Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* wireless: add support for not killing processes on teardownFelix Fietkau2020-12-283-1/+8
| | | | | | | When using a global hostapd/wpa_supplicant instance, it should not be killed if a single radio is torn down Signed-off-by: Felix Fietkau <nbd@nbd.name>