<?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>Col senno di poi &#187; english</title>
	<atom:link href="http://blog.bardland.org/category/english/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.bardland.org</link>
	<description>inno alla procrastinazione</description>
	<lastBuildDate>Tue, 31 Aug 2010 14:31:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Arch Linux Eclipse plug-in packaging: a proposal</title>
		<link>http://blog.bardland.org/2008/11/20/arch-linux-eclipse-plug-in-packaging-a-proposal/</link>
		<comments>http://blog.bardland.org/2008/11/20/arch-linux-eclipse-plug-in-packaging-a-proposal/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 22:44:02 +0000</pubDate>
		<dc:creator>bardo</dc:creator>
				<category><![CDATA[arch]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[g33k1ng around]]></category>
		<category><![CDATA[PKGBUILD]]></category>
		<category><![CDATA[dropins]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[ganymede]]></category>
		<category><![CDATA[proposal]]></category>

		<guid isPermaLink="false">http://blog.bardland.org/?p=88</guid>
		<description><![CDATA[Eclipse plugins are basically structured the same, but there has never been a standardization proposal to make them consistent and easy to package. It took some time for me to fully understand how the Eclipse plug-in system actually works, especially since Ganymede&#8217;s coming, and even more time to develop a PKGBUILD prototype that would fit [...]]]></description>
			<content:encoded><![CDATA[<p>Eclipse plugins are basically structured the same, but there has never been a standardization proposal to make them consistent and easy to package. It took some time for me to fully understand how the Eclipse plug-in system actually works, especially since Ganymede&#8217;s coming, and even more time to develop a PKGBUILD prototype that would fit most plugins with minor modifications. Here&#8217;s the result of this work, for which I surely have to thank Jonathan Wiersma: he&#8217;s been really great in helping me in this matter.</p>
<p><span id="more-88"></span></p>
<h3>1. The PKGBUILD</h3>
<p>Long story short, here&#8217;s the code, I&#8217;ll comment most important choices later on. I&#8217;m using eclipse-mylyn as an example.</p>
<blockquote>
<pre>pkgname=eclipse-mylyn
pkgver=3.0.3
pkgrel=1
pkgdesc="A task-focused interface for Eclipse"
arch=('i686' 'x86_64')
url="http://www.eclipse.org/mylyn/"
license=('EPL')
depends=('eclipse')
optdepends=('bugzilla: ticketing support')
source=(http://download.eclipse.org/tools/mylyn/update/mylyn-${pkgver}-e3.4.zip)
md5sums=('e98cd7ab3c5d5aeb7c32845844f85c22')

build() {
  _dest=${pkgdir}/usr/share/eclipse/dropins/${pkgname/eclipse-}/eclipse

  cd ${srcdir}

  # Features
  find features -type f -name *.jar | while read _feature ; do
    if [[ ${_feature} =~ (.*\.jar$) ]] ; then
      install -dm755 ${_dest}/${_feature%*.jar}
      cd ${_dest}/${_feature/.jar}
      jar xf ${srcdir}/${_feature} || return 1
    else
      install -Dm644 ${_feature} ${_dest}/${_feature}
    fi
  done

  # Plugins
  find plugins -type f | while read _plugin ; do
    install -Dm644 ${_plugin} ${_dest}/${_plugin}
  done
}</pre>
</blockquote>
<h3>2. Package naming and makedepends</h3>
<p>Packages should be named eclipse-<em>pluginname</em>, so that they&#8217;re recognizable as eclipse-related packages and it&#8217;s easy to extract the plugin name with a simple shell substitution like ${pkgname/eclipse-}, not having to resort to the unneded ${_realname} variable. The plugin name is necessary to tidy up everything during installation and avoid conflicts.</p>
<p><span style="text-decoration: line-through;">I tried using bsdtar instead of unzip to remove the make dependency, but the test was negative: the archives I tried spitted out lots of errors, so I went the easy way. If someone makes it with bsdtar, I&#8217;ll be glad to modify the script.<br />
</span><span style="text-decoration: underline;">UPDATE:</span> I was noticed that I can directly use jar, which the user already has since it&#8217;s part of the JRE. This is great, since it spares a makedepend! However, jar can&#8217;t extract to directories other than the current one: this means that, after the directory creation, it&#8217;s necessary to <em>cd</em> before extracting. Since there were many occurrences of the destination path I decided to use a custom variable even though somebody might not like it, because there&#8217;s a great improvement in readability.</p>
<h3>3. File locations</h3>
<p>Eclipse 3.4 (Ganymede) introduced a new way of handling plugins: the <em>dropins</em> folder (located in <em>/usr/share/eclipse/dropins</em>). Eclipse scans this folder looking for plugins, and it supports many directory structures. Source archives provide two directories, <em>features</em> and <em>plugins</em>, each one packed up with jar files. The preferred <em>dropins</em> structure should look like this:</p>
<blockquote><p>/usr/share/eclipse/dropins/<em>pluginname</em>/features/<em>feature1</em>/&#8230;<br />
/usr/share/eclipse/dropins/<em>pluginname</em>/features/<em>feature2</em>/&#8230;<br />
/usr/share/eclipse/dropins/<em>pluginname</em>/plugins/<em>plugin1.jar</em><br />
/usr/share/eclipse/dropins/<em>pluginname</em>/plugins/<em>plugin2.jar</em></p></blockquote>
<p>This structure allows for mixing different versions of libraries that may be needed by different plugins while being clear about which package owns what. It will also avoid conflicts in case different packages provide the same library. The only alternative would be splitting every package from its libraries, with all the extra fuss it requires, and it wouldn&#8217;t even be guaranteed to work because of packages needing older library versions.<br />
Features have to be unjarred since Eclipse won&#8217;t detect them otherwise, and the whole plugin installation won&#8217;t work. This happens because Eclipse treats update sites and local installations differently (don&#8217;t ask me why, it just does).</p>
<h3>3. The build() function</h3>
<p>First thing to be noticed is the <em>cd ${srcdir}</em> command. Usually source archives extract the <em>features</em> and <em>plugins</em> folders directly under ${srcdir}, but this is not always the case. Anyway, for most non-(<em>de facto</em>)-standard plugins this is the only line that needs to be changed.<br />
Next is the <em>features</em> section. It creates the necessary directories, one for every jar file, and extracts the jar in the corresponding directory. Similarly, the <em>plugins</em> section installs the jar files in their directory. A <em>while</em> cycle is used to prevent funny-named files</p>
<h3>4. Conclusions</h3>
<p>So here it is. I hope it&#8217;s clear why I&#8217;m proposing to standardize Eclipse plugins, and why I took certain routes instead of others. I know it looks a bit complicated for a prototype PKGBUILD, but I think it&#8217;s the best way to handle all the problems I&#8217;ve encountered. Comments, improvements and corrections are, as always, very welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bardland.org/2008/11/20/arch-linux-eclipse-plug-in-packaging-a-proposal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Policy-based routing with Debian Lenny</title>
		<link>http://blog.bardland.org/2008/11/16/policy-based-routing-with-debian-lenny/</link>
		<comments>http://blog.bardland.org/2008/11/16/policy-based-routing-with-debian-lenny/#comments</comments>
		<pubDate>Sun, 16 Nov 2008 00:01:22 +0000</pubDate>
		<dc:creator>bardo</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[g33k1ng around]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[iproute2]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[lenny]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[pbr]]></category>
		<category><![CDATA[policy-based routing]]></category>

		<guid isPermaLink="false">http://blog.bardland.org/?p=76</guid>
		<description><![CDATA[This blog post is dedicated to explaining what policy-based routing (PBR) is and how it can work in Debian GNU/Linux. There are many articles and tutorials about this topic, but I wasn&#8217;t able to find complete and up-to-date source of information. Since it took many moons for me to figure out the right setup I [...]]]></description>
			<content:encoded><![CDATA[<p>This blog post is dedicated to explaining what policy-based routing (PBR) is and how it can work in Debian GNU/Linux. There are many articles and tutorials about this topic, but I wasn&#8217;t able to find complete and up-to-date source of information. Since it took many moons for me to figure out the right setup I decided to document the whole thing for everyone else that may need to do the same thing.<br />
This guide is written with Debian Lenny in mind, and tries to be complete and easy to understand. Nevertheless you will need some basic network skills to get through it.</p>
<h3><span id="more-76"></span></h3>
<h2><strong><strong>So, what is PBR? And do I need it?</strong></strong></h2>
<p>Routers don&#8217;t usually need to make difficult choices: they often connect a network to another one, for example your LAN to the Internet, and just need the so-called <em>static routing</em>. In simple words, they just look at the recipient of the packet and forward it to the next router on the right channel.<br />
The problem arises when a router is connected to the same network through two or more different channels, and needs to choose which route is the best one based on some predefined criteria. This is what PBR is about. PBR could act, for example, as a load-balancer for high-demand networks, or to route preferential traffic on dedicated channels. We will cover the latter case, since the former is much more trivial to implement.</p>
<h3><strong>The right tools for the job</strong></h3>
<p>There are two tools we will need to get the job done, iproute2 and iptables: iproute2 takes care of all the routing part, while iptables, traditionally used as a firewall, has the task to tell iproute2 which packets go to which channel.<br />
For simpler cases the sole iproute2 is needed, since it already allows to define basic rules, like discriminating on the sender of a particular packet, but sometimes this is isn&#8217;t enough. We want to be able to decide routing for every single packet without limits on the rule to follow. This is where iptables comes into play: it will use its powerful packet matching abilities to mark packages and help iproute2 taking decisions.</p>
<h3><strong>Our setup</strong></h3>
<p>We will work with a machine that acts as a firewall/router for a LAN and has two available uplinks. The LAN interface will be eth0, while the WAN interfaces will be eth1 and eth2. Let&#8217;s suppose we want to route all the web traffic from the LAN through eth1, while forwarding all the rest through eth2.<br />
For simplicity, eth0 address will be 192.168.0.1, eth1 will be 192.168.1.1 and eth2 will be 192.168.2.1. All networks will have a netmask of 255.255.255.0, and their next hop will be a machine on the same network with an IP address of 192.168.x.2.<br />
The LAN will be masqueraded by the firewall/router with iptables, as this is the most common case in home and company networks.</p>
<h2>The hard work</h2>
<h3><strong>Creating the routing tables</strong></h3>
<p>First we need to define two new routing tables, one for every outgoing line. Let&#8217;s modify <em>/etc/iproute2/rt_tables</em> and add a couple of lines under the <em>local</em> section, so that it looks this way:</p>
<blockquote><p>#<br />
# reserved values<br />
#<br />
255    local<br />
254    main<br />
253    default<br />
0    unspec<br />
#<br />
# local<br />
#<br />
100    web<br />
200    rest</p></blockquote>
<p>Here we have defined two tables called <em>web</em> and <em>rest</em>, respectively with an ID of 100 and 200. IDs are arbitrary, just stay within the 1-252 range. I chose 100 and 200 because they allow for further tables to be added before or after them.</p>
<h3><strong>Setting up routing</strong></h3>
<p>Next step is explaining Debian which routes are available and how routing should be done. The file we need to modify is <em>/etc/network/interfaces</em>, and these are the relevant parts:</p>
<blockquote><p>auto lo eth0 eth1 eth2<br />
allow-hotplug eth0<br />
allow-hotplug eth1<br />
allow-hotplug eth2</p>
<p>iface lo inet loopback<br />
post-up ip route add 127.0.0.0/8 dev lo table web<br />
post-up ip route add 127.0.0.0/8 dev lo table rest</p>
<p>iface eth0 inet static<br />
address 192.168.0.1<br />
netmask 255.255.255.0<br />
post-up ip route add 192.168.0.0/24 dev eth0 table web<br />
post-up ip route add 192.168.0.0/24 dev eth0 table rest</p>
<p>iface eth1 inet static<br />
address 192.168.1.1<br />
netmask 255.255.255.0<br />
post-up ip route add 192.168.1.0/24 dev eth1 src 192.168.1.1 table web<br />
post-up ip route add default via 192.168.1.2 table web<br />
post-up ip rule add from 192.168.1.1 table web<br />
post-up ip rule add fwmark 0&#215;1 table web</p>
<p>iface eth2 inet static<br />
address 192.168.2.1<br />
netmask 255.255.255.0<br />
post-up ip route add 192.168.2.0/24 dev eth2 src 192.168.2.1 table rest<br />
post-up ip route add default via 192.168.2.2 table rest<br />
post-up ip route add default via 192.168.2.2<br />
post-up ip rule add from 192.168.2.1 table rest<br />
post-up ip rule add fwmark 0&#215;2 table rest</p></blockquote>
<h5><strong>WARNING:</strong> the <em>interfaces</em> file doesn&#8217;t support end-of-line comments, so don&#8217;t use them or you&#8217;ll probably break the setup!<br />
<strong>WARNING #2:</strong> this is just a minimal setup, it&#8217;s missing the post-down commands to clean up routing tables and rules, this means that &#8216;<em>/etc/init.d/networking restart</em>&#8216; will only make a mess, and you&#8217;ll need a reboot or some commands to make everything work again.</h5>
<p>What have we done here? After the usual headers, we told our two tables how to reach the loopback interface and the LAN. Then, the fun part: two similar sections were written for eth1 and eth2. The only real difference is in the default route: we want eth2 to be the default, 192.168.2.2 being the default gateway, while eth1 should be a dedicated channel for web traffic.<br />
Four post-up commands, which will be executed as the relative interface come up, are &#8220;shared&#8221; between the two interfaces. Taking eth1 as an example, the first command defines that this interface is attached to the 192.168.1.0/24 network, that all packets going to that network should have a sender address of 192.168.1.1 and that they should be routed through the table <em>web</em>. The second one says that the default gateway for the <em>web</em> table is 192.168.1.2.<br />
The first rule forces a packet with a defined sender address to come out on the right interface, while the second one routes all packets marked <em>0&#215;1</em> through the <em>web</em> table.</p>
<h3><strong>Marking packets</strong></h3>
<p>If you got through here and your network was successfully started with all the rules, then the worst part is done. Now let&#8217;s see where the magic happens: iptables. Our firewall script will have to contain a couple simple rules:</p>
<blockquote><p>iptables -t mangle -A PREROUTING -p tcp &#8211;sport 80 -j MARK &#8211;set-mark 0&#215;1<br />
iptables -t mangle -A PREROUTING -p tcp &#8211;dport 80 -j MARK &#8211;set-mark 0&#215;1</p></blockquote>
<p>This will ensure that <strong>all</strong> traffic coming from or going to port 80 will be marked with <em>0&#215;1</em>, which corresponds to our <em>web</em> routing table. And this is it: iproute2 will see the mark (which is at operating system level, it doesn&#8217;t modify the packet in any way), assign the packet the correct source address and route it through the right interface.</p>
<p>Neat, isn&#8217;t it? <img src='http://blog.bardland.org/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<h2><strong>Conclusions</strong></h2>
<p>PBR is a very powerful tool that allows us to define routing in every little detail. Even though it can be a bit hard to setup, it proves to be invaluable in network environments which need a high level of customization, load-balancing or prioritization or certain kinds of traffic.<br />
I hope you had a nice trip, and if you find something is missing or wrong (very easy) just leave a comment, I&#8217;ll try to fix it as soon as I can. Thanks for reading <img src='http://blog.bardland.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3><strong>References</strong></h3>
<ul>
<li><a href="http://lartc.org/howto/lartc.rpdb.multiple-links.html" target="_blank">Linux Advanced Routing &amp; Traffic HOWTO</a>: surely the best PBR source around, a bit out of date, though</li>
<li><a href="http://www.netfilter.org/documentation/index.html" target="_blank">Netfilter.org</a>: official iptables documentation</li>
<li><a href="http://meditation-art.blogspot.com/2008/03/linux-networking-2-router-with-port.html" target="_blank">Linux Networking 2: a router with port forwarding</a>: very good distro-agnostic PBR howto, goes much more in deep than this one, but it&#8217;s less practical</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.bardland.org/2008/11/16/policy-based-routing-with-debian-lenny/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Il destino di {tcl,tk}-devel / {tcl,tk}-devel&#8217;s destiny</title>
		<link>http://blog.bardland.org/2008/01/12/il-destino-di-tcltk-devel-tcltk-devels-destiny/</link>
		<comments>http://blog.bardland.org/2008/01/12/il-destino-di-tcltk-devel-tcltk-devels-destiny/#comments</comments>
		<pubDate>Sat, 12 Jan 2008 15:25:01 +0000</pubDate>
		<dc:creator>bardo</dc:creator>
				<category><![CDATA[arch]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[amsn]]></category>
		<category><![CDATA[arch linux]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[italiano]]></category>
		<category><![CDATA[tcl]]></category>
		<category><![CDATA[tk]]></category>

		<guid isPermaLink="false">http://www.bardland.org/blog/2008/01/12/il-destino-di-tcltk-devel-tcltk-devels-destiny/</guid>
		<description><![CDATA[Attention: bilingual post, english follows. Voglio qui chiarificare le cose sul futuro di due PKGBUILD che mantengo in AUR, tcl-devel e tk-devel, che hanno avuto non poco successo principalmente grazie al supporto all&#8217;anti-aliasing dei font, che rende aMSN parecchio più guardabile. La versione 8.5 (stabile) è stata finalmente rilasciata, e al momento si trova in [...]]]></description>
			<content:encoded><![CDATA[<p><strong><em>Attention:</em></strong> bilingual post, english follows.</p>
<p>Voglio qui chiarificare le cose sul futuro di due PKGBUILD che mantengo in <a href="http://aur.archlinux.org/" title="Archlinux User Repository" target="_blank">AUR</a>, <em>tcl-devel</em> e <em>tk-devel</em>, che hanno avuto non poco successo principalmente grazie al supporto all&#8217;anti-aliasing dei font, che rende <a href="http://www.amsn-project.net/" title="Client MSN alternativo" target="_blank">aMSN</a> parecchio più guardabile. La versione 8.5 (stabile) è stata finalmente rilasciata, e al momento si trova in <em>[testing]</em>, mentre i lavori per la 8.6 (9.0?) non si sono ancora solidificati in una release alpha. Per questa ragione, nel momento in cui tcl e tk passeranno in <em>[extra]</em>, i corrispettivi <em>-devel</em> saranno rimossi dall&#8217;AUR, in quanto creerebbero più confusione che altro. Vorrei ricordare a quanti mantenessero pacchetti direttamente dipendenti da questi due di preparare delle nuove release che riportino le dipendenze stabili, in modo da evitare casini.</p>
<p><span id="more-47"></span><em>English version:</em></p>
<p>I want to clarify here the future waiting for a couple of PKGBUILDs I maintain on the <a href="http://aur.archlinux.org/" title="Archlinux User Repository" target="_blank">AUR</a>, <em>tcl-devel</em> and <em>tk-devel</em>, which had quite a bit of success, mainly thanks to anti-aliased fonts support that makes <a href="http://www.amsn-project.net/" title="Alternative MSN client" target="_blank">aMSN</a> a lot nicer. Finally the (stable) 8.5 version has been released, and at the moment it resides in <em>[testing]</em>, while works for a new 8.6 (9.0?) still haven&#8217;t solidified in an alpha release. For this reason, as tcl and tk reach <em>[extra]</em>, the corresponding <em>-devel</em> versions will be removed from the AUR, since they&#8217;d just be confusing. I want to remember to those that maintain packages which directly depend on these two to prepare a new release reporting the stable dependency, thus avoiding any mess up.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bardland.org/2008/01/12/il-destino-di-tcltk-devel-tcltk-devels-destiny/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
