<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Diffserv on The Official Wireshark Blog</title>
    <link>https://blog.wireshark.org/tags/diffserv/</link>
    <description>Recent content in Diffserv on The Official Wireshark Blog</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Mon, 21 Sep 2009 22:34:34 +0000</lastBuildDate><atom:link href="https://blog.wireshark.org/tags/diffserv/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Filtering DSCP</title>
      <link>https://blog.wireshark.org/2009/09/filtering-dscp/</link>
      <pubDate>Mon, 21 Sep 2009 22:34:34 +0000</pubDate>
      
      <guid>https://blog.wireshark.org/2009/09/filtering-dscp/</guid>
      <description>&lt;p&gt;The second byte in the IPv4 header (aka “those bits you’ve probably never, ever looked at”) is used for Differentiated Services, or DiffServ. It’s split into two parts: the 6 most significant bits define the &lt;a href=&#34;http://tools.ietf.org/html/rfc2474&#34;&gt;DSCP (differentiated services code point)&lt;/a&gt; and the two least significant bits are for &lt;a href=&#34;http://tools.ietf.org/html/rfc3168&#34;&gt;ECN (explicit congestion notification)&lt;/a&gt;. You can use DSCP to divide your traffic into different classes. For example, Asterisk might use the following DiffServ value, which corresponds &lt;a href=&#34;http://tools.ietf.org/html/rfc2598&#34;&gt;EF (Expedited Forwarding)&lt;/a&gt;:&lt;/p&gt;
&lt;pre style=&#34;padding-left: 30px;&#34;&gt;&lt;span style=&#34;color: #008000;&#34;&gt;DSCP&lt;/span&gt;  &lt;span style=&#34;color: #0000ff;&#34;&gt;ECN
&lt;/span&gt;&lt;span style=&#34;color: #008000;&#34;&gt;101110&lt;/span&gt;&lt;span style=&#34;color: #0000ff;&#34;&gt;00&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;If your networking equipment is sufficiently aware, this traffic will receive preferential treatment.&lt;/p&gt;
&lt;p&gt;You can filter these values pretty easily using the &lt;a href=&#34;http://www.wireshark.org/docs/dfref/i/ip.html&#34;&gt;ip.dsfield.dscp&lt;/a&gt; display filter — just right-click on the DSCP field in the packet like so:&lt;/p&gt;
&lt;div id=&#34;attachment_109&#34; style=&#34;width: 493px&#34; class=&#34;wp-caption alignnone&#34;&gt;
  &lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; aria-describedby=&#34;caption-attachment-109&#34; class=&#34;size-full wp-image-109&#34; title=&#34;dscp-filter&#34; alt=&#34;Applying a DSCP display filter&#34; src=&#34;https://blog.wireshark.org/wp-content/uploads/2009/09/dscp-filter1.png&#34; width=&#34;483&#34; height=&#34;158&#34; /&gt;
  &lt;p id=&#34;caption-attachment-109&#34; class=&#34;wp-caption-text&#34;&gt;
    Applying a DSCP display filter
  &lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;What if you need to use DSCP in a capture filter?&lt;/p&gt;
&lt;p&gt;To match against a particular DSCP codepoint using BPF (WinPcap/libpcap’s filtering language) you need to take the bit pattern, left-shift it two places to account for the ECN, and mask out the ECN. For EF (101110) you’d have do something like this:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Take 101110 and shift it left two bits: 10111000&lt;/li&gt;
&lt;li&gt;Convert it to hex: 0xb8&lt;/li&gt;
&lt;li&gt;Create a filter, masking out the ECN bits:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre style=&#34;padding-left: 30px;&#34;&gt;ip[1] &amp; 0xfc == 0xb8&lt;/pre&gt;
&lt;p&gt;Cisco has a list of code points at &lt;a href=&#34;http://www.cisco.com/en/US/tech/tk543/tk757/technologies_tech_note09186a00800949f2.shtml&#34;&gt;http://www.cisco.com/en/US/tech/tk543/tk757/technologies_tech_note09186a00800949f2.shtml&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;P.S. To make matters more confusing, the DiffServ field was originally called “Type of Service.”&lt;/p&gt;</description>
    </item>
    
  </channel>
</rss>
