OpenWRT 10.03.1-rc2 and Comcast IPv6

After documenting the IPv6 goodness for the old kamikaze release of openwrt, I wanted to play with something a little newer. I also wanted newer iptables so I could play with the tee module.

Some notes:

  • Still no 6rd support on OpenWRT AFAIK
  • rc2 and rc3 are the same for the brcm-2.4 version of Openwrt 10.03.1
  • brcm4700 doesn’t work well at all with my WRT54GL. I think the open source broadcom drivers still aren’t as stable as the proprietary ones that ship with 2.4
  • nearly the same config scripts as the old kamikaze work

Once you flash the router with the firmware you will need to install some extra packages.

  1. opkg update
  2. opkg install ip kmod-ipv6 kmod-sit radvd
  3. paste this code into a new startup script at /etc/init.d/comcast6to4
  4. #!/bin/sh /etc/rc.common

    inetip=`ip -4 addr show dev eth0.1 | awk ‘/inet / {print $2}’ | cut -d/ -f 1`
    inetipspaced=`echo $inetip | tr . ‘ ‘`
    local6prefix=`printf 2002:%02x%02x:%02x%02x $inetipspaced`

    start() {
    ip tunnel add c6to4 mode sit ttl 255 remote any local $inetip
    ip link set c6to4 up
    ip -6 addr add $local6prefix:0::1/64 dev c6to4
    ip -6 addr add $local6prefix:1::1/64 dev br-lan
    ip -6 route add 2000::/3 via ::192.88.99.1 dev c6to4
    sysctl -w net.ipv6.conf.all.forwarding=1 > /dev/null
    cat > /etc/radvd.conf <<EOF
    interface br-lan
    {
    AdvSendAdvert on;
    MinRtrAdvInterval 3;
    MaxRtrAdvInterval 10;
    prefix $local6prefix:1::/64
    {
    AdvOnLink on;
    AdvAutonomous on;
    AdvRouterAddr on;
    AdvValidLifetime 86400;
    AdvPreferredLifetime 86400;
    };
    };
    EOF
    }

    stop() {
      ip tunnel del c6to4
      ip -6 addr del $local6prefix:1::1/64 dev br-lan
    }

  5. pushd /etc/rc.d ; ln –s ../init.d/comcast6to4 S42comcast6to4

Then be glad you have ipv6.

 

This will actually work for ANY provider which uses the standard IPv6 6to4 address of 192.88.99.1, not just Comcast.

Now if only Comcast would open back up their trial so I could join my work to the ipv6 network.

Comcast IPv6 on an old Kamikaze 8.09 Openwrt via 6to4

I’m an openwrt novice, but I know enough about linux and iptables to usually get done what I want. When Comcast announced they were trialing IPv6, I jumped at the opportunity to migration from my trusty Hurricane Electric tunnel to something more direct.

I’m running Kamikaze 8.09.1 brcm-2.4 on my Linksys WRT54GL these instructions probably won’t work elsewhere. I’m guessing that IPv6 is a little different in a 2.6 kernel with a new iptables. If you have very new stuff you should be using 6rd instead of 6to4.

I’m writing this because much of the information I found out there for 6to4 on Linux didn’t work for me, or was only partly correct and I had to piece together suggestions from different sources.

make a script in /etc/rc.d with this content. I called mine comcast6to4

inetip=`ip -4 addr show dev eth0.1 | awk ‘/inet / {print $2}’ | cut -d/ -f 1`
inetipspaced=`echo $inetip | tr . ‘ ‘`
local6prefix=`printf 2002:%02x%02x:%02x%02x $inetipspaced`
ip tunnel add c6to4 mode sit ttl 255 remote any local $inetip
ip link set c6to4 up
ip -6 addr add $local6prefix:0::1/64 dev c6to4
ip -6 addr add $local6prefix:1::1/64 dev br-lan
ip -6 route add 2000::/3 via ::192.88.99.1 dev c6to4

Make your /etc/radvd.conf look like this:

interface br-lan
{
AdvSendAdvert on;
MinRtrAdvInterval 3;
MaxRtrAdvInterval 10;
prefix $local6prefix:1::/64
{
AdvOnLink on;
AdvAutonomous on;
AdvRouterAddr on;
AdvValidLifetime 86400;
AdvPreferredLifetime 86400;
};
};

