Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144313429
D34807.id104688.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D34807.id104688.diff
View Options
Index: sys/netpfil/ipfw/ip_fw2.c
===================================================================
--- sys/netpfil/ipfw/ip_fw2.c
+++ sys/netpfil/ipfw/ip_fw2.c
@@ -2064,11 +2064,9 @@
else if (vidx == 6 /* dscp */) {
if (is_ipv4)
key = ip->ip_tos >> 2;
- else {
- key = args->f_id.flow_id6;
- key = (key & 0x0f) << 2 |
- (key & 0xf000) >> 14;
- }
+ else
+ key = IPV6_DSCP(
+ (struct ip6_hdr *)ip) >> 2;
key &= 0x3f;
} else if (vidx == 2 /* dst-port */ ||
vidx == 3 /* src-port */) {
@@ -2328,11 +2326,9 @@
if (is_ipv4)
x = ip->ip_tos >> 2;
else if (is_ipv6) {
- uint8_t *v;
- v = &((struct ip6_hdr *)ip)->ip6_vfc;
- x = (*v & 0x0F) << 2;
- v++;
- x |= *v >> 6;
+ x = IPV6_DSCP(
+ (struct ip6_hdr *)ip) >> 2;
+ x &= 0x3f;
} else
break;
@@ -3139,12 +3135,13 @@
ip->ip_sum = cksum_adjust(ip->ip_sum,
old, *(uint16_t *)ip);
} else if (is_ipv6) {
- uint8_t *v;
+ /* update cached value */
+ args->f_id.flow_id6 =
+ ntohl(*(uint32_t *)ip) & ~0x0FC00000;
+ args->f_id.flow_id6 |= code << 22;
- v = &((struct ip6_hdr *)ip)->ip6_vfc;
- *v = (*v & 0xF0) | (code >> 2);
- v++;
- *v = (*v & 0x3F) | ((code & 0x03) << 6);
+ *((uint32_t *)ip) =
+ htonl(args->f_id.flow_id6);
} else
break;
Index: sys/netpfil/ipfw/ip_fw_log.c
===================================================================
--- sys/netpfil/ipfw/ip_fw_log.c
+++ sys/netpfil/ipfw/ip_fw_log.c
@@ -156,8 +156,7 @@
altq->qid);
cmd += F_LEN(cmd);
}
- if (cmd->opcode == O_PROB || cmd->opcode == O_TAG ||
- cmd->opcode == O_SETDSCP)
+ if (cmd->opcode == O_PROB || cmd->opcode == O_TAG)
cmd += F_LEN(cmd);
action = action2;
@@ -202,6 +201,10 @@
snprintf(SNPARGS(action2, 0), "Tee %d",
TARG(cmd->arg1, divert));
break;
+ case O_SETDSCP:
+ snprintf(SNPARGS(action2, 0), "SetDscp %d",
+ TARG(cmd->arg1, dscp) & 0x3F);
+ break;
case O_SETFIB:
snprintf(SNPARGS(action2, 0), "SetFib %d",
TARG(cmd->arg1, fib) & 0x7FFF);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 8, 7:22 PM (13 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28488297
Default Alt Text
D34807.id104688.diff (2 KB)
Attached To
Mode
D34807: ipfw: fix matching and setting DSCP value for IPv6
Attached
Detach File
Event Timeline
Log In to Comment