summaryrefslogtreecommitdiffhomepage
path: root/interface-ip.c
AgeCommit message (Collapse)Author
2016-02-01interface-ip: Fix possbile segfaultsHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-01-28netifd: Route traffic from LAN to WAN using rulesKristian Evensen
After commit ebd3d8417c7a ("interface: fix moving interface address routes to the table specified by ip[46]table"), it is no longer possible for clients on LAN to reach machines on the WAN. This patch restores support for clients on LAN reaching clients on WAN by using rules. The rules are placed after the address rules, in order to make sure that traffic originating from the router is routed correctly. Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
2016-01-17netifd: Do not add local/source policy rules multiple timesKristian Evensen
interface_ip_set_enabled() is usually called two times right after one another, once to handle config_ip and once to handle proto_ip. As long as ip->iface->l3_dev.dev is set, the local/source policy rules are updated. This value is in several cases set on both config_ip and proto_ip, causing the rules to be added multiple time. The reason is that the kernel does not respect the NLM_F_* flag for rules. In other words, the rule state has to be managed by the routing daemon. Since the local/source policy rules are bound to iface, this commit solves the problem by adding a flag to interface which stores the current rule state. The flag follows the enabled-paramter passed to interface_ip_set_enabled(), similar to route-> and addr->enabled. The flag breaks the alignment of the interface struct, but based on earlier commits this seems to be ok. I have tested the patch in different configurations and have not found any regression. Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
2015-12-16interface-ip: unify handling of interface metric/table for routes, fixes ↵Felix Fietkau
handling for prefixes Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-12-15interface-ip: fix subnet route handlingFelix Fietkau
When the kernel subnet route has to be replaced, the cleanup call needs to match the properties of the replacement route exactly, mainly the metric and the routing table. Fix handling this by embedding the device_route for the subnet in the device_addr struct and using it in the cleanup path. This fixes issues on config reload with changes to the routing table Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-11-12interface: fix moving interface address routes to the table specified by ↵Felix Fietkau
ip[46]table Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-09-29interface-ip: Remove table specific nw rules for IPv4/6 addressesHans Dedecker
2015-09-29interface-ip: Re-enable iif lo policy rules after main table lookupHans Dedecker
2015-09-29interface-ip: Support source ip rule updates when reloadingHans Dedecker
2015-09-26interface-ip: Fix broadcast address when using /31 or /32 IPv4 addressingBaptiste Jonglez
A /31-addressed interface requires a broadcast address of 255.255.255.255, because there is no room for a proper broadcast address. Without this, any packet destinated to the other end of the link is sent as broadcast, which is incorrect. For consistency with the Linux kernel, /32-addressed interfaces are treated in the same way. Signed-off-by: Baptiste Jonglez <git@bitsofnetworks.org>
2015-09-21netifd: Prevent flapping IPv6 routesKristian Evensen
Comparing valid_until will always return false as the value is updated for each route update message. This causes IPv6 routes to jump more around than House of Pain, which might have undesirable consequences for user-space and user-space applications. Removing the valid_until comparison when setting keep fixes this problem, and seems to have no side-effects. I am no IPv6 expert, but I see that valid of the route is updated correctly and route is deleted if I block the route update messages. Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
2015-09-10interface-ip: Set route table when enabling interface ip settingsHans Dedecker
Routes are now inserted in the correct routing table when interface ip4table and/or ip6table was changed during interface_change_config Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2015-09-10interface-ip: Don't create ip network rule if address mask is equal to full maskHans Dedecker
Prevents the creation of identical address and network IP rules Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2015-09-10interface-ip: Insert network and address ip rules for external addresses as wellHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2015-09-10interface-ip: Remove ip loop policy rules as kernel issue is fixedHans Dedecker
Remove ip loop policy rules as workaround for the kernel using unspecified address to lookup locally originating traffic is fixed by http://lkml.iu.edu/hypermail/linux/kernel/1505.0/03094.html Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2015-06-24Add mtu6 option to override IPv6 MTUSteven Barth
Signed-off-by: Steven Barth <steven@midlink.org>
2015-05-26linux: more IPv6 onlink-route handling fixes / improvementsSteven Barth
Signed-off-by: Steven Barth <steven@midlink.org>
2015-05-19ipv6: use kernel >= 3.14 handling of offlink-addressesSteven Barth
Signed-off-by: Steven Barth <steven@midlink.org>
2015-01-19netifd: Make interface identifier of delegated IPv6 address configurableHans Dedecker
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>
2014-10-24netifd : Apply interface metric on subnet routes when reloading ipHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2014-09-08ipv6: work around kernel on-link handling issueSteven Barth
Signed-off-by: Steven Barth <steven@midlink.org>
2014-08-13ipv6: assign prefixes with length <64 with /64 on-link routesSteven Barth
on-link routes for prefixes bigger than /64 make no sense and might confuse some users Signed-off-by: Steven Barth <steven@midlink.org>
2014-08-05netifd: fix incorrect number of bytes memset in clear_if_addrHans Dedecker
Fix clear_if_addr for IPv6 addresses as an incorrect number of bytes were memset due to wrong sizeof argument Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2014-06-20interface: don't store table id in route if the default table is usedSteven Barth
Use system_is_default_rt_table() to test whether the resolved routing table is the default one, in this case do not apply the table attribute to the route object. This is needed for backwards compatibility - only routes using a non-default table shall report it in the ifstatus output. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-06-18netifd: Route type supportHans Dedecker
Patch adds route type support in netifd by means of the route parameter type. By default the route type was unicast; the parameter adss support for local/broadcast/multicast/unicast routes which will be put into the appropriate routing table. If route type parameter is unset the route type will be unicast as before. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2014-06-10Add support for onlink-flags for IPv4 routesSteven Barth
Signed-off-by: Steven Barth <steven@midlink.org>
2014-05-09netifd: Effectively apply configured route mtuHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2014-05-09netifd: Remove useless route table parameter check in update_proto_routeHans Dedecker
Not necessary since route table parameter is used as key element in route_cmp Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2014-05-09netifd: Don't assume routes are always applied in all casesHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2014-04-29interface-ip: fix misuse of IN6_IS_ADDR_LINKLOCAL on a netifd specific unionFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-04-26netifd: Check rt_table parameter when comparing routesHans Dedecker
Allows to add identical routes in different routing tables Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2014-04-24netifd: Set prefix assignment enabled if the prefix adress can be installedHans Dedecker
No need to install policy routes if the prefix address cannot be installed; clean up of the policy routes and the prefix address only needs to happen when the prefix assignment was active. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2014-04-24netifd: fix IPv6 Link-local DNS serverUlrich Weber
interface name must be added to Link-local IPv6 DNS servers, otherwise they are unusable. Signed-off-by: Ulrich Weber <uw@ocedo.com>
2014-03-11netifd: Assign interface metric to route metric when route is createdHans Dedecker
Interface metric needs to be assigned to the route metric parameter at route creation time. Otherwise if the interface metric is different from 0 route_cmp will wrongly conclude the routes are different. In this case the route will be added/deleted and could end up with the route missing in the kernel depending on the add/delete order. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2014-02-26Don't always assume routes & addresses are appliedSteven Barth
Actually check netlink return values and remember failure. Signed-off-by: Steven Barth <steven@midlink.org>
2014-02-16IPv6: work around dangling routes kernel issueSteven Barth
2014-02-14Fix source-restrictions of routes when no mask was providedSteven Barth
2014-01-20Don't add unnecessary NOP policy rulesSteven Barth
2014-01-17Add indicator-flags to ubus and hotplug update-eventsSteven Barth
2013-12-11IPv6: Remove IPv6 source-routing workaround (kernel is fixed)Steven Barth
Signed-off-by: Steven Barth <steven@midlink.org>
2013-12-08netifd: Routing table parameter needs to be checked in route updateHans Dedecker
Routing table parameter needs to be checked in interface_update_proto_route; a route which has an identical nexthop but a different routing table needs to be deleted and added in the correct routing table. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2013-11-27IPv6: add class support to regular IPv6 addressesSteven Barth
2013-10-22utils: add a function for checking if a process given by pid is still aliveFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-18Add option "delegate" to toggle prefix delegationSteven Barth
2013-10-18Add source-restricted routesSteven Barth
2013-10-01Don't delete / readd IP addresses when only their lifetime has changedSteven Barth
2013-07-16IPv6: fix prefix assignment with continuous hintsSteven Barth
2013-06-17IPv6: Reverse assignment sorting orderSteven Barth
2013-06-17IPv6: Satisfy unhinted assignments ordered by prefix lengthSteven Barth
2013-06-10config: use the new uci_blob library codeFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>