1
0
This repository has been archived on 2024-07-22. You can view files and clone it. You cannot open issues, pull requests or push a commit.
Files

44 lines
1.5 KiB
Diff
Executable File

diff -Naur nat46-6.old/nat46/modules/nat46-core.c nat46-6.new/nat46/modules/nat46-core.c
--- nat46-6.old/nat46/modules/nat46-core.c 2017-04-17 09:59:50.025700000 +0530
+++ nat46-6.new/nat46/modules/nat46-core.c 2017-04-17 10:11:16.107523000 +0530
@@ -807,11 +807,12 @@
}
void fill_v4hdr_from_v6hdr(struct iphdr * iph, struct ipv6hdr *ip6h, __u32 v4saddr, __u32 v4daddr, __u16 id, __u16 frag_off, __u16 proto, int l3_payload_len) {
+ uint32_t ver_class_flow = ntohl(*(__be32 *)ip6h);
iph->ttl = ip6h->hop_limit;
iph->saddr = v4saddr;
iph->daddr = v4daddr;
iph->protocol = proto;
- *((__be16 *)iph) = htons((4 << 12) | (5 << 8) | (0x00/*tos*/ & 0xff));
+ *((__be16 *)iph) = htons((4 << 12) | (5 << 8) | ((ver_class_flow >> 20) & 0xff));
iph->frag_off = frag_off;
iph->id = id;
iph->tot_len = htons( l3_payload_len + IPV4HDRSIZE );
@@ -1743,8 +1744,8 @@
nat46_instance_t *nat46 = get_nat46_instance(old_skb);
struct sk_buff *new_skb;
uint16_t sport = 0, dport = 0;
+ uint8_t tclass;
- int tclass = 0;
int flowlabel = 0;
int do_l4_translate = 0;
@@ -1752,6 +1753,7 @@
struct ipv6hdr * hdr6;
struct iphdr * hdr4 = ip_hdr(old_skb);
+ tclass = hdr4->tos;
char v6saddr[16], v6daddr[16];
@@ -1829,7 +1831,6 @@
memset(hdr6, 0, sizeof(*hdr6) + (add_frag_header?8:0));
/* build IPv6 header */
- tclass = 0; /* traffic class */
*(__be32 *)hdr6 = htonl(0x60000000 | (tclass << 20)) | flowlabel; /* version, priority, flowlabel */
/* IPv6 length is a payload length, IPv4 is hdr+payload */