diff options
author | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2014-03-10 17:27:07 +0000 |
---|---|---|
committer | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2014-03-10 17:27:07 +0000 |
commit | 2b3f3db2131d9b9b6493c4ddea2609443825addf (patch) | |
tree | 6a095e7a61be97c824ffc0c6525372d2f3a7852d /sys | |
parent | df65223c2942b763306fa4cc7e466c02cc065734 (diff) |
When translating packets from one address family to another, pass the
TOS/Traffic Class field of the original packet. Discussed with mikeb@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/pf.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c index 4703feb6c26..c1dfaf846b8 100644 --- a/sys/net/pf.c +++ b/sys/net/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.869 2014/03/10 17:22:27 jca Exp $ */ +/* $OpenBSD: pf.c,v 1.870 2014/03/10 17:27:06 jca Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -1932,6 +1932,7 @@ pf_translate_af(struct pf_pdesc *pd) bzero(ip4, hlen); ip4->ip_v = IPVERSION; ip4->ip_hl = hlen >> 2; + ip4->ip_tos = pd->tos; ip4->ip_len = htons(hlen + (pd->tot_len - pd->off)); ip4->ip_id = htons(ip_randomid()); ip4->ip_off = htons(IP_DF); @@ -1944,6 +1945,7 @@ pf_translate_af(struct pf_pdesc *pd) ip6 = mtod(pd->m, struct ip6_hdr *); bzero(ip6, hlen); ip6->ip6_vfc = IPV6_VERSION; + ip6->ip6_flow |= htonl((u_int32_t)pd->tos << 20); ip6->ip6_plen = htons(pd->tot_len - pd->off); ip6->ip6_nxt = pd->proto; if (!pd->ttl || pd->ttl > IPV6_DEFHLIM) |