<?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>shapeshifter.se &#187; Summer of Code 2007</title>
	<atom:link href="http://www.shapeshifter.se/tag/soc2007/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shapeshifter.se</link>
	<description>Mostly miscellaneous technical mumbo-jumbo.</description>
	<lastBuildDate>Mon, 11 Jul 2011 14:19:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>mdnsd progress</title>
		<link>http://www.shapeshifter.se/2007/06/20/mdnsd-progress/</link>
		<comments>http://www.shapeshifter.se/2007/06/20/mdnsd-progress/#comments</comments>
		<pubDate>Wed, 20 Jun 2007 16:20:39 +0000</pubDate>
		<dc:creator>fli</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Summer of Code 2007]]></category>

		<guid isPermaLink="false">http://www.shapeshifter.se/2007/06/20/mdnsd-progress/</guid>
		<description><![CDATA[It&#8217;s been way too long since I wrote something here, but no writing does not equal no coding  
I&#8217;ve finished of several quite large subsystems in mdnsd, including the cache and the record database (which is used for self-claimed records).  This means that it&#8217;s able to receive and cache records, and able to [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been way too long since I wrote something here, but no writing does not equal no coding <img src='http://www.shapeshifter.se/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I&#8217;ve finished of several quite large subsystems in mdnsd, including the cache and the record database (which is used for self-claimed records).  This means that it&#8217;s able to receive and cache records, and able to read self-claimed records off a configuration file and add them to its database.<span id="more-30"></span></p>
<p>The configuration file is quite simple, while still being flexible enough to allow more advanced configurations, it&#8217;s however a bit different from a regular DNS configuration as the namespace in mDNS is quite flat.<br />
This is a sample that claims a A record, AAAA record and PTR records for each address;</p>
<pre>
# A zone is only a way to avoid duplicate typing,
# one could have skipped it and simply
# used $(hostname).local. as the rrset.
zone "local." {
# A rrset holds a name and one or more resources, a
# resource type can hold multiple data sets
rrset "$(hostname)" {
alt = "$(hostname)-$(ifname)";
# This is a resource for the IN type A with the data set to $(ifaddrs4)
res A { data = "$(ifaddrs4)"; }
res AAAA { data = "$(ifaddrs6)"; }
}
}
rrset "$(ifaddrs4)" {
res PTR { data = "$(hostname).local."; }
}
rrset "$(ifaddrs6)" {
res PTR { data = "$(hostname).local."; }
}</pre>
<p>(It&#8217;s supposed to be white spaces in there but they seem to disappear)</p>
<p>This also demonstrates the quite nifty variable systems that is in place. A variable will be expanded to one or more lines of data, this data is context aware, which means that putting $(ifaddr4) as a rrset name will result in a in-addr.arpa-domain while setting $(ifaddr4) as a resource data on a IN resource will encode it into a regular (binary) ip-address.<br />
On our imaginary host foobar with the interface foo0, which has two ipv4 addresses (10.0.0.1, 10.0.0.2) and one ipv6 address (fe80::20a:5eff:fe5c:f5d7), the above configuration would result in the following;</p>
<pre>
foobar.local. IN A 10.0.0.1
foobar.local. IN A 10.0.0.2
foobar.local. IN AAAA fe80::20a:5eff:fe5c:f5d7
1.0.0.10.in-addr.arpa. IN PTR foobar.local.
2.0.0.10.in-addr.arpa. IN PTR foobar.local.
7.d.5.f.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.a.5.e.f.f.f.e.5.c.f.5.d.7.ip6.arpa. IN PTR foobar.local.</pre>
<p>The records will automatically adjust to any changes to the interface configuration.</p>
<p>Any settings that should only be set on a specific interface can be wrapped inside a interface &#8220;foo0&#8243; {} statement.<br />
Note how one configuration line expands into several real records.</p>
<p>Next up will be some sort of output queue and routines to send responses (packet construction routines are already in place in the low-level stack).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shapeshifter.se/2007/06/20/mdnsd-progress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Never let a tree do a hash table&#8217;s job</title>
		<link>http://www.shapeshifter.se/2007/05/25/never-let-a-tree-do-a-hash-tables-job/</link>
		<comments>http://www.shapeshifter.se/2007/05/25/never-let-a-tree-do-a-hash-tables-job/#comments</comments>
		<pubDate>Fri, 25 May 2007 15:58:41 +0000</pubDate>
		<dc:creator>fli</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Summer of Code 2007]]></category>

		<guid isPermaLink="false">http://www.shapeshifter.se/2007/05/25/never-let-a-tree-do-a-hash-tables-job/</guid>
		<description><![CDATA[&#8230;or something like that.
I&#8217;ve been toying and experimenting with different data structures to represent the domain name cache in mdnsd.
These are the structures I&#8217;ve seriously considered

Radix tree/trie &#8211; It&#8217;s attractive to do lookup in O(k), but with a key length of 255 bytes (utf8) the tree would be huge, 2040 bits. Not sure it would [...]]]></description>
			<content:encoded><![CDATA[<p>&#8230;or something like that.</p>
<p>I&#8217;ve been toying and experimenting with different data structures to represent the domain name cache in mdnsd.</p>
<p>These are the structures I&#8217;ve seriously considered</p>
<ul>
<li>Radix tree/trie &#8211; It&#8217;s attractive to do lookup in O(k), but with a key length of 255 bytes (utf8) the tree would be huge, 2040 bits. Not sure it would be effective even with all the compression techniques in the book.</li>
<li>Splay tree (self-balancing binary tree), scales well but key comparisons must be strcmp().</li>
<li>Hash table, well obviously fast but there could be scaling problems as collisions become lager.</li>
<li>&#8220;Chained&#8221; hash table &#8211; Use the fact that domain names are separated in labels (label1.label2.tld) and use one hash table on each level.</li>
</ul>
<p><span id="more-29"></span>Very early on I also considered skip lists, but a test showed that it didn&#8217;t beat the splay tree, so it got ditched.  Radix tree were also ditched as I believe it will be quite hard to make it effective for such large keys.</p>
<p>I measured the performance of the three remaining structures using 1000000 random domain names, the numbers are an average of 10 runs.  Code compiled with -O2, tests performed on a Pentium M 1.7Ghz. &#8220;add&#8221; refers to the time it took to insert 1000000 entries, and &#8220;find&#8221; refers to the time it took to find those 1000000 entries.</p>
<ul>
<li>Splay tree (sys/tree.h),  add 4.90300 seconds,  find   3.3907 seconds</li>
<li>&#8220;Chained&#8221; hash table, add 7.62640 seconds, find 1.38780 seconds</li>
<li>Hash table, add 2.19680 seconds, find 1.04970 seconds</li>
</ul>
<p>The reason the chained hash table has such a bad add time is mainly because of malloc() call overhead in the hash table initiation for each level, there is code to reduce malloc overhead (pre-allocating a large chunk and splitting it) but it&#8217;s not enough.  The hash table is  self-growing and will double in size when any bucket hits a threshold number of collisions, experiments showed that up to about 10 collisions per bucket was reasonable. The tests above that included a hash table had a maximum hash table size of 131072 buckets,  obviously by increasing the max size (trading memory for speed) you get better performance.</p>
<p>My initial doubts that a hash table would scale bad were not true, 1000000 entries is A LOT more than what the mdnsd responder will ever cache in practice, and because it&#8217;s self-growing it won&#8217;t waste a lot of memory. I guess I&#8217;ll use a hash table then.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shapeshifter.se/2007/05/25/never-let-a-tree-do-a-hash-tables-job/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>mDNS stack to the responder daemon</title>
		<link>http://www.shapeshifter.se/2007/05/09/mdns-stack-to-the-responder-daemon/</link>
		<comments>http://www.shapeshifter.se/2007/05/09/mdns-stack-to-the-responder-daemon/#comments</comments>
		<pubDate>Wed, 09 May 2007 07:32:30 +0000</pubDate>
		<dc:creator>fli</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Summer of Code 2007]]></category>

		<guid isPermaLink="false">http://www.shapeshifter.se/2007/05/09/mdns-stack-to-the-responder-daemon/</guid>
		<description><![CDATA[Last night (local time) I submitted my initial mDNS stack to p4, it forms the foundation of the responder daemon (mdnsd).  The stack is more or less complete, but I&#8217;ll see how it works out once I integrate it with the rest of the application, there will probably be some more code re-factoring (and [...]]]></description>
			<content:encoded><![CDATA[<p>Last night (local time) I submitted my initial mDNS stack to p4, it forms the foundation of the responder daemon (mdnsd).  The stack is more or less complete, but I&#8217;ll see how it works out once I integrate it with the rest of the application, there will probably be some more code re-factoring (and bug fixing).<span id="more-27"></span></p>
<p>The stack provides an abstract interface to the underlying sockets, it takes care of multicast group memberships,  buffer management, packet creation and parsing. The interface is the same both for IPv4 and IPv6 which was one of the main requirements. As for DNS names the interface uses wide characters (wchar_t) only and properly encodes/decodes to UTF-8 (just as the specification says), this means that one should be able to use exotic characters natively (such as smörgåsbord.local) without punny-encoding. Oh, and it also does optimal dns name compression in the packets.</p>
<p>All my initial tests shows that the stack itself works well and it&#8217;s able to parse all packets my Mac OS X client is sending.  I&#8217;ve also been running it together with network fuzzer (<a href="http://sam.zoy.org/zzuf/">zzuf</a>) while spewing packets on it, haven&#8217;t crashed this far (famous last words) <img src='http://www.shapeshifter.se/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .  In addition to this I have a few static test cases I&#8217;m going to put it through, which it should support, at least in theory that is. I also plan to run it through gprof to see if there are any dead-obvious sections that could be optimized.</p>
<p>But, all in good time. Now I&#8217;m gonna disappear for a while and take care of some school stuff.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shapeshifter.se/2007/05/09/mdns-stack-to-the-responder-daemon/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Multicast DNS, Service Discovery, etc</title>
		<link>http://www.shapeshifter.se/2007/04/17/multicast-dns-service-discovery-etc/</link>
		<comments>http://www.shapeshifter.se/2007/04/17/multicast-dns-service-discovery-etc/#comments</comments>
		<pubDate>Tue, 17 Apr 2007 12:54:02 +0000</pubDate>
		<dc:creator>fli</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Summer of Code 2007]]></category>

		<guid isPermaLink="false">http://www.shapeshifter.se/2007/04/17/multicast-dns-service-discovery-etc/</guid>
		<description><![CDATA[I&#8217;ll be hacking on Multicast DNS and Service Discovery as a part of this years Summer of Code, my mentor is Bruce M. Simpson.
There are some initial information about the project on the FreeBSD wiki, I&#8217;ll try to keep it updated as time goes.  The main priority is to get the responder running and [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll be hacking on Multicast DNS and Service Discovery as a part of this years Summer of Code, my mentor is <a href="http://wiki.freebsd.org/BruceSimpson">Bruce M. Simpson</a>.</p>
<p>There are some initial information about the project on the <a href="http://wiki.freebsd.org/MulticastDNS">FreeBSD wiki</a>, I&#8217;ll try to keep it updated as time goes.  The main priority is to get the responder running and to create a clean client API.</p>
<p>I already have some code, I just need to get the hang of perforce so I can submit it <img src='http://www.shapeshifter.se/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.shapeshifter.se/2007/04/17/multicast-dns-service-discovery-etc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

