v0.18.0 MACsec Support & ECN+DSCP Support for IPv6
What are the major changes?
Support for MACsec (IEEE 802.1AE)
The vlan field in SlicedPacket, LaxSlicedPacket, PacketHeaders, LaxPacketHeaders has been replaced with link_exts.
Ipv4Ecn & Ipv4Dscp have been replaced by IpEcn & IpDscp.
Ipv6Header & Ipv6HeaderSlice now supports the reading & setting of IpEcn & IpDscp (thanks to @baxterjo)
LaxEtherPayloadSlice has been introduced & len_source added to EtherPayloadSlice.
source_addr() & destination_addr() methods of IpSlice, Ipv4HeaderSlice, Ipv6Header, Ipv6HeaderSlice, LaxIpSlice are now available in non-std mode (thanks to @Dominaezzz)
Minimum supported Rust version as been configured to 1.83.0 (thanks to @baxterjo)
What is MACsec (IEEE 802.1AE)?
MACsec is a protocol that allows the signing and/or encryption of packet contents from the link layer downwards. The main difference between MACsec and IPSec is that IPSec is located after the IP header while MACsec is located above the IP header and can also encrypt the contents of the IP header itself while IPSSec does not encrypt the IP header. As such MACsec is usually used to secure local networks, while IPSec is more commonly used for VPNs and alike that leave the local network.
Changes needed for MACsec Support
Adding MACsec support required some breaking changes, specifically on how VLAN headers are handled. The MACsec SECTAG is a header that can be present in the same locations as "VLAN" headers. It has no fixed position and can be located before or after VLAN headers or after the Ethernet 2 header without a VLAN header being present at all. This invalidates the assumption etherparse had in previous versions that VLAN headers are always directly located after the Ethernet2 header and that if there are multiple VLAN headers that they are directly located after each other. Now there could be a MACsec header present in between VLAN headers.
To support the different combinations of MACSec & VLAN headers the vlan field in SlicedPacket, PacketHeaders, LaxSlicedPacket & LaxPacketHeaders has been replaced with a link_exts field that can contain up to three "link extensions":
pub struct SlicedPacket<'a> {
/// Ethernet II header if present.
pub link: Option<LinkSlice<'a>>,
/// IPv4 or IPv6 header, IP extension headers & payload if present.
pub net: Option<NetSlice<'a>>,
/// TCP or UDP header & payload if present.
pub transport: Option<TransportSlice<'a>>,
}
impl<'a> SlicedPacket<'a> {
/// Maximum supported number of link extensions.
pub const LINK_EXTS_CAP: usize = 3;
LinkExtSlice, LinkExtHeader & LaxLinkExtSlice are enums that can either contain a MACsec or VLAN header:
/// A slice containing the link layer extension header (currently only Ethernet II and
/// SLL are supported).
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum LinkExtSlice<'a> {
</tr></table>
Corrected bug where SlicedPacket::from_ether_type would not set link field in result.
0.14.3
Resolved compile errors for 16 bit systems.
Add 'ether_payload' & 'ip_payload' methods to SlicedPacket types.
0.14.2
Corrected enum docs.rs links in README.md (for IpSlice & IpHeaders).
0.14.1
Corrected example in README.md (replaced ip with net).
0.14.0
Highlights
SlicedPacket & PacketHeaders now use the length fields in the headers to determine the payload length.
The payload(s) in SlicedPacket now can be accessed via the layer slices (e.g. link.unwrap().payload()).
Added LaxSlicedPacket & LaxPacketHeaders to allow for parsing of packets without length checks & other inconsistency checks present in SlicedPacket & PacketHeaders.
SlicedPacket.ip & PacketHeaders.ip have been renamed to SlicedPacket.net & PacketHeaders.net
Added no_std support.
Errors are now more fine granular (in case you want a general error type you can convert all errors via into & from into err::FromSliceError or err::ReadError).
Added to_bytes() methods to most header types.
Added slice types which contain both the header(s) and payload (e.g. IpSlice, UdpSlice).
Added payload types (e.g. IpPayloadSlice, EtherPayloadSlice) which contain the slice & information about the payload type (e.g. the IpNumber in case of an IpPayloadSlice).
What happened?
This version took more then a year to complete. Which for sure was not my plan when starting out.
I started out trying to implement correct handing of "payload lengths" (aka actually using the length fields in headers to determine the payload). This was needed, as without it, incorrect data would sometimes creep into the payload of and IP packet (see JulianSchmid/etherparse#35 ). But this "simple" feature triggered a chain reaction of changes that required me to re-architect big parts of the crate. Specifically the error types were an major issue, which I did not forsee costing so much time and at some time.
But no matter, now it is done. Sadly there are quiet some breaking changes, but I think the crate is now in a better position for future changes & behaves correcter then in the past. There are also quiet a lot of quality of life changes.
New
Added non-allocating to_bytes() methods that return arrayvec::ArrayVec<u8, Header::MAX_LEN> to the following headers:
Ipv4Header
Added LaxSlicedPacket & LaxPacketHeaders to allow for parsing of packets without length checks & other inconsistency checks present in SlicedPacket & PacketHeaders.
no_std Support was added. To enable use etherparse without default features: etherparse = { version = "0.14", default-features = false }
Added LEN or MIN_LEN & MAX_LEN constants to all headers & packets.
Added InternetSlice::source_addr & InternetSlice::destination_addr to get the source & destination as std::net::IpAddr (thanks to @nagy)
... (truncated)
Commits
c74726f Merge pull request #124 from JulianSchmid/ipv6-slice-ecn-dscp
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase will rebase this PR
@dependabot recreate will recreate this PR, overwriting any edits that have been made to it
@dependabot merge will merge this PR after your CI passes on it
@dependabot squash and merge will squash and merge this PR after your CI passes on it
@dependabot cancel merge will cancel a previously requested merge and block automerging
@dependabot reopen will reopen this PR if it is closed
@dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
@dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
@dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
[//]: # (dependabot-start)
⚠️ **Dependabot is rebasing this PR** ⚠️
Rebasing might not happen immediately, so don't worry if this takes some time.
Note: if you make any changes to this PR yourself, they will take precedence over the rebase.
---
[//]: # (dependabot-end)
Bumps [etherparse](https://github.com/JulianSchmid/etherparse) from 0.13.0 to 0.18.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/JulianSchmid/etherparse/releases">etherparse's releases</a>.</em></p>
<blockquote>
<h2>v0.18.0 MACsec Support & ECN+DSCP Support for IPv6</h2>
<h2>What are the major changes?</h2>
<ul>
<li>Support for MACsec (IEEE 802.1AE)</li>
<li>The <code>vlan</code> field in <code>SlicedPacket</code>, <code>LaxSlicedPacket</code>, <code>PacketHeaders</code>, <code>LaxPacketHeaders</code> has been replaced with <code>link_exts</code>.</li>
<li><code>Ipv4Ecn</code> & <code>Ipv4Dscp</code> have been replaced by <code>IpEcn</code> & <code>IpDscp</code>.</li>
<li><code>Ipv6Header</code> & <code>Ipv6HeaderSlice</code> now supports the reading & setting of <code>IpEcn</code> & <code>IpDscp</code> (thanks to <a href="https://github.com/baxterjo"><code>@baxterjo</code></a>)</li>
<li><code>LaxEtherPayloadSlice</code> has been introduced & <code>len_source</code> added to <code>EtherPayloadSlice</code>.</li>
<li><code>source_addr()</code> & <code>destination_addr()</code> methods of <code>IpSlice</code>, <code>Ipv4HeaderSlice</code>, <code>Ipv6Header</code>, <code>Ipv6HeaderSlice</code>, <code>LaxIpSlice</code> are now available in non-std mode (thanks to <a href="https://github.com/Dominaezzz"><code>@Dominaezzz</code></a>)</li>
<li>Minimum supported Rust version as been configured to 1.83.0 (thanks to <a href="https://github.com/baxterjo"><code>@baxterjo</code></a>)</li>
</ul>
<h3>What is MACsec (IEEE 802.1AE)?</h3>
<p>MACsec is a protocol that allows the signing and/or encryption of packet contents from the link layer downwards. The main difference between MACsec and IPSec is that IPSec is located after the IP header while MACsec is located above the IP header and can also encrypt the contents of the IP header itself while IPSSec does not encrypt the IP header. As such MACsec is usually used to secure local networks, while IPSec is more commonly used for VPNs and alike that leave the local network.</p>
<h3>Changes needed for MACsec Support</h3>
<p>Adding MACsec support required some breaking changes, specifically on how VLAN headers are handled. The MACsec SECTAG is a header that can be present in the same locations as "VLAN" headers. It has no fixed position and can be located before or after VLAN headers or after the Ethernet 2 header without a VLAN header being present at all. This invalidates the assumption <code>etherparse</code> had in previous versions that VLAN headers are always directly located after the Ethernet2 header and that if there are multiple VLAN headers that they are directly located after each other. Now there could be a MACsec header present in between VLAN headers.</p>
<p>To support the different combinations of MACSec & VLAN headers the <code>vlan</code> field in <code>SlicedPacket</code>, <code>PacketHeaders</code>, <code>LaxSlicedPacket</code> & <code>LaxPacketHeaders</code> has been replaced with a <code>link_exts</code> field that can contain up to three "link extensions":</p>
<pre lang="Diff"><code>pub struct SlicedPacket<'a> {
/// Ethernet II header if present.
pub link: Option<LinkSlice<'a>>,
<ul>
<li>/// Single or double vlan headers if present.</li>
<li>pub vlan: Option<VlanSlice<'a>>,</li>
</ul>
<ul>
<li>/// Link extensions (VLAN & MAC Sec headers).</li>
<li>pub link_exts: ArrayVec<LinkExtSlice<'a>, { SlicedPacket::LINK_EXTS_CAP }>,</li>
</ul>
<pre><code>/// IPv4 or IPv6 header, IP extension headers &amp; payload if present.
pub net: Option&lt;NetSlice&lt;'a&gt;&gt;,
/// TCP or UDP header &amp; payload if present.
pub transport: Option&lt;TransportSlice&lt;'a&gt;&gt;,
</code></pre>
<p>}</p>
<p>impl<'a> SlicedPacket<'a> {</p>
<ul>
<li>/// Maximum supported number of link extensions.</li>
<li>pub const LINK_EXTS_CAP: usize = 3;
</code></pre></li>
</ul>
<p><code>LinkExtSlice</code>, <code>LinkExtHeader</code> & <code>LaxLinkExtSlice</code> are enums that can either contain a MACsec or VLAN header:</p>
<pre lang="Rust"><code>/// A slice containing the link layer extension header (currently only Ethernet II and
/// SLL are supported).
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum LinkExtSlice<'a> {
</tr></table>
</code></pre>
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/JulianSchmid/etherparse/blob/master/changelog.md">etherparse's changelog</a>.</em></p>
<blockquote>
<h1>Changelog:</h1>
<h2>0.15.0</h2>
<ul>
<li>Added Linux SLL Support (thanks to <a href="https://github.com/RabadanDotDev"><code>@RabadanDotDev</code></a>)</li>
<li>Corrected bug where <code>SlicedPacket::from_ether_type</code> would not set link field in result.</li>
</ul>
<h2>0.14.3</h2>
<ul>
<li>Resolved compile errors for 16 bit systems.</li>
<li>Add 'ether_payload' & 'ip_payload' methods to SlicedPacket types.</li>
</ul>
<h2>0.14.2</h2>
<p>Corrected enum docs.rs links in README.md (for <code>IpSlice</code> & <code>IpHeaders</code>).</p>
<h2>0.14.1</h2>
<p>Corrected example in README.md (replaced <code>ip</code> with <code>net</code>).</p>
<h2>0.14.0</h2>
<h3>Highlights</h3>
<ul>
<li><code>SlicedPacket</code> & <code>PacketHeaders</code> now use the length fields in the headers to determine the payload length.</li>
<li>The payload(s) in <code>SlicedPacket</code> now can be accessed via the layer slices (e.g. <code>link.unwrap().payload()</code>).</li>
<li>Added <code>LaxSlicedPacket</code> & <code>LaxPacketHeaders</code> to allow for parsing of packets without length checks & other inconsistency checks present in <code>SlicedPacket</code> & <code>PacketHeaders</code>.</li>
<li><code>SlicedPacket.ip</code> & <code>PacketHeaders.ip</code> have been renamed to <code>SlicedPacket.net</code> & <code>PacketHeaders.net</code></li>
<li>Added <code>no_std</code> support.</li>
<li>Errors are now more fine granular (in case you want a general error type you can convert all errors via <code>into</code> & <code>from</code> into <code>err::FromSliceError</code> or <code>err::ReadError</code>).</li>
<li>Added <code>to_bytes()</code> methods to most header types.</li>
<li>Added slice types which contain both the header(s) and payload (e.g. <code>IpSlice</code>, <code>UdpSlice</code>).</li>
<li>Added payload types (e.g. <code>IpPayloadSlice</code>, <code>EtherPayloadSlice</code>) which contain the slice & information about the payload type (e.g. the IpNumber in case of an <code>IpPayloadSlice</code>).</li>
</ul>
<h3>What happened?</h3>
<p>This version took more then a year to complete. Which for sure was not my plan when starting out.</p>
<p>I started out trying to implement correct handing of "payload lengths" (aka actually using the length fields in headers to determine the payload). This was needed, as without it, incorrect data would sometimes creep into the payload of and IP packet (see <a href="https://redirect.github.com/JulianSchmid/etherparse/issues/35">JulianSchmid/etherparse#35</a> ). But this "simple" feature triggered a chain reaction of changes that required me to re-architect big parts of the crate. Specifically the error types were an major issue, which I did not forsee costing so much time and at some time.</p>
<p>But no matter, now it is done. Sadly there are quiet some breaking changes, but I think the crate is now in a better position for future changes & behaves correcter then in the past. There are also quiet a lot of quality of life changes.</p>
<h3>New</h3>
<ul>
<li>Added non-allocating <code>to_bytes()</code> methods that return <code>arrayvec::ArrayVec<u8, Header::MAX_LEN></code> to the following headers:
<ul>
<li><code>Ipv4Header</code></li>
</ul>
</li>
<li>Added <code>LaxSlicedPacket</code> & <code>LaxPacketHeaders</code> to allow for parsing of packets without length checks & other inconsistency checks present in <code>SlicedPacket</code> & <code>PacketHeaders</code>.</li>
<li><code>no_std</code> Support was added. To enable use etherparse without default features: <code>etherparse = { version = "0.14", default-features = false }</code></li>
<li>Added <code>LEN</code> or <code>MIN_LEN</code> & <code>MAX_LEN</code> constants to all headers & packets.</li>
<li>Added <code>InternetSlice::source_addr</code> & <code>InternetSlice::destination_addr</code> to get the source & destination as <code>std::net::IpAddr</code> (thanks to <a href="https://github.com/nagy"><code>@nagy</code></a>)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/JulianSchmid/etherparse/commit/c74726f16cf0782499d51ded1e6ef64f397caa85"><code>c74726f</code></a> Merge pull request <a href="https://redirect.github.com/JulianSchmid/etherparse/issues/124">#124</a> from JulianSchmid/ipv6-slice-ecn-dscp</li>
<li><a href="https://github.com/JulianSchmid/etherparse/commit/f140812581e79a6ed10e89f84fcccc25dd0e29f4"><code>f140812</code></a> Add ecn & dscp to Ipv6HeaderSlice</li>
<li><a href="https://github.com/JulianSchmid/etherparse/commit/3864de03c9c085711b88f5fb7bd7984a415a13e0"><code>3864de0</code></a> Merge pull request <a href="https://redirect.github.com/JulianSchmid/etherparse/issues/123">#123</a> from JulianSchmid/v-0-18-update</li>
<li><a href="https://github.com/JulianSchmid/etherparse/commit/77ddeb4b0e1446d4abef746596b7e30252fa374c"><code>77ddeb4</code></a> Update version to 0.18.0</li>
<li><a href="https://github.com/JulianSchmid/etherparse/commit/1b01e71bbe0fcbcfe51ff3f5bcfd0a47be14c03f"><code>1b01e71</code></a> Merge pull request <a href="https://redirect.github.com/JulianSchmid/etherparse/issues/118">#118</a> from baxterjo/baxterjo/add-traffic-class-support-ipv6</li>
<li><a href="https://github.com/JulianSchmid/etherparse/commit/2bfe416f7d74f88bcd5b2bfbf8a5907d3446eb21"><code>2bfe416</code></a> Fix cargo doc warnings</li>
<li><a href="https://github.com/JulianSchmid/etherparse/commit/68debf265bc3c9ee1d1ddeaa0f38ca9ab7444ed0"><code>68debf2</code></a> Add IpDscpKnown & fix non-std build</li>
<li><a href="https://github.com/JulianSchmid/etherparse/commit/6280706350f1689cb07ee2b6abbd221a5f48e3eb"><code>6280706</code></a> Aligned ECN & DSCP between IPv4 & IPv6</li>
<li><a href="https://github.com/JulianSchmid/etherparse/commit/818ad09b998b77f8eeeb190f9022fc493e264745"><code>818ad09</code></a> Made ecn and dscp mods a bit more readable and added doc tests.</li>
<li><a href="https://github.com/JulianSchmid/etherparse/commit/a8d1eb4a20dc1743b9281f986e8388f45d14b596"><code>a8d1eb4</code></a> Added Ipv6 traffic class field setters and getters.</li>
<li>Additional commits viewable in <a href="https://github.com/JulianSchmid/etherparse/compare/v0.13.0...v0.18.0">compare view</a></li>
</ul>
</details>
<br />
[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
⚠️ Dependabot is rebasing this PR ⚠️
Rebasing might not happen immediately, so don't worry if this takes some time.
Note: if you make any changes to this PR yourself, they will take precedence over the rebase.
Bumps etherparse from 0.13.0 to 0.18.0.
Release notes
Sourced from etherparse's releases.
... (truncated)
Changelog
Sourced from etherparse's changelog.
... (truncated)
Commits
c74726fMerge pull request #124 from JulianSchmid/ipv6-slice-ecn-dscpf140812Add ecn & dscp to Ipv6HeaderSlice3864de0Merge pull request #123 from JulianSchmid/v-0-18-update77ddeb4Update version to 0.18.01b01e71Merge pull request #118 from baxterjo/baxterjo/add-traffic-class-support-ipv62bfe416Fix cargo doc warnings68debf2Add IpDscpKnown & fix non-std build6280706Aligned ECN & DSCP between IPv4 & IPv6818ad09Made ecn and dscp mods a bit more readable and added doc tests.a8d1eb4Added Ipv6 traffic class field setters and getters.Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot mergewill merge this PR after your CI passes on it@dependabot squash and mergewill squash and merge this PR after your CI passes on it@dependabot cancel mergewill cancel a previously requested merge and block automerging@dependabot reopenwill reopen this PR if it is closed@dependabot closewill close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot show <dependency name> ignore conditionswill show all of the ignore conditions of the specified dependency@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)