openwrt-6.x/package/kernel/nat46/patches/122-fix_for_kernel_6.12.patch
2025-05-20 16:54:09 +08:00

106 lines
3.4 KiB
Diff

--- a/nat46/modules/nat46-netdev.c
+++ b/nat46/modules/nat46-netdev.c
@@ -171,12 +171,12 @@ static void nat46_netdev_setup(struct ne
dev->hard_header_len = 0;
dev->addr_len = 0;
dev->mtu = 16384; /* iptables does reassembly. Rather than using ETH_DATA_LEN, let's try to get as much mileage as we can with the Linux stack */
- dev->features = NETIF_F_NETNS_LOCAL;
+ dev->netns_local = true;
dev->flags = IFF_NOARP | IFF_POINTOPOINT;
dev->priv_flags_ext = IFF_EXT_MAPT;
}
-int nat46_netdev_create(struct net *net, char *basename, struct net_device **dev)
+static int nat46_netdev_create(struct net *net, char *basename, struct net_device **dev)
{
int ret = 0;
char *devname = NULL;
@@ -237,7 +237,7 @@ err:
return ret;
}
-void nat46_netdev_destroy(struct net_device *dev)
+static void nat46_netdev_destroy(struct net_device *dev)
{
dev->flags &= ~IFF_UP;
netif_stop_queue(dev);
@@ -274,7 +274,7 @@ static struct net_device *find_dev(struc
return NULL;
}
- read_lock(&dev_base_lock);
+ //read_lock(&dev_base_lock);
dev = first_net_device(net);
while (dev) {
if((0 == strcmp(dev->name, name)) && is_nat46(dev)) {
@@ -286,7 +286,7 @@ static struct net_device *find_dev(struc
}
dev = next_net_device(dev);
}
- read_unlock(&dev_base_lock);
+ //read_unlock(&dev_base_lock);
return out;
}
@@ -388,7 +388,7 @@ int nat46_remove(struct net *net, char *
void nat64_show_all_configs(struct net *net, struct seq_file *m) {
struct net_device *dev;
- read_lock(&dev_base_lock);
+ //read_lock(&dev_base_lock);
dev = first_net_device(net);
while (dev) {
if(is_nat46(dev)) {
@@ -411,7 +411,7 @@ void nat64_show_all_configs(struct net *
}
dev = next_net_device(dev);
}
- read_unlock(&dev_base_lock);
+ //read_unlock(&dev_base_lock);
}
@@ -419,7 +419,7 @@ void nat46_destroy_all(struct net *net)
struct net_device *dev;
struct net_device *nat46dev;
do {
- read_lock(&dev_base_lock);
+ //read_lock(&dev_base_lock);
nat46dev = NULL;
dev = first_net_device(net);
while (dev) {
@@ -428,7 +428,7 @@ void nat46_destroy_all(struct net *net)
}
dev = next_net_device(dev);
}
- read_unlock(&dev_base_lock);
+ //read_unlock(&dev_base_lock);
if(nat46dev) {
nat46_netdev_destroy(nat46dev);
}
--- a/nat46/modules/nat46-core.c
+++ b/nat46/modules/nat46-core.c
@@ -16,6 +16,7 @@
*
*/
+//#include <cstring>
#include <net/route.h>
#include <net/ipv6_frag.h>
#include <linux/version.h>
@@ -213,10 +214,10 @@ void nat46_sort_rule_array(nat46_instanc
int nelem = nat46->npairs;
nat46_xlate_rulepair_t *array = NULL;
- memcpy(nat46->sorted_ipv4_local_pairs, nat46->pairs, nelem * sizeof(nat46_xlate_rulepair_t));
- memcpy(nat46->sorted_ipv4_remote_pairs, nat46->pairs, nelem * sizeof(nat46_xlate_rulepair_t));
- memcpy(nat46->sorted_ipv6_local_pairs, nat46->pairs, nelem * sizeof(nat46_xlate_rulepair_t));
- memcpy(nat46->sorted_ipv6_remote_pairs, nat46->pairs, nelem * sizeof(nat46_xlate_rulepair_t));
+ memmove(nat46->sorted_ipv4_local_pairs, nat46->pairs, nelem * sizeof(nat46_xlate_rulepair_t));
+ memmove(nat46->sorted_ipv4_remote_pairs, nat46->pairs, nelem * sizeof(nat46_xlate_rulepair_t));
+ memmove(nat46->sorted_ipv6_local_pairs, nat46->pairs, nelem * sizeof(nat46_xlate_rulepair_t));
+ memmove(nat46->sorted_ipv6_remote_pairs, nat46->pairs, nelem * sizeof(nat46_xlate_rulepair_t));
array = &nat46->sorted_ipv4_local_pairs[0];
for (i = 0; i < nelem - 1; i++) {