diff options
Diffstat (limited to 'target/linux/generic')
10 files changed, 170 insertions, 192 deletions
diff --git a/target/linux/generic/hack-4.19/550-loop-Report-EOPNOTSUPP-properly.patch b/target/linux/generic/hack-4.19/550-loop-Report-EOPNOTSUPP-properly.patch new file mode 100644 index 0000000000..023de0078d --- /dev/null +++ b/target/linux/generic/hack-4.19/550-loop-Report-EOPNOTSUPP-properly.patch @@ -0,0 +1,41 @@ +From 2e864386e62e702a343be2507062ee08d5dfc810 Mon Sep 17 00:00:00 2001 +From: Evan Green <evgreen@chromium.org> +Date: Thu, 14 Nov 2019 15:50:07 -0800 +Subject: loop: Report EOPNOTSUPP properly + +Properly plumb out EOPNOTSUPP from loop driver operations, which may +get returned when for instance a discard operation is attempted but not +supported by the underlying block device. Before this change, everything +was reported in the log as an I/O error, which is scary and not +helpful in debugging. + +Signed-off-by: Evan Green <evgreen@chromium.org> +Reviewed-by: Gwendal Grignou <gwendal@chromium.org> +Reviewed-by: Bart Van Assche <bvanassche@acm.org> +--- + drivers/block/loop.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +--- a/drivers/block/loop.c ++++ b/drivers/block/loop.c +@@ -460,7 +460,7 @@ static void lo_complete_rq(struct reques + if (!cmd->use_aio || cmd->ret < 0 || cmd->ret == blk_rq_bytes(rq) || + req_op(rq) != REQ_OP_READ) { + if (cmd->ret < 0) +- ret = BLK_STS_IOERR; ++ ret = errno_to_blk_status(cmd->ret); + goto end_io; + } + +@@ -1904,7 +1904,10 @@ static void loop_handle_cmd(struct loop_ + failed: + /* complete non-aio request */ + if (!cmd->use_aio || ret) { +- cmd->ret = ret ? -EIO : 0; ++ if (ret == -EOPNOTSUPP) ++ cmd->ret = ret; ++ else ++ cmd->ret = ret ? -EIO : 0; + blk_mq_complete_request(rq); + } + } diff --git a/target/linux/generic/hack-4.19/550-loop-better-discard-for-block-devices.patch b/target/linux/generic/hack-4.19/550-loop-better-discard-for-block-devices.patch deleted file mode 100644 index 9701d945e6..0000000000 --- a/target/linux/generic/hack-4.19/550-loop-better-discard-for-block-devices.patch +++ /dev/null @@ -1,164 +0,0 @@ -From: Evan Green <evgreen@chromium.org> -Subject: [PATCH v5 0/2] loop: Better discard for block devices -Date: Mon, 6 May 2019 11:27:35 -0700 -Message-Id: <20190506182736.21064-2-evgreen@chromium.org> - -This series addresses some errors seen when using the loop -device directly backed by a block device. - -The first change titled "loop: Better discard for block devices" -plumbs out the correct error message, and the second change prevents -the error from occurring in many cases. - -The errors look like this: -[ 90.880875] print_req_error: I/O error, dev loop5, sector 0 - -The errors occur when trying to do a discard or write zeroes operation -on a loop device backed by a block device that does not support write zeroes. -Firstly, the error itself is incorrectly reported as I/O error, but is -actually EOPNOTSUPP. The first patch plumbs out EOPNOTSUPP to properly -report the error. - -The second patch called "loop: Better discard support for block devices" -prevents these errors from occurring by mirroring the zeroing capabilities -of the underlying block device into the loop device. -Before this change, discard was always reported as being supported, and -the loop device simply turns around and does an fallocate operation on the -backing device. After this change, backing block devices that do support -zeroing will continue to work as before, and continue to get all the -benefits of doing that. Backing devices that do not support zeroing will -fail earlier, avoiding hitting the loop device at all and ultimately -avoiding this error in the logs. - -I can also confirm that this fixes test block/003 in the blktests, when -running blktests on a loop device backed by a block device. - -Signed-off-by: Evan Green <evgreen@chromium.org> -Reviewed-by: Ming Lei <ming.lei@redhat.com> -Reviewed-by: Bart Van Assche <bvanassche@acm.org> -Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> -Reviewed-by: Gwendal Grignou <gwendal@chromium.org> -Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> ---- - ---- a/drivers/block/loop.c -+++ b/drivers/block/loop.c -@@ -416,19 +416,14 @@ out_free_page: - return ret; - } - --static int lo_discard(struct loop_device *lo, struct request *rq, loff_t pos) -+static int lo_discard(struct loop_device *lo, struct request *rq, -+ int mode, loff_t pos) - { -- /* -- * We use punch hole to reclaim the free space used by the -- * image a.k.a. discard. However we do not support discard if -- * encryption is enabled, because it may give an attacker -- * useful information. -- */ - struct file *file = lo->lo_backing_file; -- int mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE; -+ struct request_queue *q = lo->lo_queue; - int ret; - -- if ((!file->f_op->fallocate) || lo->lo_encrypt_key_size) { -+ if (!blk_queue_discard(q)) { - ret = -EOPNOTSUPP; - goto out; - } -@@ -457,7 +452,9 @@ static void lo_complete_rq(struct reques - - if (!cmd->use_aio || cmd->ret < 0 || cmd->ret == blk_rq_bytes(rq) || - req_op(rq) != REQ_OP_READ) { -- if (cmd->ret < 0) -+ if (cmd->ret == -EOPNOTSUPP) -+ ret = BLK_STS_NOTSUPP; -+ else if (cmd->ret < 0) - ret = BLK_STS_IOERR; - goto end_io; - } -@@ -597,8 +594,13 @@ static int do_req_filebacked(struct loop - case REQ_OP_FLUSH: - return lo_req_flush(lo, rq); - case REQ_OP_DISCARD: -+ return lo_discard(lo, rq, -+ FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, pos); -+ - case REQ_OP_WRITE_ZEROES: -- return lo_discard(lo, rq, pos); -+ return lo_discard(lo, rq, -+ FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE, pos); -+ - case REQ_OP_WRITE: - if (lo->transfer) - return lo_write_transfer(lo, rq, pos); -@@ -853,6 +855,21 @@ static void loop_config_discard(struct l - struct file *file = lo->lo_backing_file; - struct inode *inode = file->f_mapping->host; - struct request_queue *q = lo->lo_queue; -+ struct request_queue *backingq; -+ -+ /* -+ * If the backing device is a block device, mirror its zeroing -+ * capability. REQ_OP_DISCARD translates to a zero-out even when backed -+ * by block devices to keep consistent behavior with file-backed loop -+ * devices. -+ */ -+ if (S_ISBLK(inode->i_mode) && !lo->lo_encrypt_key_size) { -+ backingq = bdev_get_queue(inode->i_bdev); -+ blk_queue_max_discard_sectors(q, -+ backingq->limits.max_write_zeroes_sectors); -+ -+ blk_queue_max_write_zeroes_sectors(q, -+ backingq->limits.max_write_zeroes_sectors); - - /* - * We use punch hole to reclaim the free space used by the -@@ -860,22 +877,24 @@ static void loop_config_discard(struct l - * encryption is enabled, because it may give an attacker - * useful information. - */ -- if ((!file->f_op->fallocate) || -- lo->lo_encrypt_key_size) { -+ } else if ((!file->f_op->fallocate) || lo->lo_encrypt_key_size) { - q->limits.discard_granularity = 0; - q->limits.discard_alignment = 0; - blk_queue_max_discard_sectors(q, 0); - blk_queue_max_write_zeroes_sectors(q, 0); -- blk_queue_flag_clear(QUEUE_FLAG_DISCARD, q); -- return; -- } - -- q->limits.discard_granularity = inode->i_sb->s_blocksize; -- q->limits.discard_alignment = 0; -+ } else { -+ q->limits.discard_granularity = inode->i_sb->s_blocksize; -+ q->limits.discard_alignment = 0; - -- blk_queue_max_discard_sectors(q, UINT_MAX >> 9); -- blk_queue_max_write_zeroes_sectors(q, UINT_MAX >> 9); -- blk_queue_flag_set(QUEUE_FLAG_DISCARD, q); -+ blk_queue_max_discard_sectors(q, UINT_MAX >> 9); -+ blk_queue_max_write_zeroes_sectors(q, UINT_MAX >> 9); -+ } -+ -+ if (q->limits.max_write_zeroes_sectors) -+ blk_queue_flag_set(QUEUE_FLAG_DISCARD, q); -+ else -+ blk_queue_flag_clear(QUEUE_FLAG_DISCARD, q); - } - - static void loop_unprepare_queue(struct loop_device *lo) -@@ -1894,7 +1913,10 @@ static void loop_handle_cmd(struct loop_ - failed: - /* complete non-aio request */ - if (!cmd->use_aio || ret) { -- cmd->ret = ret ? -EIO : 0; -+ if (ret == -EOPNOTSUPP) -+ cmd->ret = ret; -+ else -+ cmd->ret = ret ? -EIO : 0; - blk_mq_complete_request(rq); - } - } diff --git a/target/linux/generic/hack-4.19/551-loop-Better-discard-support-for-block-devices.patch b/target/linux/generic/hack-4.19/551-loop-Better-discard-support-for-block-devices.patch new file mode 100644 index 0000000000..ac393e5f13 --- /dev/null +++ b/target/linux/generic/hack-4.19/551-loop-Better-discard-support-for-block-devices.patch @@ -0,0 +1,101 @@ +From 3117c3f45edbcc269baaebd3d13f39b7bf884aa6 Mon Sep 17 00:00:00 2001 +From: Evan Green <evgreen@chromium.org> +Date: Thu, 14 Nov 2019 15:50:08 -0800 +Subject: loop: Better discard support for block devices + +If the backing device for a loop device is itself a block device, +then mirror the "write zeroes" capabilities of the underlying +block device into the loop device. Copy this capability into both +max_write_zeroes_sectors and max_discard_sectors of the loop device. + +The reason for this is that REQ_OP_DISCARD on a loop device translates +into blkdev_issue_zeroout(), rather than blkdev_issue_discard(). This +presents a consistent interface for loop devices (that discarded data +is zeroed), regardless of the backing device type of the loop device. +There should be no behavior change for loop devices backed by regular +files. + +This change fixes blktest block/003, and removes an extraneous +error print in block/013 when testing on a loop device backed +by a block device that does not support discard. + +Signed-off-by: Evan Green <evgreen@chromium.org> +Reviewed-by: Gwendal Grignou <gwendal@chromium.org> +Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> +--- + drivers/block/loop.c | 40 +++++++++++++++++++++++++++++----------- + 1 file changed, 29 insertions(+), 11 deletions(-) + +--- a/drivers/block/loop.c ++++ b/drivers/block/loop.c +@@ -426,11 +426,12 @@ static int lo_fallocate(struct loop_devi + * information. + */ + struct file *file = lo->lo_backing_file; ++ struct request_queue *q = lo->lo_queue; + int ret; + + mode |= FALLOC_FL_KEEP_SIZE; + +- if ((!file->f_op->fallocate) || lo->lo_encrypt_key_size) { ++ if (!blk_queue_discard(q)) { + ret = -EOPNOTSUPP; + goto out; + } +@@ -863,6 +864,21 @@ static void loop_config_discard(struct l + struct file *file = lo->lo_backing_file; + struct inode *inode = file->f_mapping->host; + struct request_queue *q = lo->lo_queue; ++ struct request_queue *backingq; ++ ++ /* ++ * If the backing device is a block device, mirror its zeroing ++ * capability. REQ_OP_DISCARD translates to a zero-out even when backed ++ * by block devices to keep consistent behavior with file-backed loop ++ * devices. ++ */ ++ if (S_ISBLK(inode->i_mode) && !lo->lo_encrypt_key_size) { ++ backingq = bdev_get_queue(inode->i_bdev); ++ blk_queue_max_discard_sectors(q, ++ backingq->limits.max_write_zeroes_sectors); ++ ++ blk_queue_max_write_zeroes_sectors(q, ++ backingq->limits.max_write_zeroes_sectors); + + /* + * We use punch hole to reclaim the free space used by the +@@ -870,22 +886,24 @@ static void loop_config_discard(struct l + * encryption is enabled, because it may give an attacker + * useful information. + */ +- if ((!file->f_op->fallocate) || +- lo->lo_encrypt_key_size) { ++ } else if ((!file->f_op->fallocate) || lo->lo_encrypt_key_size) { + q->limits.discard_granularity = 0; + q->limits.discard_alignment = 0; + blk_queue_max_discard_sectors(q, 0); + blk_queue_max_write_zeroes_sectors(q, 0); +- blk_queue_flag_clear(QUEUE_FLAG_DISCARD, q); +- return; +- } + +- q->limits.discard_granularity = inode->i_sb->s_blocksize; +- q->limits.discard_alignment = 0; ++ } else { ++ q->limits.discard_granularity = inode->i_sb->s_blocksize; ++ q->limits.discard_alignment = 0; + +- blk_queue_max_discard_sectors(q, UINT_MAX >> 9); +- blk_queue_max_write_zeroes_sectors(q, UINT_MAX >> 9); +- blk_queue_flag_set(QUEUE_FLAG_DISCARD, q); ++ blk_queue_max_discard_sectors(q, UINT_MAX >> 9); ++ blk_queue_max_write_zeroes_sectors(q, UINT_MAX >> 9); ++ } ++ ++ if (q->limits.max_write_zeroes_sectors) ++ blk_queue_flag_set(QUEUE_FLAG_DISCARD, q); ++ else ++ blk_queue_flag_clear(QUEUE_FLAG_DISCARD, q); + } + + static void loop_unprepare_queue(struct loop_device *lo) diff --git a/target/linux/generic/hack-4.19/721-phy_packets.patch b/target/linux/generic/hack-4.19/721-phy_packets.patch index e9c09302e3..b6cbef1e49 100644 --- a/target/linux/generic/hack-4.19/721-phy_packets.patch +++ b/target/linux/generic/hack-4.19/721-phy_packets.patch @@ -56,7 +56,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> */ --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h -@@ -2545,6 +2545,10 @@ static inline int pskb_trim(struct sk_bu +@@ -2547,6 +2547,10 @@ static inline int pskb_trim(struct sk_bu return (len < skb->len) ? __pskb_trim(skb, len) : 0; } @@ -67,7 +67,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> /** * pskb_trim_unique - remove end from a paged unique (not cloned) buffer * @skb: buffer to alter -@@ -2676,16 +2680,6 @@ static inline struct sk_buff *dev_alloc_ +@@ -2678,16 +2682,6 @@ static inline struct sk_buff *dev_alloc_ } diff --git a/target/linux/generic/hack-4.19/902-debloat_proc.patch b/target/linux/generic/hack-4.19/902-debloat_proc.patch index f562c9f2e1..3ee7fdafd0 100644 --- a/target/linux/generic/hack-4.19/902-debloat_proc.patch +++ b/target/linux/generic/hack-4.19/902-debloat_proc.patch @@ -393,7 +393,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> } --- a/net/ipv4/route.c +++ b/net/ipv4/route.c -@@ -410,6 +410,9 @@ static struct pernet_operations ip_rt_pr +@@ -411,6 +411,9 @@ static struct pernet_operations ip_rt_pr static int __init ip_rt_proc_init(void) { diff --git a/target/linux/generic/pending-4.19/130-add-linux-spidev-compatible-si3210.patch b/target/linux/generic/pending-4.19/130-add-linux-spidev-compatible-si3210.patch index b00fb8ee2e..3a42182c97 100644 --- a/target/linux/generic/pending-4.19/130-add-linux-spidev-compatible-si3210.patch +++ b/target/linux/generic/pending-4.19/130-add-linux-spidev-compatible-si3210.patch @@ -8,7 +8,7 @@ Signed-off-by: Giuseppe Lippolis <giu.lippolis@gmail.com> --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c -@@ -669,6 +669,7 @@ static const struct of_device_id spidev_ +@@ -672,6 +672,7 @@ static const struct of_device_id spidev_ { .compatible = "lineartechnology,ltc2488" }, { .compatible = "ge,achc" }, { .compatible = "semtech,sx1301" }, diff --git a/target/linux/generic/pending-4.19/203-kallsyms_uncompressed.patch b/target/linux/generic/pending-4.19/203-kallsyms_uncompressed.patch index 6f0adb5ce5..9230279fca 100644 --- a/target/linux/generic/pending-4.19/203-kallsyms_uncompressed.patch +++ b/target/linux/generic/pending-4.19/203-kallsyms_uncompressed.patch @@ -75,7 +75,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> output_label("kallsyms_token_table"); off = 0; for (i = 0; i < 256; i++) { -@@ -500,6 +504,9 @@ static void *find_token(unsigned char *s +@@ -502,6 +506,9 @@ static void *find_token(unsigned char *s { int i; @@ -85,7 +85,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> for (i = 0; i < len - 1; i++) { if (str[i] == token[0] && str[i+1] == token[1]) return &str[i]; -@@ -572,6 +579,9 @@ static void optimize_result(void) +@@ -574,6 +581,9 @@ static void optimize_result(void) { int i, best; @@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> /* using the '\0' symbol last allows compress_symbols to use standard * fast string functions */ for (i = 255; i >= 0; i--) { -@@ -754,6 +764,8 @@ int main(int argc, char **argv) +@@ -756,6 +766,8 @@ int main(int argc, char **argv) absolute_percpu = 1; else if (strcmp(argv[i], "--base-relative") == 0) base_relative = 1; diff --git a/target/linux/generic/pending-4.19/630-packet_socket_type.patch b/target/linux/generic/pending-4.19/630-packet_socket_type.patch index 70cf88ddfa..7c4ab32fa2 100644 --- a/target/linux/generic/pending-4.19/630-packet_socket_type.patch +++ b/target/linux/generic/pending-4.19/630-packet_socket_type.patch @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> #define PACKET_FANOUT_LB 1 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c -@@ -1789,6 +1789,7 @@ static int packet_rcv_spkt(struct sk_buf +@@ -1790,6 +1790,7 @@ static int packet_rcv_spkt(struct sk_buf { struct sock *sk; struct sockaddr_pkt *spkt; @@ -38,7 +38,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> /* * When we registered the protocol we saved the socket in the data -@@ -1796,6 +1797,7 @@ static int packet_rcv_spkt(struct sk_buf +@@ -1797,6 +1798,7 @@ static int packet_rcv_spkt(struct sk_buf */ sk = pt->af_packet_priv; @@ -46,7 +46,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> /* * Yank back the headers [hope the device set this -@@ -1808,7 +1810,7 @@ static int packet_rcv_spkt(struct sk_buf +@@ -1809,7 +1811,7 @@ static int packet_rcv_spkt(struct sk_buf * so that this procedure is noop. */ @@ -55,7 +55,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> goto out; if (!net_eq(dev_net(dev), sock_net(sk))) -@@ -2036,12 +2038,12 @@ static int packet_rcv(struct sk_buff *sk +@@ -2037,12 +2039,12 @@ static int packet_rcv(struct sk_buff *sk unsigned int snaplen, res; bool is_drop_n_account = false; @@ -71,7 +71,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> if (!net_eq(dev_net(dev), sock_net(sk))) goto drop; -@@ -2167,12 +2169,12 @@ static int tpacket_rcv(struct sk_buff *s +@@ -2168,12 +2170,12 @@ static int tpacket_rcv(struct sk_buff *s BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h2)) != 32); BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h3)) != 48); @@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> if (!net_eq(dev_net(dev), sock_net(sk))) goto drop; -@@ -3258,6 +3260,7 @@ static int packet_create(struct net *net +@@ -3259,6 +3261,7 @@ static int packet_create(struct net *net mutex_init(&po->pg_vec_lock); po->rollover = NULL; po->prot_hook.func = packet_rcv; @@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> if (sock->type == SOCK_PACKET) po->prot_hook.func = packet_rcv_spkt; -@@ -3869,6 +3872,16 @@ packet_setsockopt(struct socket *sock, i +@@ -3870,6 +3873,16 @@ packet_setsockopt(struct socket *sock, i po->xmit = val ? packet_direct_xmit : dev_queue_xmit; return 0; } @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> default: return -ENOPROTOOPT; } -@@ -3921,6 +3934,13 @@ static int packet_getsockopt(struct sock +@@ -3922,6 +3935,13 @@ static int packet_getsockopt(struct sock case PACKET_VNET_HDR: val = po->has_vnet_hdr; break; diff --git a/target/linux/generic/pending-4.19/655-increase_skb_pad.patch b/target/linux/generic/pending-4.19/655-increase_skb_pad.patch index b5f7fadbe7..94e325b0cc 100644 --- a/target/linux/generic/pending-4.19/655-increase_skb_pad.patch +++ b/target/linux/generic/pending-4.19/655-increase_skb_pad.patch @@ -9,7 +9,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h -@@ -2509,7 +2509,7 @@ static inline int pskb_network_may_pull( +@@ -2511,7 +2511,7 @@ static inline int pskb_network_may_pull( * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8) */ #ifndef NET_SKB_PAD diff --git a/target/linux/generic/pending-4.19/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-4.19/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch index 114595b3f5..c35aca8a18 100644 --- a/target/linux/generic/pending-4.19/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch +++ b/target/linux/generic/pending-4.19/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch @@ -118,8 +118,8 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> +static int ip6_pkt_policy_failed_out(struct net *net, struct sock *sk, struct sk_buff *skb); static void ip6_link_failure(struct sk_buff *skb); static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, - struct sk_buff *skb, u32 mtu); -@@ -326,6 +328,18 @@ static const struct rt6_info ip6_prohibi + struct sk_buff *skb, u32 mtu, +@@ -328,6 +330,18 @@ static const struct rt6_info ip6_prohibi .rt6i_flags = (RTF_REJECT | RTF_NONEXTHOP), }; @@ -138,7 +138,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> static const struct rt6_info ip6_blk_hole_entry_template = { .dst = { .__refcnt = ATOMIC_INIT(1), -@@ -904,6 +918,7 @@ static const int fib6_prop[RTN_MAX + 1] +@@ -906,6 +920,7 @@ static const int fib6_prop[RTN_MAX + 1] [RTN_BLACKHOLE] = -EINVAL, [RTN_UNREACHABLE] = -EHOSTUNREACH, [RTN_PROHIBIT] = -EACCES, @@ -146,7 +146,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> [RTN_THROW] = -EAGAIN, [RTN_NAT] = -EINVAL, [RTN_XRESOLVE] = -EINVAL, -@@ -941,6 +956,10 @@ static void ip6_rt_init_dst_reject(struc +@@ -943,6 +958,10 @@ static void ip6_rt_init_dst_reject(struc rt->dst.output = ip6_pkt_prohibit_out; rt->dst.input = ip6_pkt_prohibit; break; @@ -157,7 +157,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> case RTN_THROW: case RTN_UNREACHABLE: default: -@@ -3781,6 +3800,17 @@ static int ip6_pkt_prohibit_out(struct n +@@ -3789,6 +3808,17 @@ static int ip6_pkt_prohibit_out(struct n return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES); } @@ -175,7 +175,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> /* * Allocate a dst for local (unicast / anycast) address. */ -@@ -4228,7 +4258,8 @@ static int rtm_to_fib6_config(struct sk_ +@@ -4236,7 +4266,8 @@ static int rtm_to_fib6_config(struct sk_ if (rtm->rtm_type == RTN_UNREACHABLE || rtm->rtm_type == RTN_BLACKHOLE || rtm->rtm_type == RTN_PROHIBIT || @@ -185,7 +185,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> cfg->fc_flags |= RTF_REJECT; if (rtm->rtm_type == RTN_LOCAL) -@@ -5076,6 +5107,8 @@ static int ip6_route_dev_notify(struct n +@@ -5084,6 +5115,8 @@ static int ip6_route_dev_notify(struct n #ifdef CONFIG_IPV6_MULTIPLE_TABLES net->ipv6.ip6_prohibit_entry->dst.dev = dev; net->ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(dev); @@ -194,7 +194,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> net->ipv6.ip6_blk_hole_entry->dst.dev = dev; net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev); #endif -@@ -5087,6 +5120,7 @@ static int ip6_route_dev_notify(struct n +@@ -5095,6 +5128,7 @@ static int ip6_route_dev_notify(struct n in6_dev_put_clear(&net->ipv6.ip6_null_entry->rt6i_idev); #ifdef CONFIG_IPV6_MULTIPLE_TABLES in6_dev_put_clear(&net->ipv6.ip6_prohibit_entry->rt6i_idev); @@ -202,7 +202,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> in6_dev_put_clear(&net->ipv6.ip6_blk_hole_entry->rt6i_idev); #endif } -@@ -5281,6 +5315,15 @@ static int __net_init ip6_route_net_init +@@ -5289,6 +5323,15 @@ static int __net_init ip6_route_net_init net->ipv6.ip6_blk_hole_entry->dst.ops = &net->ipv6.ip6_dst_ops; dst_init_metrics(&net->ipv6.ip6_blk_hole_entry->dst, ip6_template_metrics, true); @@ -218,7 +218,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> #endif net->ipv6.sysctl.flush_delay = 0; -@@ -5299,6 +5342,8 @@ out: +@@ -5307,6 +5350,8 @@ out: return ret; #ifdef CONFIG_IPV6_MULTIPLE_TABLES @@ -227,7 +227,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> out_ip6_prohibit_entry: kfree(net->ipv6.ip6_prohibit_entry); out_ip6_null_entry: -@@ -5319,6 +5364,7 @@ static void __net_exit ip6_route_net_exi +@@ -5327,6 +5372,7 @@ static void __net_exit ip6_route_net_exi #ifdef CONFIG_IPV6_MULTIPLE_TABLES kfree(net->ipv6.ip6_prohibit_entry); kfree(net->ipv6.ip6_blk_hole_entry); @@ -235,7 +235,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> #endif dst_entries_destroy(&net->ipv6.ip6_dst_ops); } -@@ -5395,6 +5441,9 @@ void __init ip6_route_init_special_entri +@@ -5403,6 +5449,9 @@ void __init ip6_route_init_special_entri init_net.ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev; init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); |