<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments for darkness</title>
	<atom:link href="http://darkness.codefu.org/wordpress/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://darkness.codefu.org/wordpress</link>
	<description></description>
	<lastBuildDate>Fri, 18 May 2012 21:10:11 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.2</generator>
	<item>
		<title>Comment on Quickly: DRAC III/XT and CentOS 4 by Søren K</title>
		<link>http://darkness.codefu.org/wordpress/2006/09/quickly-drac-iiixt-and-centos-4/#comment-104751</link>
		<dc:creator>Søren K</dc:creator>
		<pubDate>Fri, 18 May 2012 21:10:11 +0000</pubDate>
		<guid isPermaLink="false">http://darkness.codefu.org/wordpress/2006/09/22/247#comment-104751</guid>
		<description>wow - thanks a lot for the tip! It saved me a 1 hour trip in the middle of the night! :)</description>
		<content:encoded><![CDATA[<p>wow &#8211; thanks a lot for the tip! It saved me a 1 hour trip in the middle of the night! :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Perl scoping by darkness</title>
		<link>http://darkness.codefu.org/wordpress/2003/03/perl-scoping/#comment-97880</link>
		<dc:creator>darkness</dc:creator>
		<pubDate>Thu, 20 Oct 2011 21:24:31 +0000</pubDate>
		<guid isPermaLink="false">/?p=97#comment-97880</guid>
		<description>Yup, thanks Thom.  I can&#039;t currently figure it out but that &quot;$barn&quot; is indeed supposed to be &quot;$bar\n&quot;.  WP is eating my backslashes and I don&#039;t currently know why.</description>
		<content:encoded><![CDATA[<p>Yup, thanks Thom.  I can&#8217;t currently figure it out but that &#8220;$barn&#8221; is indeed supposed to be &#8220;$bar\n&#8221;.  WP is eating my backslashes and I don&#8217;t currently know why.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Perl scoping by Thom Blake</title>
		<link>http://darkness.codefu.org/wordpress/2003/03/perl-scoping/#comment-97879</link>
		<dc:creator>Thom Blake</dc:creator>
		<pubDate>Thu, 20 Oct 2011 20:57:47 +0000</pubDate>
		<guid isPermaLink="false">/?p=97#comment-97879</guid>
		<description>In order to make sense of the above, I have to assume that backslashes are being removed. For example, it looks like you&#039;re trying to print &quot;$barn&quot; rather than &quot;$bar followed by a newline&quot;.</description>
		<content:encoded><![CDATA[<p>In order to make sense of the above, I have to assume that backslashes are being removed. For example, it looks like you&#8217;re trying to print &#8220;$barn&#8221; rather than &#8220;$bar followed by a newline&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Reset your keyboard in X by Joseph C</title>
		<link>http://darkness.codefu.org/wordpress/2009/01/reset-your-keyboard-in-x/#comment-97436</link>
		<dc:creator>Joseph C</dc:creator>
		<pubDate>Tue, 11 Oct 2011 00:38:44 +0000</pubDate>
		<guid isPermaLink="false">http://darkness.codefu.org/wordpress/2009/01/27/333#comment-97436</guid>
		<description>Thanks!  I hope this will solve a long-standing problem that I have with my VNC sessions on Ubuntu -- every one in a while, my ALT key gets virtually stuck, and although I can see key events showing the alt key presses and releases, all input continues to behave as if the alt key was down.</description>
		<content:encoded><![CDATA[<p>Thanks!  I hope this will solve a long-standing problem that I have with my VNC sessions on Ubuntu &#8212; every one in a while, my ALT key gets virtually stuck, and although I can see key events showing the alt key presses and releases, all input continues to behave as if the alt key was down.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Updated: chrooted SFTP account recipes by Matilda</title>
		<link>http://darkness.codefu.org/wordpress/2004/07/updated-chrooted-sftp-account-recipes/#comment-97418</link>
		<dc:creator>Matilda</dc:creator>
		<pubDate>Mon, 10 Oct 2011 17:27:23 +0000</pubDate>
		<guid isPermaLink="false">/?p=153#comment-97418</guid>
		<description>Unbelievable how well-written and infromiavte this was.</description>
		<content:encoded><![CDATA[<p>Unbelievable how well-written and infromiavte this was.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on News from the kitchen by Rosa</title>
		<link>http://darkness.codefu.org/wordpress/2002/10/news-from-the-kitchen/#comment-97397</link>
		<dc:creator>Rosa</dc:creator>
		<pubDate>Mon, 10 Oct 2011 12:35:47 +0000</pubDate>
		<guid isPermaLink="false">/?p=32#comment-97397</guid>
		<description>I could watch Schindler&#039;s List and still be happy after rdeinag this.</description>
		<content:encoded><![CDATA[<p>I could watch Schindler&#8217;s List and still be happy after rdeinag this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Christmas time is here again, damn it by Prudence</title>
		<link>http://darkness.codefu.org/wordpress/2002/12/christmas-time-is-here-again-damn-it/#comment-97392</link>
		<dc:creator>Prudence</dc:creator>
		<pubDate>Mon, 10 Oct 2011 11:07:07 +0000</pubDate>
		<guid isPermaLink="false">/?p=54#comment-97392</guid>
		<description>Free knowledge like this doesn&#039;t just help, it promote domceracy. Thank you.</description>
		<content:encoded><![CDATA[<p>Free knowledge like this doesn&#8217;t just help, it promote domceracy. Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on AVI to DVD by distributor opportunities</title>
		<link>http://darkness.codefu.org/wordpress/2005/08/avi-to-dvd/#comment-97362</link>
		<dc:creator>distributor opportunities</dc:creator>
		<pubDate>Sun, 09 Oct 2011 18:19:59 +0000</pubDate>
		<guid isPermaLink="false">http://darkness.codefu.org/wordpress/2005/08/04/193#comment-97362</guid>
		<description>Please let me know if you’re looking for a article author for your weblog. You have some really good articles and I feel I would be a good asset. If you</description>
		<content:encoded><![CDATA[<p>Please let me know if you’re looking for a article author for your weblog. You have some really good articles and I feel I would be a good asset. If you</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Linux and directed broadcasts by Robert Woodcock</title>
		<link>http://darkness.codefu.org/wordpress/2006/02/linux-and-directed-broadcasts/#comment-97006</link>
		<dc:creator>Robert Woodcock</dc:creator>
		<pubDate>Thu, 22 Sep 2011 22:08:47 +0000</pubDate>
		<guid isPermaLink="false">http://darkness.codefu.org/wordpress/2006/02/22/226#comment-97006</guid>
		<description>Oh - the &quot;use IO::Select;&quot; is vestigial and can be removed.</description>
		<content:encoded><![CDATA[<p>Oh &#8211; the &#8220;use IO::Select;&#8221; is vestigial and can be removed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Linux and directed broadcasts by Robert Woodcock</title>
		<link>http://darkness.codefu.org/wordpress/2006/02/linux-and-directed-broadcasts/#comment-97004</link>
		<dc:creator>Robert Woodcock</dc:creator>
		<pubDate>Thu, 22 Sep 2011 21:55:29 +0000</pubDate>
		<guid isPermaLink="false">http://darkness.codefu.org/wordpress/2006/02/22/226#comment-97004</guid>
		<description>I finally got around to doing this. I don&#039;t think it was worth it, since after testing the script I found that each Softros client sends out an ACK to every client that it receives a broadcast message from (it replies with the *exact same data* it was sent). So if you have 200 clients, that&#039;s 200^2 UDP packets flying across your WAN connection every minute.

But in case someone else needs it, here it is:

#!/usr/bin/perl -w
# Get a list of all interfaces and find the local IP and netmask
# Listen for Softros Messenger traffic (UDP port 19771)
# If traffic is received from the local network, do nothing
# If traffic is received from any other interface, resend it to the local
# broadcast address and spoof the original sender IP just as if Linux had
# forwarded the packet
my $localnet = &quot;eth1&quot;;
my $port = 19771;
my ($localnetaddr, $localnetmask, $localbroadcast);

use IO::Socket;
use IO::Interface qw(:flags);
use IO::Select;
# NOTE NOTE NOTE NOTE NOTE This script requires a modification to
# Net::RawIP - the stock version does not set SO_BROADCAST so sending
# packets to a broadcast address results in -EACCESS.
#
# Add this to util.c&#039;s rawsock() just below the IP_HDRINCL code:
#       if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &amp;val, sizeof(val)) new( Proto=&gt;&#039;udp&#039;,
                                    LocalAddr=&gt;&#039;0.0.0.0&#039;,
                                    LocalPort=&gt;$port,
                                    ReuseAddr=&gt;1,
                                    Broadcast=&gt;1
                                  ) &#124;&#124; die &quot;Can&#039;t bind: $@\n&quot;;

my @interfaces = $socket-&gt;if_list;
for my $if (@interfaces) {
  if ($if eq $localnet) {
    $localnetaddr = ip2long($socket-&gt;if_addr($if));
    $localnetmask = ip2long($socket-&gt;if_netmask($if));
    $localbroadcast = $socket-&gt;if_broadcast($if);
  }
}

while ($socket-&gt;recv($buf, 10000)) {
  my ($peerport,$peeraddr) = sockaddr_in($socket-&gt;peername);
  my $peerip = inet_ntoa($peeraddr);
  # Determine if it came in on the local interface or not
  if ((ip2long($peerip) &amp; $localnetmask) == ($localnetaddr &amp; $localnetmask)) {
    #print &quot;$peerip (local) said $buf\n&quot;;
  } else {
    # Rebroadcast locally
    #print &quot;$peerip:$peerport (remote) said $buf\n&quot;;
    #print &quot;resending from $peerip:$peerport to $localbroadcast:$port\n&quot;;
    $sendsocket = Net::RawIP-&gt;new({
                              ip =&gt; {
                                saddr =&gt; $peerip,
                                daddr =&gt; $localbroadcast,
                              },
                              udp =&gt; {
                                source =&gt; $peerport,
                                dest =&gt; $port,
                                data =&gt; $buf,
                              },
                              }) &#124;&#124; die &quot;Can&#039;t create raw socket: $@\n&quot;;
    $sendsocket-&gt;send;
    $socket-&gt;recv($buf, 10000); # Immediately eat any data we just sent out
  }
}

# From http://weblogs.litmusgreen.com/ed/archives/002250.html
sub ip2long {
 return unpack(&quot;l*&quot;, pack(&quot;l*&quot;, unpack(&quot;N*&quot;, inet_aton(shift))));
}</description>
		<content:encoded><![CDATA[<p>I finally got around to doing this. I don&#8217;t think it was worth it, since after testing the script I found that each Softros client sends out an ACK to every client that it receives a broadcast message from (it replies with the *exact same data* it was sent). So if you have 200 clients, that&#8217;s 200^2 UDP packets flying across your WAN connection every minute.</p>
<p>But in case someone else needs it, here it is:</p>
<p>#!/usr/bin/perl -w<br />
# Get a list of all interfaces and find the local IP and netmask<br />
# Listen for Softros Messenger traffic (UDP port 19771)<br />
# If traffic is received from the local network, do nothing<br />
# If traffic is received from any other interface, resend it to the local<br />
# broadcast address and spoof the original sender IP just as if Linux had<br />
# forwarded the packet<br />
my $localnet = &#8220;eth1&#8243;;<br />
my $port = 19771;<br />
my ($localnetaddr, $localnetmask, $localbroadcast);</p>
<p>use IO::Socket;<br />
use IO::Interface qw(:flags);<br />
use IO::Select;<br />
# NOTE NOTE NOTE NOTE NOTE This script requires a modification to<br />
# Net::RawIP &#8211; the stock version does not set SO_BROADCAST so sending<br />
# packets to a broadcast address results in -EACCESS.<br />
#<br />
# Add this to util.c&#8217;s rawsock() just below the IP_HDRINCL code:<br />
#       if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &amp;val, sizeof(val)) new( Proto=&gt;&#8217;udp&#8217;,<br />
                                    LocalAddr=&gt;&#8217;0.0.0.0&#8242;,<br />
                                    LocalPort=&gt;$port,<br />
                                    ReuseAddr=&gt;1,<br />
                                    Broadcast=&gt;1<br />
                                  ) || die &#8220;Can&#8217;t bind: $@\n&#8221;;</p>
<p>my @interfaces = $socket-&gt;if_list;<br />
for my $if (@interfaces) {<br />
  if ($if eq $localnet) {<br />
    $localnetaddr = ip2long($socket-&gt;if_addr($if));<br />
    $localnetmask = ip2long($socket-&gt;if_netmask($if));<br />
    $localbroadcast = $socket-&gt;if_broadcast($if);<br />
  }<br />
}</p>
<p>while ($socket-&gt;recv($buf, 10000)) {<br />
  my ($peerport,$peeraddr) = sockaddr_in($socket-&gt;peername);<br />
  my $peerip = inet_ntoa($peeraddr);<br />
  # Determine if it came in on the local interface or not<br />
  if ((ip2long($peerip) &amp; $localnetmask) == ($localnetaddr &amp; $localnetmask)) {<br />
    #print &#8220;$peerip (local) said $buf\n&#8221;;<br />
  } else {<br />
    # Rebroadcast locally<br />
    #print &#8220;$peerip:$peerport (remote) said $buf\n&#8221;;<br />
    #print &#8220;resending from $peerip:$peerport to $localbroadcast:$port\n&#8221;;<br />
    $sendsocket = Net::RawIP-&gt;new({<br />
                              ip =&gt; {<br />
                                saddr =&gt; $peerip,<br />
                                daddr =&gt; $localbroadcast,<br />
                              },<br />
                              udp =&gt; {<br />
                                source =&gt; $peerport,<br />
                                dest =&gt; $port,<br />
                                data =&gt; $buf,<br />
                              },<br />
                              }) || die &#8220;Can&#8217;t create raw socket: $@\n&#8221;;<br />
    $sendsocket-&gt;send;<br />
    $socket-&gt;recv($buf, 10000); # Immediately eat any data we just sent out<br />
  }<br />
}</p>
<p># From <a href="http://weblogs.litmusgreen.com/ed/archives/002250.html" rel="nofollow">http://weblogs.litmusgreen.com/ed/archives/002250.html</a><br />
sub ip2long {<br />
 return unpack(&#8220;l*&#8221;, pack(&#8220;l*&#8221;, unpack(&#8220;N*&#8221;, inet_aton(shift))));<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>

