summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* interface-ip: add unreachable route if address is offlinkopenwrt-19.07Hans Dedecker2021-01-201-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> (cherry picked from commit c00c8335d6188daa326ecfe5a62da15a9b9987e1)
* system-linux: fix resource leakHans Dedecker2019-08-051-4/+5
| | | | | | | Fix cb leak in case invalid type is specified in system_if_clear_entries Detected by Coverity in CID1431183 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: Coverity fixesHans Dedecker2019-07-221-8/+26
| | | | | | Fixes CID 1220430, 1432226, 1432807 and 1433508 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: fix xfrm interface deletion and standardize netlink callAndré Valentin2019-06-141-2/+3
| | | | | | | -xfrm interfaces were deleted before -use standard parameters for xfrm interface created Signed-off-by: André Valentin <avalentin@marcant.net>
* interface-ip: fix possible null pointer dereferenceHans Dedecker2019-06-131-2/+2
| | | | | | Reported by Coverity in CID 1445749 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: remove superfluous dev checkHans Dedecker2019-06-131-3/+0
| | | | | | | | | No need to check if dev is NULL as device is always set when system_neigh is called Fixes issue reported by Coverity in CID 1445818 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: add xfrm tunnel interface supportAndré Valentin2019-06-083-0/+76
| | | | | | | This adds support for xfrm interfaces. These interfaces can be used since linux 4.19 for IPsec traffic, like VTI interface. XFRM interfaces are less complicated compared to VTI because they need no IP tunnel endpoints.
* iprule: fix missing ip rules after a reload (FS#2296)Hans Dedecker2019-05-272-11/+38
| | | | | | | | | | | | | | | | Since commit 5cf79759a24e9bb2a6a3aef7c83d73efb9bf2df3 (iprule: rework interface based rules to handle dynamic interfaces) the rule comparison is broken and doesn't correctly recognize matching rules. This in turn break the reloading as adding the "new" rule fails because it already exists and it then delete the "old" rule. The comparison is broken because it now include fields that are not defining the rule itself, as well as some pointer to malloced strings. To fix this we move back the offending fields in the iprule struct before the 'flags' field and match the malloced strings separately. Signed-off-by: Alban Bedel <albeu@free.fr> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface-ip: use ptp address as well to find local address targetHans Dedecker2019-05-171-0/+4
| | | | | | | | | | | | | In case of tunnel over PPP(such as gretap over l2tp): tunnel interface use PPP's peer address as remote address, netifd script will call proto_add_host_dependency function, then netifd will search which device can reach to the remote address. Before the patch, netifd don't consider the PPP interface can reach to the remote address, so netifd will select default route to remote address, it will lead to remote address unreachable. Based on a patch by xiaofan <xfan1024@live.com> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* treewide: pass bool as second argument of blobmsg_check_attrHans Dedecker2019-05-164-6/+6
| | | | | | blobmsg_check_attr() takes as second argument a bool; fix it where needed Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface-ip: fine tune IPv6 mtu warningHans Dedecker2019-05-081-1/+1
| | | | | | | | Failing to set the IPv6 mtu is only a real issue if the mtu to be set is smaller than the current mtu as in that case it would break IPv6 path mtu; adapt the logic to generate the warning accordingly Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface: tidy ipv6 mtu warningKevin Darbyshire-Bryant2019-05-071-1/+1
| | | | | | | | | | | | Add missing space to change from: netifd: Failed to set IPv6 mtu to 1500on interface 'wg0' to: netifd: Failed to set IPv6 mtu to 1500 on interface 'wg0' Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
* system-linux: remove debug tracingHans Dedecker2019-04-151-3/+1
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface: add neighbor config supportmeurisa2019-04-1510-5/+388
| | | | | | | | | | | | | | | | | | The neighbor or neighbor6 network section makes neighbours configurable via UCI or proto shell handlers. It allows to install neighbor proxy entries or static neighbor entries The neighbor or neighbor6 section has the following types: interface : declares the logical OpenWrt interface ipaddr : the ip address of the neighbor mac : the mac address of the neighbor proxy : specifies whether the neighbor ia a proxy entry (can be 1 or 0) router : specifies whether the neighbor is a router (can be 1 or 0) Signed-off-by: Alexander Meuris <meurisalexander@gmail.com> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface: fix "if-down" hotplug event handlingMartin Schiller2019-04-121-0/+1
| | | | | | | | | commit a97297d83e42 ("interface: set interface in TEARDOWN state when checking link state") broke the if-down hotplug event handling, as the iface->state is now IFS_TEARDOWN when calling the mark_interface_down() function from the IFPEV_DOWN event. Fixes: a97297d83e42 ("interface: set interface in TEARDOWN state when checking link state") Signed-off-by: Martin Schiller <ms@dev.tdt.de>
* proto-shell: return error in case setup failsHans Dedecker2019-04-011-5/+0
| | | | | | | In case PROTO_CMD_SETUP cannot be handled due to an invalid state; return -1 so the calling functions are aware the PROTO_CMD_SETUP has failed. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface: set interface in TEARDOWN state when checking link stateHans dedecker2019-04-011-2/+2
| | | | | | | | | | | | | | When launching PROTO_CMD_TEARDOWN in interface_check_state() the interface was set in IFS_DOWN state. In case an interface is now brought into IFS_SETUP state in __interface_set_up() it will launch PROTO_CMD_SETUP trying to bring the proto shell handler in S_SETUP state which will fail as the proto shell handler is still in the S_TEARDOWN state. Fix this by setting the interface in IFS_TEARDOWN state when the PROTO_CMD_TEARDOWN event is launched which will prevent the interface being brought into IFS_SETUP state as long as it's not in the IFS_DOWN state. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: wireless: Add support for 802.11adRobert Marko2019-03-211-1/+1
| | | | | | This simple patch adds 802.11ad to hwmode list so that netifd-wireless.sh does not otherwise overwrite it with the default hwmode=g Signed-off-by: Robert Marko <robimarko@gmail.com>
* netifd: wireless: Add support for GCMP cipherRobert Marko2019-03-211-0/+1
| | | | | | | | This patch will add support for using GCMP as cipher suite. This is not a strong cipher but is only one supported by wil6210 driver in order to have encrypted traffic. Signed-off-by: Robert Marko <robimarko@gmail.com>
* interface-ip: fix delegate config update on reload (FS#2087)Hans Dedecker2019-03-133-1/+24
| | | | | | | | Update the no_delegation parameter on a config reload; in case prefixes are present update the prefix assignments as well according to the no_delegation status Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: handle hotplug event socket ENOBUFS errorsAlin Nastac2019-01-311-6/+47
| | | | | | | | | Hotplug events are no longer handled after socket RX queue is overrun. The issue has been fixed by: - setting SO_RCVBUF initially to 65535 - doubling SO_RCVBUF value each time RX queue gets overrun Signed-off-by: Alin Nastac <alin.nastac@gmail.com>
* proto: fix logic inversion in previous commitKevin Darbyshire-Bryant2018-12-171-1/+1
| | | | | | | | Rogue ! effectively disabled the ipv6 multicast check. Fix cd089c52 Why is it always the simple changes that catch you out? Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
* proto: Support class-e addressing in netifdDave Taht2018-12-161-5/+1
| | | | | | Signed-off-by: Dave Taht <dave.taht@gmail.com> Acked-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk> Acked-by: Jo-Philipp Wich <jo@mein.io>
* system-linux: get rid of SIOCSDEVPRIVATEHans Dedecker2018-12-131-19/+41
| | | | | | | | | | Use sysfs to configure the bridge settings stp/forward_delay/priority ageing_time/hello_time and max_age as the SIOCDEVPRIVATE bridge ioctl has no compat ioctl support which makes it impossible to set the above mentioned bridge paramaters if the kernel is compiled in 64 bit mode and user_space in 32 bit mode. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface: fix return code of __interface_add()Hans Dedecker2018-11-261-4/+2
| | | | | | | | For dynamic interfaces don't return false if vlist_find returns NULL as the calling function will try to free iface in case of an error which has already been freed in interface_change_config() Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: fix resource leak on error in netifd_add_dynamic()Hans Dedecker2018-11-261-4/+5
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* config: fix resource leaks on error in config_parse_interface()Hans Dedecker2018-11-261-1/+2
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface: fix memory leak on error in __interface_add()Hans Dedecker2018-11-261-1/+8
| | | | | | Detected by Coverity in cid 1441495 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* treewide: switch to C-code style commentsHans Dedecker2018-11-195-32/+36
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* treewide: make some functions staticHans Dedecker2018-11-197-11/+7
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface: fix removal of dynamic interfacesHans Dedecker2018-11-161-3/+13
| | | | | | | | | | | | | | Set config state to remove for dynamic interfaces in the following cases : -interface is set as not available -interface is set as down -interface is set as having no link state This will trigger an interface delete upon the next call of interface_handle_config_change Before this change you could end up with lingering inactive dynamic interfaces in case the aliased interface went down as before a dynamic interface was only removed when set down via ubus Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface: rework code to get rid of interface_set_dynamicHans Dedecker2018-11-134-28/+27
| | | | | | | Integrate dynamic interface creation code into interface_alloc and __interface_add so we can get rid of interface_set_dynamic Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: enable by default ignore encaplimit for grev6 tunnelsHans Dedecker2018-10-173-5/+27
| | | | | | | | Similar as for ip6 tunnels ignore encaplimit by default as not all ISPs support the destination option header containing the tunnel encapsulation limit resulting into broken connectivity Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: fix a typo in gre tunnel data parsing logicHans Dedecker2018-10-161-1/+1
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* wireless: Add WPA-EAP-SUITE-B-192 (WPA3-Enterprise)Hauke Mehrtens2018-10-121-1/+7
| | | | Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* wireless: Add Opportunistic Wireless Encryption (OWE)Hauke Mehrtens2018-10-121-1/+4
| | | | Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* wireless: Add Simultaneous Authentication of Equals (SAE)Hauke Mehrtens2018-10-121-1/+7
| | | | | | This adds PSK3 / SAE support. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* iprule: coding style fixesHans Dedecker2018-10-011-15/+16
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* iprule: fix segfault (FS#1875)Hans Dedecker2018-10-011-6/+2
| | | | | | | | | | | | Fix segfault in generic_interface_cb by checking the IPRULE_OUT/IPRULE_IN flags before doing the strcmp for the possible configured out/in interface(s) of the ip rule. Also don't copy the interface layer3 device as the layer 3 device is not yet known when IFEV_CREATE event is launched. The layer3 device will be known when the IFEV_UP event is processed in rule_out_cb/rule_in_cb. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* scripts: fix previous commitJo-Philipp Wich2018-09-191-1/+1
| | | | | | | Actually change the glob pattern as described in the previous commit. Fixes: 3c8ac1c ("netifd: fix wpa mixed mode matching") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* netifd: fix wpa mixed mode matchingRick Farina (Zero_Chaos)2018-09-191-1/+1
| | | | | | | | | | | | | Change wpa mixed mode matching to not accidently catch wep+mixed. All documented cases have the character between {wpa,psk} and mixed as a '-' but no need to break things which were working, so preserve the * case. Reported-by: "Rick Farina (Zero_Chaos)" <zerochaos@gentoo.org> [Allow "psk-mixed" to be prefixed, to align with the *psk2* and *psk* cases, slightly reword subject and commit message.] Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* system-linux: enable by default ignore encaplimit for ip6 tunnelsHans Dedecker2018-09-181-2/+5
| | | | | | | | | | | Enable ignore encaplimit by default for ip6 tunnels as not all ISPs support the destination option header containing the tunnel encapsulation limit resulting into broken map/ds-lite connectivity. Setting the ignore encaplimit flag by default is a more sane setting as it avoids user configuation of the encaplimit uci option for ds-lite/map tunnels in case of broken connectivity. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* CMakeList: Check that compiler supports -Wimplicit-fallthroughFlorian Fainelli2018-09-111-1/+11
| | | | | | | This is a GCC >= 7 feature, not all compilers support it. Fixes: 908a9f4f1027 ("CMakeLists.txt: add -Wimplicit-fallthrough to the compiler flags") Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
* interface: let interface_set_down() return voidHans Dedecker2018-08-202-4/+2
| | | | | | | Let interface_set_down() return void as no usefull error code is returned by __interface_set_down() Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface: make __interface_set_down() staticHans Dedecker2018-08-202-2/+1
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface: extend interface error messages in interface_set_up()Hans Dedecker2018-08-202-16/+20
| | | | | | | | Don't return an error code in interface_set_up as it's ignored anyway by the calling functions; but rather add more interface error messages so the actual problem is visible for the user by doing ifstatus <interface> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface: ensure NO_DEVICE error is always reportedHans Dedecker2018-08-171-2/+2
| | | | | | | | | Remove interface available checks in the functions interface_start_pending and interface_handle_config_change so the NO_DEVICE error is reported in ifstatus <interface> making it clear to the user the configured device in ifname is not found Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* device: gracefully handle device names exceeding IFNAMESIZHans Dedecker2018-08-149-21/+77
| | | | | | | | | | | | Instead of truncating the device name when it exceeds IFNAMSIZ length; let device_set_ifname return an error code and do not add the device to the device list. This avoids possible issues with device names becoming identical due the truncation and as a result unexpected behavior. Further let the different device types gracefully handle the error code returned by device_init Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface-ip: always override downstream IPv6 mtuHans Dedecker2018-08-071-2/+5
| | | | | | | | | | Always override the downstream IPv6 mtu in case it differs with the IPv6 mtu of the upstream link. This allows to increase the downstream IPv6 mtu in case RA messages are received on the upstream link having a mtu attribute higher than the downstream IPv6 mtu. At the same be verbose when failing to set the IPv6 mtu on the downstream link. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* fix compile errorJohn Crispin2018-07-301-1/+0
| | | | | | netifd-2018-07-30-75ee7905/interface-ip.c:724:11: error: unused variable 'macaddr' [-Werror=unused-variable] Signed-off-by: John Crispin <john@phrozen.org>