summaryrefslogtreecommitdiff
path: root/scripts/package-build/linux-kernel/patches/kernel
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2024-08-26 15:21:14 +0000
committerViacheslav Hletenko <v.gletenko@vyos.io>2024-08-29 09:30:52 +0000
commitcc7d0993b420c3245e628a818f887411d72530ff (patch)
tree53fd8ab2b5dea74c1f7969b8ff853179d81f8fec /scripts/package-build/linux-kernel/patches/kernel
parent70bb3c5baacb6e0c72b9532f6dda417d395a6bc0 (diff)
downloadvyos-build-cc7d0993b420c3245e628a818f887411d72530ff.tar.gz
vyos-build-cc7d0993b420c3245e628a818f887411d72530ff.zip
T6674: Add build-scrips for packages without Jenkins
Add build scripts for .deb packages without Jenkins. To exclude Jenkins we need some place where we can put new builds-scripts to run in parallel (old/new) during meantime We will deprecate old Jenkins package builds in the future.
Diffstat (limited to 'scripts/package-build/linux-kernel/patches/kernel')
-rw-r--r--scripts/package-build/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch158
-rw-r--r--scripts/package-build/linux-kernel/patches/kernel/0002-inotify-support-for-stackable-filesystems.patch298
2 files changed, 456 insertions, 0 deletions
diff --git a/scripts/package-build/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch b/scripts/package-build/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch
new file mode 100644
index 00000000..bedcec6e
--- /dev/null
+++ b/scripts/package-build/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch
@@ -0,0 +1,158 @@
+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
+
+Backport of earlier Vyatta patch.
+
+(cherry picked from commit 7c5a851086686be14ae937c80d6cee34814dbefc)
+---
+ 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 | 1 +
+ net/ipv6/addrconf.c | 8 ++++++++
+ net/ipv6/route.c | 10 ++++++++++
+ 8 files changed, 34 insertions(+)
+
+diff --git a/Documentation/networking/ip-sysctl.rst b/Documentation/networking/ip-sysctl.rst
+index a66054d0763a..53440098fa98 100644
+--- a/Documentation/networking/ip-sysctl.rst
++++ b/Documentation/networking/ip-sysctl.rst
+@@ -1734,6 +1734,17 @@ src_valid_mark - BOOLEAN
+
+ Default value is 0.
+
++link_filter - INTEGER
++ 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.
++ 2 - Ignore packets received if interface associated with the incoming
++ 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
+diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
+index ddb27fc0ee8c..8ee3191d9558 100644
+--- a/include/linux/inetdevice.h
++++ b/include/linux/inetdevice.h
+@@ -137,6 +137,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
+ #define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY)
+ #define IN_DEV_ARP_EVICT_NOCARRIER(in_dev) IN_DEV_ANDCONF((in_dev), \
+ ARP_EVICT_NOCARRIER)
++#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 af8a771a053c..ece8ac89d317 100644
+--- a/include/linux/ipv6.h
++++ b/include/linux/ipv6.h
+@@ -84,6 +84,7 @@ struct ipv6_devconf {
+ __u8 ndisc_evict_nocarrier;
+
+ struct ctl_table_header *sysctl_header;
++ __s32 link_filter;
+ };
+
+ struct ipv6_params {
+diff --git a/include/uapi/linux/ip.h b/include/uapi/linux/ip.h
+index 283dec7e3645..8067941a635e 100644
+--- a/include/uapi/linux/ip.h
++++ b/include/uapi/linux/ip.h
+@@ -173,6 +173,7 @@ enum
+ IPV4_DEVCONF_DROP_GRATUITOUS_ARP,
+ IPV4_DEVCONF_BC_FORWARDING,
+ IPV4_DEVCONF_ARP_EVICT_NOCARRIER,
++ IPV4_DEVCONF_LINKFILTER,
+ __IPV4_DEVCONF_MAX
+ };
+
+diff --git a/include/uapi/linux/ipv6.h b/include/uapi/linux/ipv6.h
+index cf592d7b630f..e8915701aa73 100644
+--- a/include/uapi/linux/ipv6.h
++++ b/include/uapi/linux/ipv6.h
+@@ -199,6 +199,7 @@ enum {
+ DEVCONF_NDISC_EVICT_NOCARRIER,
+ DEVCONF_ACCEPT_UNTRACKED_NA,
+ DEVCONF_ACCEPT_RA_MIN_LFT,
++ DEVCONF_LINK_FILTER,
+ DEVCONF_MAX
+ };
+
+diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
+index bc74f131fe4d..9cdd5b50f9b2 100644
+--- a/net/ipv4/devinet.c
++++ b/net/ipv4/devinet.c
+@@ -2595,6 +2595,7 @@ static struct devinet_sysctl_table {
+ "route_localnet"),
+ DEVINET_SYSCTL_FLUSHING_ENTRY(DROP_UNICAST_IN_L2_MULTICAST,
+ "drop_unicast_in_l2_multicast"),
++ DEVINET_SYSCTL_RW_ENTRY(LINKFILTER, "link_filter"),
+ },
+ };
+
+diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
+index a9358c796a81..7e39846f556b 100644
+--- a/net/ipv6/addrconf.c
++++ b/net/ipv6/addrconf.c
+@@ -5657,6 +5657,7 @@ static inline void ipv6_store_devconf(struct ipv6_devconf *cnf,
+ array[DEVCONF_NDISC_EVICT_NOCARRIER] = cnf->ndisc_evict_nocarrier;
+ array[DEVCONF_ACCEPT_UNTRACKED_NA] = cnf->accept_untracked_na;
+ array[DEVCONF_ACCEPT_RA_MIN_LFT] = cnf->accept_ra_min_lft;
++ array[DEVCONF_LINK_FILTER] = cnf->link_filter;
+ }
+
+ static inline size_t inet6_ifla6_size(void)
+@@ -7086,6 +7087,13 @@ static const struct ctl_table addrconf_sysctl[] = {
+ .extra1 = (void *)SYSCTL_ZERO,
+ .extra2 = (void *)SYSCTL_ONE,
+ },
++ {
++ .procname = "link_filter",
++ .data = &ipv6_devconf.link_filter,
++ .maxlen = sizeof(int),
++ .mode = 0644,
++ .proc_handler = proc_dointvec,
++ },
+ {
+ .procname = "ioam6_id",
+ .data = &ipv6_devconf.ioam6_id,
+diff --git a/net/ipv6/route.c b/net/ipv6/route.c
+index eb3afaee62e8..0f8670e74cc7 100644
+--- a/net/ipv6/route.c
++++ b/net/ipv6/route.c
+@@ -679,6 +679,14 @@ static inline void rt6_probe(struct fib6_nh *fib6_nh)
+ }
+ #endif
+
++static inline int rt6_link_filter(const struct fib6_nh *nh)
++{
++ 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));
++}
++
+ /*
+ * Default Router Selection (RFC 2461 6.3.6)
+ */
+@@ -720,6 +728,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;
++ if (rt6_link_filter(nh))
++ return -1;
+ #ifdef CONFIG_IPV6_ROUTER_PREF
+ m |= IPV6_DECODE_PREF(IPV6_EXTRACT_PREF(fib6_flags)) << 2;
+ #endif
+--
+2.39.2
+
diff --git a/scripts/package-build/linux-kernel/patches/kernel/0002-inotify-support-for-stackable-filesystems.patch b/scripts/package-build/linux-kernel/patches/kernel/0002-inotify-support-for-stackable-filesystems.patch
new file mode 100644
index 00000000..b19a8d25
--- /dev/null
+++ b/scripts/package-build/linux-kernel/patches/kernel/0002-inotify-support-for-stackable-filesystems.patch
@@ -0,0 +1,298 @@
+From 1d625d2f745b61a718ce52cd1729f467c17defa6 Mon Sep 17 00:00:00 2001
+From: Alex Harpin <development@landsofshadow.co.uk>
+Date: Wed, 31 Dec 2014 10:33:38 +0000
+Subject: [PATCH] VyOS: add inotify support for stackable filesystems
+ (overlayfs)
+
+As it stands at the moment, overlayfs doesn't have full support for
+inotify, and as such anything that relies on inotify currently has
+issues. The simplest method of demonstrating this is to tail a file
+(so tail -f /var/log/messages) and see that it doesn't follow changes
+in that file. This has been reported in a number of places, including
+Bug #882147 in Ubuntu. This patch is based on the version proposed by
+Li Jianguo in response to this bug, adding support for inotify in
+stackable filesystems.
+
+This commit provides a complete fix for the workaround implemented
+for bug #303, and will allow that commit to be reverted.
+
+Bug #425 http://bugzilla.vyos.net/show_bug.cgi?id=425
+
+(cherry picked from commit a93f1128bc83b5a6628da242e71c18ef05e81ea2)
+---
+ fs/notify/inotify/Kconfig | 9 +++
+ fs/notify/inotify/inotify_user.c | 114 ++++++++++++++++++++++++++++++-
+ fs/overlayfs/super.c | 27 ++++++--
+ include/linux/inotify.h | 28 ++++++++
+ 4 files changed, 172 insertions(+), 6 deletions(-)
+
+diff --git a/fs/notify/inotify/Kconfig b/fs/notify/inotify/Kconfig
+index 1cc8be25df7e..bc4acd1a6ea4 100644
+--- a/fs/notify/inotify/Kconfig
++++ b/fs/notify/inotify/Kconfig
+@@ -15,3 +15,12 @@ config INOTIFY_USER
+ For more information, see <file:Documentation/filesystems/inotify.rst>
+
+ If unsure, say Y.
++
++config INOTIFY_STACKFS
++ bool "Inotify support for stackable filesystem"
++ select INOTIFY_USER
++ default y
++ help
++ Say Y here to enable inotify support for stackable filesystem.
++
++ If unsure, say N.
+diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
+index 1c4bfdab008d..cf567cc33679 100644
+--- a/fs/notify/inotify/inotify_user.c
++++ b/fs/notify/inotify/inotify_user.c
+@@ -15,6 +15,7 @@
+
+ #include <linux/file.h>
+ #include <linux/fs.h> /* struct inode */
++#include <linux/mount.h>
+ #include <linux/fsnotify_backend.h>
+ #include <linux/idr.h>
+ #include <linux/init.h> /* fs_initcall */
+@@ -97,6 +98,93 @@ static void __init inotify_sysctls_init(void)
+ #define inotify_sysctls_init() do { } while (0)
+ #endif /* CONFIG_SYSCTL */
+
++#ifdef CONFIG_INOTIFY_STACKFS
++
++static DEFINE_RWLOCK(inotify_fs_lock);
++static LIST_HEAD(inotify_fs_list);
++
++static inline struct file_system_type* peek_fs_type(struct path *path)
++{
++ return path->mnt->mnt_sb->s_type;
++}
++
++static struct inotify_stackfs* inotify_get_stackfs(struct path *path)
++{
++ struct file_system_type *fs;
++ struct inotify_stackfs *fse, *ret = NULL;
++
++ fs = peek_fs_type(path);
++
++ read_lock(&inotify_fs_lock);
++ list_for_each_entry(fse, &inotify_fs_list, list) {
++ if (fse->fs_type == fs) {
++ ret = fse;
++ break;
++ }
++ }
++ read_unlock(&inotify_fs_lock);
++
++ return ret;
++}
++
++static inline void inotify_put_stackfs(struct inotify_stackfs *fs)
++{
++}
++
++int inotify_register_stackfs(struct inotify_stackfs *fs)
++{
++ int ret = 0;
++ struct inotify_stackfs *fse;
++
++ BUG_ON(IS_ERR_OR_NULL(fs->fs_type));
++ BUG_ON(IS_ERR_OR_NULL(fs->func));
++
++ INIT_LIST_HEAD(&fs->list);
++
++ write_lock(&inotify_fs_lock);
++ list_for_each_entry(fse, &inotify_fs_list, list) {
++ if (fse->fs_type == fs->fs_type) {
++ write_unlock(&inotify_fs_lock);
++ ret = -EBUSY;
++ goto out;
++ }
++ }
++ list_add_tail(&fs->list, &inotify_fs_list);
++ write_unlock(&inotify_fs_lock);
++
++out:
++ return ret;
++}
++EXPORT_SYMBOL_GPL(inotify_register_stackfs);
++
++void inotify_unregister_stackfs(struct inotify_stackfs *fs)
++{
++ struct inotify_stackfs *fse, *n;
++
++ write_lock(&inotify_fs_lock);
++ list_for_each_entry_safe(fse, n, &inotify_fs_list, list) {
++ if (fse == fs) {
++ list_del(&fse->list);
++ break;
++ }
++ }
++ write_unlock(&inotify_fs_lock);
++}
++EXPORT_SYMBOL_GPL(inotify_unregister_stackfs);
++
++#else
++
++static inline struct inotify_stackfs* inotify_get_stackfs(struct path *path)
++{
++ return NULL;
++}
++
++static inline void inotify_put_stackfs(struct inotify_stackfs *fs)
++{
++}
++
++#endif /* CONFIG_INOTIFY_STACKFS */
++
+ static inline __u32 inotify_arg_to_mask(struct inode *inode, u32 arg)
+ {
+ __u32 mask;
+@@ -370,8 +458,8 @@ static const struct file_operations inotify_fops = {
+ /*
+ * find_inode - resolve a user-given path to a specific inode
+ */
+-static int inotify_find_inode(const char __user *dirname, struct path *path,
+- unsigned int flags, __u64 mask)
++static inline int __inotify_find_inode(const char __user *dirname, struct path *path,
++ unsigned int flags, __u64 mask)
+ {
+ int error;
+
+@@ -392,6 +480,28 @@ static int inotify_find_inode(const char __user *dirname, struct path *path,
+ return error;
+ }
+
++static int inotify_find_inode(const char __user *dirname, struct path *path,
++ unsigned int flags, __u64 mask)
++{
++ int ret;
++ struct path tpath;
++ struct inotify_stackfs *fse;
++
++ ret = __inotify_find_inode(dirname, &tpath, flags, mask);
++ if (ret)
++ return ret;
++ fse = inotify_get_stackfs(&tpath);
++ if (fse == NULL) {
++ *path = tpath;
++ return 0;
++ }
++ ret = fse->func(path, &tpath);
++ inotify_put_stackfs(fse);
++ path_put(&tpath);
++
++ return ret;
++}
++
+ static int inotify_add_to_idr(struct idr *idr, spinlock_t *idr_lock,
+ struct inotify_inode_mark *i_mark)
+ {
+diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
+index 2c056d737c27..2cb1f0024e70 100644
+--- a/fs/overlayfs/super.c
++++ b/fs/overlayfs/super.c
+@@ -15,6 +15,7 @@
+ #include <linux/seq_file.h>
+ #include <linux/posix_acl_xattr.h>
+ #include <linux/exportfs.h>
++#include <linux/inotify.h>
+ #include <linux/file.h>
+ #include <linux/fs_context.h>
+ #include <linux/fs_parser.h>
+@@ -1528,6 +1529,18 @@ static void ovl_inode_init_once(void *foo)
+ inode_init_once(&oi->vfs_inode);
+ }
+
++static int ovl_inotify_path(struct path *dst, struct path *src)
++{
++ ovl_path_real(src->dentry, dst);
++ path_get(dst);
++ return 0;
++}
++
++static struct inotify_stackfs ovl_inotify = {
++ .fs_type = &ovl_fs_type,
++ .func = ovl_inotify_path,
++};
++
+ static int __init ovl_init(void)
+ {
+ int err;
+@@ -1543,18 +1556,24 @@ static int __init ovl_init(void)
+ err = ovl_aio_request_cache_init();
+ if (!err) {
+ err = register_filesystem(&ovl_fs_type);
+- if (!err)
+- return 0;
++ if (err)
++ goto err;
++ err = inotify_register_stackfs(&ovl_inotify);
++ if (err)
++ goto err;
++ return 0;
+
+- ovl_aio_request_cache_destroy();
+ }
++err:
+ kmem_cache_destroy(ovl_inode_cachep);
+-
++ unregister_filesystem(&ovl_fs_type);
++ ovl_aio_request_cache_destroy();
+ return err;
+ }
+
+ static void __exit ovl_exit(void)
+ {
++ inotify_unregister_stackfs(&ovl_inotify);
+ unregister_filesystem(&ovl_fs_type);
+
+ /*
+diff --git a/include/linux/inotify.h b/include/linux/inotify.h
+index 8d20caa1b268..c126e2f93a73 100644
+--- a/include/linux/inotify.h
++++ b/include/linux/inotify.h
+@@ -8,6 +8,8 @@
+ #define _LINUX_INOTIFY_H
+
+ #include <uapi/linux/inotify.h>
++#include <linux/list.h>
++#include <linux/fs.h>
+
+ #define ALL_INOTIFY_BITS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \
+ IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \
+@@ -17,4 +19,30 @@
+ IN_DONT_FOLLOW | IN_EXCL_UNLINK | IN_MASK_ADD | \
+ IN_MASK_CREATE | IN_ISDIR | IN_ONESHOT)
+
++typedef int (*inotify_path_proc)(struct path *dst, struct path *src);
++
++struct inotify_stackfs {
++ struct list_head list; /* entry in inotify_fs_list */
++ struct file_system_type *fs_type; /* registed file_system_type */
++ inotify_path_proc func; /* registed callback function */
++};
++
++#ifdef CONFIG_INOTIFY_STACKFS
++
++extern int inotify_register_stackfs(struct inotify_stackfs *fs);
++extern void inotify_unregister_stackfs(struct inotify_stackfs *fs);
++
++#else
++
++static inline int inotify_register_stackfs(struct inotify_stackfs *fs)
++{
++ return 0;
++}
++
++static inline void inotify_unregister_stackfs(struct inotify_stackfs *fs)
++{
++}
++
++#endif /* CONFIG_INOTIFY_STACKFS */
++
+ #endif /* _LINUX_INOTIFY_H */
+--
+2.39.2
+