summaryrefslogtreecommitdiff
path: root/packages/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch
diff options
context:
space:
mode:
Diffstat (limited to 'packages/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch')
-rw-r--r--packages/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch93
1 files changed, 44 insertions, 49 deletions
diff --git a/packages/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch b/packages/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch
index 2be1a3c8..b28f255e 100644
--- a/packages/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch
+++ b/packages/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch
@@ -1,4 +1,4 @@
-From 388b9bc4dc78cbc83c6476d765f6e0c3d3ed1fb4 Mon Sep 17 00:00:00 2001
+From 81d38c4a32e059ad7835f7dc254e7627642afbe9 Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Mon, 29 Apr 2013 18:50:15 -0700
Subject: [PATCH] VyOS: Add linkstate IP device attribute
@@ -8,133 +8,129 @@ Backport of earlier Vyatta patch.
(cherry picked from commit 7c5a851086686be14ae937c80d6cee34814dbefc)
---
- Documentation/networking/ip-sysctl.txt | 13 +++++++++++++
+ Documentation/networking/ip-sysctl.rst | 11 +++++++++++
include/linux/inetdevice.h | 1 +
include/linux/ipv6.h | 1 +
include/uapi/linux/ip.h | 1 +
include/uapi/linux/ipv6.h | 1 +
- net/ipv4/devinet.c | 2 ++
- net/ipv6/addrconf.c | 9 +++++++++
- net/ipv6/route.c | 11 +++++++++++
- 8 files changed, 39 insertions(+)
+ net/ipv4/devinet.c | 1 +
+ net/ipv6/addrconf.c | 8 ++++++++
+ net/ipv6/route.c | 10 ++++++++++
+ 8 files changed, 34 insertions(+)
-diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
-index 8af3771a3ebf..93408cc52991 100644
---- a/Documentation/networking/ip-sysctl.txt
-+++ b/Documentation/networking/ip-sysctl.txt
-@@ -1245,6 +1245,19 @@ rp_filter - INTEGER
+diff --git a/Documentation/networking/ip-sysctl.rst b/Documentation/networking/ip-sysctl.rst
+index 25e6673a085a..4cd1134d3aac 100644
+--- a/Documentation/networking/ip-sysctl.rst
++++ b/Documentation/networking/ip-sysctl.rst
+@@ -1425,6 +1425,17 @@ rp_filter - INTEGER
Default value is 0. Note that some distributions enable it
in startup scripts.
+link_filter - INTEGER
-+ 0 - Allow packets to be received for the address on this interface
-+ even if interface is disabled or no carrier.
-+
++ 0 - Allow packets to be received for the address on this interface
++ even if interface is disabled or no carrier.
+ 1 - Ignore packets received if interface associated with the incoming
-+ address is down.
-+
++ address is down.
+ 2 - Ignore packets received if interface associated with the incoming
-+ address is down or has no carrier.
++ address is down or has no carrier.
+
+ Default value is 0. Note that some distributions enable it
+ in startup scripts.
+
arp_filter - BOOLEAN
- 1 - Allows you to have multiple network interfaces on the same
- subnet, and have the ARPs for each interface be answered
+ - 1 - Allows you to have multiple network interfaces on the same
+ subnet, and have the ARPs for each interface be answered
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
-index 3515ca64e638..dcae58193580 100644
+index 3515ca64e638..bfb49b5913e7 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -133,6 +133,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
#define IN_DEV_ARP_ANNOUNCE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_ANNOUNCE)
#define IN_DEV_ARP_IGNORE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_IGNORE)
#define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY)
-+#define IN_DEV_LINKFILTER(in_dev) IN_DEV_MAXCONF((in_dev), LINKFILTER)
++#define IN_DEV_LINKFILTER(in_dev) IN_DEV_MAXCONF((in_dev), LINKFILTER)
struct in_ifaddr {
struct hlist_node hash;
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
-index ea7c7906591e..57f656ea2783 100644
+index dda61d150a13..9d96b27ec350 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
-@@ -76,6 +76,7 @@ struct ipv6_devconf {
- __s32 ndisc_tclass;
+@@ -77,6 +77,7 @@ struct ipv6_devconf {
+ __s32 rpl_seg_enabled;
struct ctl_table_header *sysctl_header;
-+ __s32 link_filter; /* VyOS */
++ __s32 link_filter;
};
struct ipv6_params {
diff --git a/include/uapi/linux/ip.h b/include/uapi/linux/ip.h
-index e42d13b55cf3..baf8e77c201b 100644
+index e42d13b55cf3..8f5291976f04 100644
--- a/include/uapi/linux/ip.h
+++ b/include/uapi/linux/ip.h
@@ -169,6 +169,7 @@ enum
IPV4_DEVCONF_DROP_UNICAST_IN_L2_MULTICAST,
IPV4_DEVCONF_DROP_GRATUITOUS_ARP,
IPV4_DEVCONF_BC_FORWARDING,
-+ IPV4_DEVCONF_LINKFILTER, /* VyOS only */
++ IPV4_DEVCONF_LINKFILTER,
__IPV4_DEVCONF_MAX
};
diff --git a/include/uapi/linux/ipv6.h b/include/uapi/linux/ipv6.h
-index 9c0f4a92bcff..619edd130cfd 100644
+index 13e8751bf24a..2ea26a70bda2 100644
--- a/include/uapi/linux/ipv6.h
+++ b/include/uapi/linux/ipv6.h
-@@ -187,6 +187,7 @@ enum {
- DEVCONF_DISABLE_POLICY,
+@@ -189,6 +189,7 @@ enum {
DEVCONF_ACCEPT_RA_RT_INFO_MIN_PLEN,
DEVCONF_NDISC_TCLASS,
+ DEVCONF_RPL_SEG_ENABLED,
+ DEVCONF_LINK_FILTER,
DEVCONF_MAX
};
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
-index a27d034c85cc..b62b62abe907 100644
+index 123a6d39438f..1deb400805b0 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
-@@ -2550,6 +2550,8 @@ static struct devinet_sysctl_table {
+@@ -2547,6 +2547,7 @@ static struct devinet_sysctl_table {
"route_localnet"),
DEVINET_SYSCTL_FLUSHING_ENTRY(DROP_UNICAST_IN_L2_MULTICAST,
"drop_unicast_in_l2_multicast"),
-+ /* VyOS */
+ DEVINET_SYSCTL_RW_ENTRY(LINKFILTER, "link_filter"),
},
};
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
-index 635b2482fa20..ce1405ecf6f6 100644
+index 8b6eb384bac7..176a914acfee 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
-@@ -5477,6 +5477,7 @@ static inline void ipv6_store_devconf(struct ipv6_devconf *cnf,
- array[DEVCONF_ADDR_GEN_MODE] = cnf->addr_gen_mode;
+@@ -5516,6 +5516,7 @@ static inline void ipv6_store_devconf(struct ipv6_devconf *cnf,
array[DEVCONF_DISABLE_POLICY] = cnf->disable_policy;
array[DEVCONF_NDISC_TCLASS] = cnf->ndisc_tclass;
+ array[DEVCONF_RPL_SEG_ENABLED] = cnf->rpl_seg_enabled;
+ array[DEVCONF_LINK_FILTER] = cnf->link_filter;
}
static inline size_t inet6_ifla6_size(void)
-@@ -6849,6 +6850,14 @@ static const struct ctl_table addrconf_sysctl[] = {
- .mode = 0644,
- .proc_handler = addrconf_sysctl_disable_policy,
+@@ -6896,6 +6897,13 @@ static const struct ctl_table addrconf_sysctl[] = {
+ .mode = 0644,
+ .proc_handler = proc_dointvec,
},
-+ /* VyOS */
+ {
+ .procname = "link_filter",
+ .data = &ipv6_devconf.link_filter,
+ .maxlen = sizeof(int),
+ .mode = 0644,
-+ .proc_handler = proc_dointvec
-+ },
++ .proc_handler = proc_dointvec,
++ },
{
- .procname = "ndisc_tclass",
- .data = &ipv6_devconf.ndisc_tclass,
+ /* sentinel */
+ }
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
-index 46df6345bb99..2b930a2c4fdb 100644
+index 7e0ce7af8234..c4ef9f4d40e1 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
-@@ -686,6 +686,15 @@ static inline void rt6_probe(struct fib6_nh *fib6_nh)
+@@ -687,6 +687,14 @@ static inline void rt6_probe(struct fib6_nh *fib6_nh)
}
#endif
@@ -142,15 +138,14 @@ index 46df6345bb99..2b930a2c4fdb 100644
+{
+ const struct net_device *dev = nh->fib_nh_dev;
+ int linkf = __in6_dev_get(dev)->cnf.link_filter;
-+
+ return (linkf && !netif_running(dev))
-+ || (linkf > 1 && !netif_carrier_ok(dev));
++ || (linkf > 1 && !netif_carrier_ok(dev));
+}
+
/*
* Default Router Selection (RFC 2461 6.3.6)
*/
-@@ -727,6 +736,8 @@ static int rt6_score_route(const struct fib6_nh *nh, u32 fib6_flags, int oif,
+@@ -728,6 +736,8 @@ static int rt6_score_route(const struct fib6_nh *nh, u32 fib6_flags, int oif,
if (!m && (strict & RT6_LOOKUP_F_IFACE))
return RT6_NUD_FAIL_HARD;