From 99ab1cfcf2c9527de610061efd27dd4c5a132753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E6=A0=BC=E6=96=AF?= Date: Thu, 18 Jul 2024 14:55:56 +0800 Subject: [PATCH 1/2] nat46-module: fix modpost warning WARNING: modpost: nat46.o(.data+0x30): Section mismatch in reference from the variable nat46_netops to the function .init.text:nat46_ns_init() The variable nat46_netops references the function __init nat46_ns_init() If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console --- nat46/modules/nat46-module.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nat46/modules/nat46-module.c b/nat46/modules/nat46-module.c index 34b4073..8b3be8c 100644 --- a/nat46/modules/nat46-module.c +++ b/nat46/modules/nat46-module.c @@ -240,7 +240,7 @@ static void __net_exit nat46_ns_exit(struct net *net) } } -static struct pernet_operations nat46_netops = { +static struct pernet_operations nat46_net_ops = { .init = nat46_ns_init, .exit = nat46_ns_exit, .id = &nat46_netid, @@ -252,7 +252,7 @@ static int __init nat46_init(void) int ret = 0; printk("nat46: module (version %s) loaded.\n", NAT46_VERSION); - ret = register_pernet_subsys(&nat46_netops); + ret = register_pernet_subsys(&nat46_net_ops); if(ret) { goto error; } @@ -264,7 +264,7 @@ static int __init nat46_init(void) static void __exit nat46_exit(void) { - unregister_pernet_subsys(&nat46_netops); + unregister_pernet_subsys(&nat46_net_ops); printk("nat46: module unloaded.\n"); } From b801a3eb34d6b358c5a87c34fb187500f26f5b07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E6=A0=BC=E6=96=AF?= Date: Wed, 23 Oct 2024 14:38:39 +0800 Subject: [PATCH 2/2] Zero checksum handling for UDP4->UDP6 MAP should be transparent to the UDP csum zero in both directions. --- nat46/modules/nat46-core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nat46/modules/nat46-core.c b/nat46/modules/nat46-core.c index 8d7f257..9e4f5fc 100644 --- a/nat46/modules/nat46-core.c +++ b/nat46/modules/nat46-core.c @@ -1766,6 +1766,11 @@ void ip6_update_csum(struct sk_buff * skb, struct ipv6hdr * ip6hdr, int do_atomi struct udphdr *udp = udp_hdr(skb); unsigned udplen = ntohs(ip6hdr->payload_len) - (do_atomic_frag?8:0); /* UDP hdr + payload */ + if ((udp->check == 0) && zero_csum_pass) { + /* zero checksum and the config to pass it is set - do nothing with it */ + break; + } + oldsum = udp->check; udp->check = 0;