<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Evolution Systems &#187; XFRM</title>
	<atom:link href="http://evolution-systems.co.uk/tag/xfrm/feed/" rel="self" type="application/rss+xml" />
	<link>http://evolution-systems.co.uk</link>
	<description>Web Development, Software Development and Linux Consultancy services</description>
	<lastBuildDate>Fri, 08 Aug 2025 09:18:44 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.42</generator>
	<item>
		<title>Linux XFRM Framework Selectors</title>
		<link>http://evolution-systems.co.uk/2008/04/17/linux-xfrm-framework-selectors-2/</link>
		<comments>http://evolution-systems.co.uk/2008/04/17/linux-xfrm-framework-selectors-2/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 14:21:34 +0000</pubDate>
		<dc:creator><![CDATA[Matthew Jakeman]]></dc:creator>
				<category><![CDATA[Matts Blog]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Selectors]]></category>
		<category><![CDATA[XFRM]]></category>

		<guid isPermaLink="false">http://evolution-systems.co.uk/wordpress/?p=507</guid>
		<description><![CDATA[Whilst progressing some code I have been writing I was recently introduced to Linux&#8217;s XFRM (transform) framework. I had not heard of this before but it can be a very useful tool for manipulating packets. The one big downside to XFRM is there is virtually no documentation on it yet. This can make working with [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Whilst progressing some code I have been writing I was recently introduced to Linux&#8217;s XFRM (transform) framework. I had not heard of this before but it can be a very useful tool for manipulating packets.</p>
<p>The one big downside to XFRM is there is virtually no documentation on it yet. This can make working with it quite tricky. I am documenting what I find out from using it here in the hope that others will find it useful.</p>
<p> The basic idea behind XFRM is that it allows you to select a packet based on a number of factors. These are all defined in /usr/include/linux/xfrm.h in a struct named xfrm_selector as defined below :</p>
<p><code>struct xfrm_selector<br />{<br />    xfrm_address_t  daddr;<br />    xfrm_address_t  saddr;<br />    __be16  dport;<br />    __be16  dport_mask;<br />    __be16  sport;<br />    __be16  sport_mask;<br />    __u16   family;<br />    __u8    prefixlen_d;<br />    __u8    prefixlen_s;<br />    __u8    proto;<br />    int ifindex;<br />    uid_t   user;<br />};</code><br />
Creating a struct of this type and setting the fields such as the source/destination addresses, ports, address masks etc, allows a packet to be selected, based on this criteria, to allow it to be transformed. By passing this information into the kernel using a nlmsghdr struct and the addattr_l() function along with a template (struct xfmr_user_tmpl) describing what action to take on the packet we can alter certain packets however we wish.</p>
<p>This is proving very useful to me in some of my current work and I will continue to post anything I think might be useful to others working in the same area on this blog.</p>
]]></content:encoded>
			<wfw:commentRss>http://evolution-systems.co.uk/2008/04/17/linux-xfrm-framework-selectors-2/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