That is it. I’m not going to explain it. Read the links below for all of that.

Sorry this isn’t a complete solution. You’ll have to fill in that $local6prefix in radvd.conf yourself.

Works Cited:

http://www.reddit.com/r/linux/comments/dbobx/

http://www.comcast6.net/

http://wiki.debian.org/DebianIPv6#IPv66to4Configuration

http://tldp.org/HOWTO/Linux+IPv6-HOWTO/configuring-ipv6to4-tunnels.html

http://en.wikipedia.org/wiki/6to4

http://www.dslreports.com/forum/r24972279-IPv6-via-6in4

http://www.anyweb.co.nz/tutorial/v6Linux6to4

Fly places…

I first became aware of it when Meg McCain told her story on Thursday, November 11th. Google her name. I recommend you carefully listen to what she said. She has been called a liar, but after listening to her story there is no point that I can tell that she lied. She never said that she was felt up. She said that she would have been felt up. Watch the video, you see that she never was felt up.

I’m writing this because I was a little surprised when some people I know weren’t outraged or at least a little disturbed. But I draw the line at anyone saying that the TSA is doing a good job or that they are making us safer. They do neither. Here is a collection of links which suggest that they provide no security and do a poor job attempting to.

http://blogs.forbes.com/artcarden/2010/11/14/full-frontal-nudity-doesnt-make-us-safer-abolish-the-tsa/

http://fuckthetsa.com/

http://www.flyertalk.com/forum/travel-safety-security/1147551-flyer-san-says-no-grope-escorted-checkpoint-leo-threatened-suit.html
http://wewontfly.com/6-year-old-aggressively-patted-down

http://www.ourlittlechatterboxes.com/2010/11/tsa-sexual-assault.html 

 http://pajamasmedia.com/blog/why_have_67000_tsa_employees_l/

http://www.thestar.com/news/world/article/744199—israelification-high-security-little-bother

 http://www.theblaze.com/stories/cair-tsa-can-only-pat-down-muslim-women%E2%80%99s-head-neck/ 

 http://flywithdignity.org/ 

 http://johnnyedge.blogspot.com/2010/11/these-events-took-place-roughly-between.html 

 http://www.theatlantic.com/national/archive/2010/11/tsa-opt-out-day-now-with-a-superfantastic-new-twist/66545/

http://www.schneier.com/essay-303.html 

 http://www.flyertalk.com/forum/travel-safety-security/1147497-tso-saying-heads-up-got-cutie-you.html 
http://www.optoutday.com/ 

this is the most disturbing which I won’t even watch again : http://www.youtube.com/watch?v=2TCHSGvNwRY

http://gizmodo.com/5435675/president-obama-its-time-to-fire-the-tsa

nevermind that the x-ray scanners are a result of lobbying and not security descision : http://www.washingtonexaminer.com/politics/_Naked-scanners__-Lobbyists-join-the-war-on-terror-1540901-107548388.html

deadlier terrorism existed long before 9/11, but we were calmer and less panicky : http://www.salon.com/technology/ask_the_pilot/2010/11/10/airport_security/index.html

I don’t usually agree with Alex Jones, but I link you for completeness : http://wewontfly.com/tsa-fondles-women-children

http://www.nationalpost.com/news/Naked+scanners+airports+dangerous+scientists/3819955/story.html

http://www.theatlantic.com/national/archive/2010/11/body-searching-children-no-for-the-us-army-yes-for-the-tsa/66535/

 

 

lots of people sharing their experiences with this tyranny: http://views.washingtonpost.com/post-user-polls/2010/11/have-you-ever-been-subjected-to-an-airport-security-pat-down.html?hpid=talkbox1

The Israeli model is nice, but might not scale to US needs : http://www.schneier.com/blog/archives/2010/01/adopting_the_is.html

I’m all for a call to abolish the TSA : http://www.allamericanblogger.com/12818/dont-change-the-system-end-it-a-free-market-case-for-ending-the-tsa/

Absolute power corrupts absolutely:  http://www.huffingtonpost.com/fred-gevalt/airport-security-and-tsa_b_561156.html

They want to make it status quo so that you accept it everywhere : http://canadafreepress.com/index.php/article/29959

Awesome story of spreading truth and getting results : http://blog.izs.me/post/1591805056/tsa-success-story

Canada doesn’t like it : http://www.torontosun.com/comment/columnists/ezra_levant/2010/11/15/16158116.html

