From owner-freebsd-net@FreeBSD.ORG Thu Feb 23 16:51:24 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE54F1065672 for ; Thu, 23 Feb 2012 16:51:24 +0000 (UTC) (envelope-from rozhuk.im@gmail.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 744E38FC18 for ; Thu, 23 Feb 2012 16:51:24 +0000 (UTC) Received: by werm13 with SMTP id m13so1356652wer.13 for ; Thu, 23 Feb 2012 08:51:23 -0800 (PST) Received-SPF: pass (google.com: domain of rozhuk.im@gmail.com designates 10.180.107.67 as permitted sender) client-ip=10.180.107.67; Authentication-Results: mr.google.com; spf=pass (google.com: domain of rozhuk.im@gmail.com designates 10.180.107.67 as permitted sender) smtp.mail=rozhuk.im@gmail.com; dkim=pass header.i=rozhuk.im@gmail.com Received: from mr.google.com ([10.180.107.67]) by 10.180.107.67 with SMTP id ha3mr5148953wib.8.1330015883620 (num_hops = 1); Thu, 23 Feb 2012 08:51:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=reply-to:from:to:cc:subject:date:message-id:mime-version :content-type:content-transfer-encoding:x-mailer:content-language :thread-index; bh=NipKJ/4OFVWePU5WNzM4YKXeJXJcwT83EMDxFSu5Mno=; b=hutunTM7yrHhDlpA3sMsJ53wDB6ayrbVeIxJuZBgobOStkt+DmUubbqGJbSCqA/k+5 GgQR/lmt2Dj4FL7r4NFCJbeEQIy9MBALn8dvcAaFMUtPe+XQrD33STYQ4WYcBlNDSP98 oKcjaUHM4PXL+X3ymfjZtOrHSlMdC4YpR5XAM= Received: by 10.180.107.67 with SMTP id ha3mr4193618wib.8.1330015883578; Thu, 23 Feb 2012 08:51:23 -0800 (PST) Received: from rimwks1w7x64 ([164.215.91.160]) by mx.google.com with ESMTPS id dr5sm9023645wib.0.2012.02.23.08.51.20 (version=SSLv3 cipher=OTHER); Thu, 23 Feb 2012 08:51:21 -0800 (PST) From: rozhuk.im@gmail.com To: Date: Fri, 24 Feb 2012 01:51:15 +0900 Message-ID: <4f466e89.6560b40a.499a.ffffe838@mx.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Content-Language: ru Thread-Index: AczyS1rtoIKM2+klS3Wa03whgBD4dQ== Cc: Subject: ipfw and DSCP / ECN X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Rozhuk.IM@gmail.com List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Feb 2012 16:51:25 -0000 Hi! "ip_tos" (ipv4) and "Traffic Class" (ipv6) field in the header of ip packet may contain a DSCP and ECN. "iptos" and "ipprecedence" options in ipfw does not allow to use these fields in the header of packets. May want to add two additional options for working with them in the ipv4 and ipv6 packets: - ipecn: values IPTOS_ECN_NOTECT, IPTOS_ECN_ECT1, IPTOS_ECN_ECT0, IPTOS_ECN_CE (defined in ip.h) - ipdscp: number from 0 to 0x3f I want to hear your opinions about this. Also, the header ipv6 may be more convenient as: struct ip6_hdr { union { struct ip6_hdrctl { u_int32_t ip6_un1_flow; /* 20 bits of flow-ID */ u_int16_t ip6_un1_plen; /* payload length */ u_int8_t ip6_un1_nxt; /* next header */ u_int8_t ip6_un1_hlim; /* hop limit */ } ip6_un1; u_int8_t ip6_un2_vfc; /* 4 bits version, top 4 bits class */ struct ip6_hdrctl2 { u_int32_t ip6_un3_vers:4; /* 4 bits version */ u_int32_t ip6_un3_class:8;/* 8 bits class */ u_int32_t ip6_un3_flow:20;/* 20 bits of flow-ID */ u_int16_t ip6_un3_plen; /* payload length */ u_int8_t ip6_un3_nxt; /* next header */ u_int8_t ip6_un3_hlim; /* hop limit */ } ip6_un3; } ip6_ctlun; struct in6_addr ip6_src; /* source address */ struct in6_addr ip6_dst; /* destination address */ } __packed; PS: http://tools.ietf.org/html/rfc2474#section-3 "A replacement header field, called the DS field, is defined, which is intended to supersede the existing definitions of the IPv4 TOS octet [RFC791] and the IPv6 Traffic Class octet [IPv6]." For a full history of the TOS field, see: http://tools.ietf.org/html/rfc3168#section-22 0 1 2 3 4 5 6 7 +-----+-----+-----+-----+-----+-----+-----+-----+ | DSCP | ECN | RFCs 2474, +-----+-----+-----+-----+-----+-----+-----+-----+ 2780