Great discussion comparing the Israeli model : http://roomfordebate.blogs.nytimes.com/2009/12/30/aviation-security-and-the-israeli-model/#more-27215

The TSA is apparently optional : http://www.washingtonexaminer.com/politics/Amid-airport-anger_-GOP-takes-aim-at-screening-1576602-108259869.html

Its a DHS decision : http://publicintelligence.net/wide-use-of-u-s-airport-body-scanners-depends-on-obama/

The images get leaked : http://gizmodo.com/5690749/

The TSA seeks retaliates by starting an investigation : http://www.signonsandiego.com/news/2010/nov/15/tsa-probe-scan-resistor/

I find it disgusting that the TSA keeps saying “there will be civil penalties” of up to $10,000 or $11,000. What penalties? WTF are they talking about?

Penn Jillette might be getting special treatment : http://www.pennandteller.com/03/coolstuff/penniphile/roadpennfederalvip.html

New Jersey Legislators take on the TSA: http://www.youtube.com/watch?v=9H9HNEtrvEE

Senate had a tiny useless hearing on the subject of TSA pat downs : http://news.cnet.com/8301-31921_3-20023038-281.html

TSA and America’s Culture of Zero Risk : http://seclists.org/isn/2010/Nov/50

You could use the XRays to send messages to the TSA, but you are still subjecting yourself to unnecessary radiation : http://jstogdill.posterous.com/send-the-tsa-a-message-it-will-be-fun

Ron Paul responds well : http://www.youtube.com/watch?v=d-N5adYM7Kw

oh, there is a higher quality version of that same thing here: http://www.youtube.com/watch?v=Qwsdq69AHnw

An airport opts out : http://wdbo.com/localnews/2010/11/sanford-airport-to-opt-out-of.html

http://www.examiner.com/libertarian-in-national/florida-airport-to-opt-out-of-tsa-screening

Ron Paul writes about it too: http://paul.house.gov/index.php?option=com_content&task=view&id=1796&Itemid=60

A very good op-ed on Milgram’s obedience experiments : http://elusis.livejournal.com/2141915.html

Audio of a TSA Integration: http://www.youtube.com/watch?v=tEJpzVPmih0

Seaport airlines – no lines, no rubber gloves, no TSA : http://www.seaportair.com/

Compilation of TSA issues  : http://www.youtube.com/watch?v=RhkQoiaf7Uc

first hand account of getting on a plane with guns but not nail clippers: http://www.redstate.com/erick/2010/11/18/another-tsa-outrage/

EFF has good advise on dealing with the TSA : http://www.eff.org/deeplinks/2010/11/stand-against-tsa-invasive-security-procedures

Bruce is summarizing and commenting : http://www.schneier.com/blog/archives/2010/11/tsa_backscatter.html

It looks like Future Speaker of the House Boehner would change his behavior if the bill proposed by Ron Paul above were passed : http://thecaucus.blogs.nytimes.com/2010/11/19/no-security-pat-downs-for-boehner/?hp

</P?

Agile Solves a Specific Problem

Bill Wagner has a great post on agile titled “What can we learn from the Agile Backlash

Every time I read about agile I’m reminded of how distorted my view of agile had become because I was listening to everyone else’s distortions of agile. I always go back to the manifesto and read a few simple words

  • Individuals and interactions over processes and tools
  • Working software over comprehensive documentation
  • Customer Collaboration over contract negotiation
  • Responding to change over following a plan

The rest of the manifesto is important too, but I find these points are to what I come back the most often. It took someone smart figuratively smacking me in the face for me to notice how messed up I was and then I noticed how messed up many others are on the meaning of agile. (Thanks Amanda!)

Something that agile states is that your goal is to write software in ways better than you are doing now. This is from the first sentence of the manifesto, “We are uncovering better ways of developing software…” What I’ve noticed on a current consulting project is that agile is not applicable if the team (or client) is not interested in this goal.

Unbelievable I know, but not everyone is a software developer and so developing software in better ways may not be important to everyone. Specifically, it probably isn’t important to management, until you can show management that it saves them money.

Even given all of that evidence, some groups may still not share values with agile. For example, favoring individuals and interactions over processes and tools is not going to fit into an organization whose top down leadership absolutely requires people to use tool X from vendor Y, and it doesn’t matter that it doesn’t fit the current project or that it slows down velocity. It doesn’t fit when developers (individuals) show evidence (Mythical Man Month is the tip of the iceberg) that working on many projects causes thrashing that greatly hinders developer productivity when the organization doesn’t value delivery of software in a timely manner, but instead values a high number of concurrent projects. Its not that one set of values is necessarily better than the other, there might be a very good business case to retain existing values in that organization over the agile values.

Finally, it is of absolute importance as a consultant, programmer, team lead or program manager to recognize what you can change and what you can not in any organization. Sometimes you won’t know and you may go ahead trying to get some change. This is fine, but always be on the lookout to see how well that change is being adopted and be ready to “respond to change” even if that means not adopting agile in that particular situation.

Why I Love C# More Than I Care About Ruby

@robconnery I’m really glad that you are excited. I think anytime someone is healthily and safely passionate about something, it can only be a good thing.

Rob has a great post where he lists 4 cases where he likes Ruby and compares to the same thing in C#. Case 1 Expressiveness: Rob likes the unless statement and the post expression if statement. Case 2: Rob likes Gems. Case 3: Rob likes simple things. Case 4: Rob likes sending messages, open classes and method missing.

Python and Perl already did all this, so why Ruby?

Case 1 and 3 were true in python when i started writing it in 1996 and case 1, 2 and 3 were true in perl when i started writing it in 2000. I’m sure case4 is true in both python and perl too, but I never went that deep into either of them. Much like in Ruby, you don’t have to go that deep to get things done.

I am of the opinion that if you have never seen a dynamic typed language before, or maybe a dynamic typed language other that BASIC or VB before, that Ruby has all of the appeal which you tout. However, there are some of us who write C# because we actually like it, we write desktop applications, and find it to be the best static and strong typed language around. We came to C# and were super impressed because the weak typing of C wasn’t there. The rough edges of C++ wasn’t there and for nearly all applications there is no performance difference and sometimes the GC and managed environment actually gives a boost in performance over some of the bad C++ we were writing before.

So should someone who has never written in Perl, Python, Pike and PHP go try out Ruby… absolutely… get the exposure.

Alternatively, if you have done some Perl or Python and now you are a C# guy. Ruby might not seem so impressive. In fact, it looks more like the same thing with a new coat. I can’t tell what the hype is about. There isn’t much new and different.

All that said, after years of Perl, learning C# was a challenge, especially since I was using it to solve many of the same problems for which I had been using Perl. WHY? was I doing it that way? Well I wanted Windows Forms UI front ends on my Perl versions of programs there were ultimately just sed/awk/grep and some ldapsearch/ldapadd/ldapmodify commands. Not commands really, but calls to libraries.

There is a good reason that the “simple things” aren’t AS simple.

What I learned was that there is a damned good reason that Case 3 “The Simple Things” were a little more complex in C#. The separation of stream and textreader abstract types in C# make huge sense once you realize that doing the same thing in perl or python (or ruby) can be a bit of a hassle. The organization of decorator streams in the .NET BCL just makes sense. Want to compress? Decorate with the stream compressing class. Want to encrypted? Decorate with the stream encrypting class. Want to do both? In either order? Decorate appropriately.

I do share Rob’s opinion. It is a little prettier in Ruby. I’ve already gone on record as saying that “var” in C# should be optional. In VB6 the Let statement was optional. In VB.NET the Let statement is no supported. IMO C#’s var isn’t much different than VB.NET’s Let and Dim. Sure would be nice if it were optional.

I’ve also requested static imports so that we could do things like just call the open method instead of saying File.Open. When you are in a nice tiny singly responsible file, it just makes sense.

These things don’t change my ability to write code.

On .NET’s lack of a CPAN, Cheeseshop, Gem equivalent: YES! YES! YES WE NEED IT NOW!

I can’t say anything other than .net needs CNAN (comprehensive .net archive network) or maybe CCAN (comprehensive CIL archive network). I can’t decide which name I like better.

As for metaprogramming, I think that Python, Perl and Ruby’s ability for runtime metaprogramming will continue to be far beyond anything you see in the C# world. That is not say that metaprogramming is not possible in C#. Its just very different. Its typically compile time metaprogramming. Thanks to the addition of T4 in VS2008 and 2010, metaprogramming in C# is readily available and powerful.

I could go on and insert above about how I learned to love the .NET RegularExpression API after having it blow my mind in comparison to perl’s. Or about how poorly documented the System.DirectoryServices API is, but that once I got it I loved it so much more than Net::LDAP. Or about the extreme pain in building CPAN modules on a Sun Sparc and how installing Mono and using Visual Studio and C# was actually easier than making Perl work properly.

But rather than elaborate on those things, I’ll end by saying, yes, Ruby is awesome, if you have never seen any of the things which make it awesome before.

C# 4 Optional Parameters Limits Default Value

Jon Skeet has an excellent C# 5 talk video from the recent Norwegian Developer Conference. Go watch it.

When he showed Default<T>, I immediately thought it was just an variation of Option<T> or F#’s option type, but with added default value logic. Its cool.

He was asking for compiler support so that things like this would be possible.

Default<int> a = 1;

Well, I thought, you don’t need compiler support for that, just add an implicit type converter to your definition of Default<T>

        public static implicit operator Default<T>(T value)
        {
            return new Default<T>(value);
        }

No worries, right?

Oh I was so wrong. While this will work for the regular above statement, it won’t work as a default parameter value.

     class Things { public Things(Default<int> a = 5) { } }

This provides a wonderfully descriptive error (I love this compiler) which says “a value of type ‘int’ cannot be used as a default parameter because there are no standard conversions to the type ‘Default<int>’”

Now I’m crying? Why the limit? Instead of Jon’s request for awesome Default<T> support in C# 5, I request considering implicit type converters on optional parameter default values.

WlanChannelInfo aka Windows 7 Net Stumbler aka Wifi Channel Info

I finally got around to updating WlanChannelInfo. It started because I wanted to play with some .NET 4 beta features and I also struggled with getting a simple net stumbler running. I figured that Windows had to have something better to offer, and it turns out that in windows 7 the WLAN API was updated to expose everything that I cared about. I really only want to see what WIFI channel’s my neighbors are on so that I can move my WIFI AP to an unused channel.

http://wlanchannelinfo.codeplex.com/

I finally updated it to use a .NET release instead of a .NET 4 beta, but when I did, I decided that I didn’t need .NET 4. I just stuck to using 3.5 so that this app will run out of the box on Windows 7. No need to get .NET 4 to run this. I figure my parents might have windows 7 but probably won’t have .NET 4 installed just yet. Maybe someone else’s parents would have the same issue, and since the download is only 19KB… yes, 19KB… since the app is dead simple and does nothing but use existing WPF controls and p/invoke into the WLAN api (via the ManagedWifi.dll also on codeplex) its *TINY*.

Let me know if you find this useful.

Method I Wish Was There: AsUri

I never got used to the .NET Uri type. It seems like I only had to use it occasionally and even then where I really only wanted to type a string url.

public static Uri AsUri(this string uri) { return new Uri(uri); }

This way I can just add a AsUri() when I forgot that I was supposed to pass a Uri instead of a string.

webclient.DownloadFileAsync( “http://blah.com”, filename );

doesn’t compile and so I can scratch my head once again and replace it.

webclient.DownloadFileAsync( “http://blah.com”.AsUri(), filename );

I like trivial things 🙂

Method I Wish Was There: IsWithin

I don’t think I like the name, but I couldn’t come up with something better.

public static bool IsWithin(this DateTime datetime, TimeSpan distance) {
  var now = DateTime.Now;
  return (now – datetime).Duration() < distance;
}
public static bool IsWithin(this DateTime datetime, TimeSpan distance, DateTime now) {
  return (now – datetime).Duration() < distance;
}

Coupled with extension methods from yesterday you can write code like this:

if ( postDate.IsWithin(24.Hours()) ) { … }

nice and readable.

Method I Wish Was There: Minutes, Hours, Seconds

Ok, the ruby lovers will laugh, the ruby haters will, well, hate.

public static TimeSpan Minutes (this int minutes) {
  return new TimeSpan(0, minutes, 0);
}
public static TimeSpan Hours (this int hours) {
  return new TimeSpan(hours, 0, 0);
}
public static TimeSpan Seconds (this int seconds) {
  return new TimeSpan(0,0, seconds);
}

So that now I can write readable code like this:

var fiver = 5.Seconds();
var fivertoo = 5.Hours();
Assert.That( fiver.IsLessThan(fivertoo) );