Internet Rule Number One: Hack on Code, Not on Protocols

Recently I ran into two different cases of other people running other networks that affected me directly in a negative way. Now, we all know that people make mistakes and hardware failures can and will happen. However, in these two cases it wasn’t from “broken code” but rather “broken as designed”. The IETF, a standards organization that I’ve spent some time working with, goes through lots of thought and trouble to design internet protocols so they’re interoperable if you follow the rules. The problem is that sometimes network administrators decide they can “hack around” the way a protocol is supposed to work in order to achieve some goal. Frequently, however, they miss critical aspects of how the protocol is supposed to work or (worse) consciously ignore how protocols are supposed to work because they don’t care about the other networks they break. As long as they’re not breaking their own, of course.

But, to begin my story, I think I need to first highlight the important protocols I’ll be talking about.

The Players

  • IPv4 and IPv6: These are the big players these days when it comes to “things that are going to break on their own soon”. IP addresses are those silly string of numbers that tell the internet who you’re actually sending packets to. Normally, the average Joe doesn’t think about these because the average Joe is lucky enough to type “Domain Names” into their web browser instead of silly strings of numbers. The thing you need to know about IP addresses is that in the near future (possibly by the time I’m done typing if I don’t hurry up) we’ll run out of IPv4 addresses to hand out to things like your cell phones, washing machines and toasters. Unfortunately much of the world isn’t ready for the transition from IPv4 to IPv6, even though it’s been coming for a very very very long time. We all procrastinate, after all.
  • Domain Name System (DNS): The DNS is how we translate those useful names (like pontifications.hardakers.net into silly numbers. Like 67.205.57.145. Or 2001:470:1f00:187::1 (yes, those really are all numbers if you expand your mind a bit).
  • Simple Mail Transfer Protocol (SMTP): This is the guy that is making post offices around the world quiver wondering when their funding from selling postage stamps will dry up. Although this E-Mail thing has been catching on, we’re also finding that more and more people are relying on other services now, like FaceBook, for communicating instead. Interestingly enough, both of my issues below relate to communication. One with E-Mail and one with FaceBook.

    Enter the Era of E-Mail

    Now, E-Mail, it turns out, gets sent around quite a bit. I know that I still get quite a bit of it these days. Unfortunately, some entrepreneurial folks have figured out that the powers from the dark side enable them to use E-Mail for negative reasons as well. I’m speaking of SPAM of course, which currently accounts for about 75% of my E-Mail. [On a side note: I suspect that spam via paper-mail (otherwise known as bulk-advertising) is the one thing keeping most of the world’s post offices still in business.]

    Now, unless you’re a protocol geek like I am, you may not know that E-Mail that needs to get sent from one server to the next also uses DNS records that translate human-readable domain names (like hardakers.net) into IP addresses (like 168.140.236.43 and 2001:470:1f00:187::1). So, lets say you need to email youraunt@hardakers.net the first thing that your ISP does when you ask it to deliver a letter is to look up the IP address.

    What’s supposed to happen

    Normally when you look up where to send something you’ll get a few answers, nicely prioritized by where you should try them first:

     # dig +short hardakers.net mx
     5  mail6.hardakers.net.
     10 dns66.hardakers.net.
     20 dnsm3.hardakers.net.
    

    This shows us (or more appropriately, your ISP) to try and send the mail first to mail6.hardakers.net (priority level 5) and if that fails to trydns66.hardakers.net and then finally to dnsm3.hardakers.net. The server then starts by looking up the numeric address for the first one and then trying to talk to it. If one doesn’t work, it should skip to the next one an keep trying till it has no more to try and then will give up. (And by “give up” I mean, “keep trying for another 7 days or so at regular intervals”.)

    So, lets look up the address of the first one. We’ll look up both the IPv4 and the IPv6 address for it:

     # dig +short mail6.hardakers.net A
     # dig +short mail6.hardakers.net AAAA
     2001:470:1f00:187::1
    

    Note how, in this case, there is no IPv4 address (the line ending with an A didn’t get an answer). There is only an IPv6 address (the answer to the line ending with AAAA). This is perfectly legal, and was actually set up this way intentionally. I wanted to be ready for the cometh of IPv6 and was encouraging mail agents around the world to try me first over IPv6. I thought that was rather good of me: exercise early, exercise often (which reminds me: I’m late for my bike ride).

    So, this has been working quite well for many years (I’ve been quite anxious for IPv6 to take off). Not only that, it likely even reduced some of my spam since many spammers don’t try the remaining listed addresses and rarely have IPv6 support. Spammers don’t even pretend to be compliant with anything. Especially morals.

    Enter btconnect, a UK ISP

    BTConnect is (supposedly) the biggest ISP on the other side of the pond from the United States. They decided to add in another rule to the SMTP protocol: every MX record MUST point to a valid address. IE, you couldn’t create a record for bogus.hardakers.net and use it as an MX record without adding an IP address for it. They did this to try and ensure that the remote address was legitimate and then refuse to send it for their customers (folks like you and me sitting at home on couches; they’re just British couches) if it couldn’t do a proper address lookup. But it turns out a lot of people (who now hate BTConnect) were intentionally putting in fake MX records with no matching A record to try and subvert spammers. The end result is that BTConnect clients are unable to send mail to any domains that were fighting spam in this way. I’m not going to argue which side is being legal here. They’re both doing things that are “unintended”.

    But what’s worse is that BTConnect assumes that the whole world is IPv4-based and treated my perfectly legal AAAA-only record mail6.hardakers.net entry as bogus. This prevented an associate from being able to email me (about designing protocols, ironically). Bad Bad BTConnect! (no bone!) You need to get with the game, because the IPv4 game is about over at this point. And stop hacking protocols because you’re affecting your client’s ability to conduct daily business by sending legitimate E-Mail.

    Enter the (new) Era of Facebook

    Facebook (unfortunately, IMHO) is trying to get everyone to communicate with each other solely through their website. The good news is that they’re actually trying to be up on the IPv6 front and even have an IPv6-only version of their website available. (If you can visit successfully it means you and your ISP is IPv6 enabled. But you’re probably not since 99% of the ISPs out there are not yet compliant).

    Now, many people are actually paranoid about deploying IPv6 enabled infrastructure too quickly and often attempt trickery to try and ensure that if some user out there is trying to get to them that they can. Rather than trust a user’s ISP to have correctly set up IPv6, they assume that all other ISPs out there are IPv6 broken even if they might not be. To reword that in simple terms: many places try and intentionally prevent you from reaching them over IPv6. Because they trust IPv4 and “just aren’t sure” about IPv6 yet. Hence the reason you have to go to a different domain name if you want to use IPv6 with Facebook, and they’re default web page (www.facebook.com) isn’t IPv6 compliant.

    Facebook does this IPv4-only hack in a bit more tricky, and DNS-illegal, sort of way. Here’s the nitty gritty details that will make DNS-experts cringe (but most other people won’t catch the problems). First, this all has to do with apps.facebook.com, which is where Facebook sends you to get your virtual hands dirty by tending to your screen through planting green pixels into fields of brown pixels. So, lets see what it takes to look up address records for apps.facebook.com.

     # dig @glb1.facebook.com. apps.facebook.com AAAA
     apps.facebook.com.      30      IN      CNAME   star.facebook.com.
    
     # dig @glb1.facebook.com. apps.facebook.com A
     apps.facebook.com.      30      IN      A       66.220.153.28
    

    Now, the DNS specialists here will immediately point out that what you see above is illegal in the DNS protocol world. My co-worker, who has memorized the RFCs better than I have, nicely extracted the right quote about this:

     "If a CNAME RR is present at a node, no other data should be 
     present; this ensures that the data for a canonical name and its aliases
     cannot be different.  This rule also insures that a cached CNAME can be
     used without checking with an authoritative server for other RR types."
    

    To reword that in simple terms: you can’t have a CNAME and an A name existing for the same record (even for different query types, like A and AAAA).

    Now… Did this break something? Yes.

    First, I found one web-browser/DNS-stack combination that refused to go further. The instant it got a serious error with a record while searching for an IPv6 address, it gave up and didn’t try to find an IPv4 address. Not exactly wise either, but not illegal. Ironically, this was the exact sort of thing that the Facebook DNS hackery is trying to prevent: the customer not getting to the site. And some green electronic crops probably turned brown and withered. Electronically.

    This DNS hackery also causes the most popular recursive name server in use today to be equally as annoyed with AAAA queries:

     # dig apps.facebook.com aaaa
     ...
     ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 31717
    

    Update: 2011-01-26

    They seem to have now realized that the above breaks thing. So they’ve started doing different illegal things in hopes that it would magically start working.

    # dig @ns4.facebook.com. apps.facebook.com ns
    ;; AUTHORITY SECTION:
    apps.facebook.com.      30      IN      NS      glb2.facebook.com.
    apps.facebook.com.      30      IN      NS      glb1.facebook.com.
    
    # dig @glb2.facebook.com. apps.facebook.com ns
    ;; ANSWER SECTION:
    apps.facebook.com.      30      IN      A       69.63.189.62
    

    Yes, you read that right: query for a NS record to ensure it’s accurate and you get back an A record instead. That’s what you really wanted, right?

    Conclusions

    The biggest conclusion here: if you’re going to hack, do so to speed things up. Do so to make things better. Do so to make things more interoperable. But do not assume that you’ve considered all of the corner cases with a protocol when you decide to modify the rules. The results will likely be less customers reaching your service, not more.

    Oh. And IPv6 is coming. Please get ready. But without the hackery.

Comments (2)

What’s the Difference Between Facebook and Twitter?

Many of my friends and family have been confused over the differences between Facebook and Twitter. (Most of the confused use one and simply don’t know what the other is). There has also been a lot of speculation on the net about how Facebook has been slowly trying to take on twitters surge in popularity through their adoption of Twitter-like-qualities.

This write-up documents some of the important differences between the systems so that you can decide which is best for you and how you should think about using each one.

First the Similarities

The core part of both Facebook and Twitter surround “status messages” that you and your friends post to stay in touch with each other. Messages like “just got back drom the new star trek movie” will frequently start an online discussion between those you know about how successful the new film was as a “reboot” of the old series. More boring messages like “I just woke up” will only stir up the electronic version of crickets and will provoke little conversation.

On to the differences…

Openness

Facebook was designed as a web-browser based service: you log into their site through your web-browser to see status updates from your friends mixed with their advertisements.

Twitter has, since it’s early days, provided a programming interface (API) to it’s service. This interface let’s programmers write applications that check for new tweets, submit your own status messages, etc, all without actually visiting Twitter’s web page. The result is that there are many many applications and ways to interact with Twitter content besides just navigating to the twitter web page. The most popular ones tend to be the ones that sit on your desktop or in your toolbar and notify you when new tweets arrive.

Openness of the Data

By default, Facebook hides all your data so only friends (and approved game applications) can see your status updates and personal information.

Twitter is the opposite though, for both good and bad. It defaults to posting your messages publicly for the world to search through.

This, by far, is the biggest in usage differences. If you end up using both systems, just think before you post who your audience is. But more importantly, I like it this way. There are many updates that I post to both systems because I either don’t care or actually want them heard widely. The announcement for this blog posting, for example, I’ll submit to both services. I also tend to post smaller and more frequent comments to just Twitter. And much more personal comments to just Facebook.

Update Frequency

Because of the open API and extensive external application support, Twitter is more in your face 24/7 and integrates into your day rather well. The result is kind of a constant connection feeling with lots of friends, services and celebrities. The ability to tweet quickly in seconds is always present because somewhere on your screen you already have an open box waiting for you to type in your latest pontification. There are even application plugins that monitor what you’re doing and provide a tweet on your behalf (such as every time your music player switches songs). Many early tweeters make the mistake of tweeting way too much and let you know all about their third bite of a taco bell buritto you probably don’t care about. (They also quickly lose their followers). The better twitterers post only interesting thoughts and activities.

Facebook on the other hand is designed for less frequent status updates and less frequent review of your friend’s updates. Most users log into the site a few times a day, respond to the discussions, update their status (maybe) and play a game or two. It’s designed to be a “visit when I have time site” and is not designed to let you know that your BFF just put on her left sock.

But the instant notification ability of Twitter is what makes it far superior for service broadcasts. Many important services today have twitter feeds for major events (eg, the White House, the RedCross, CNN Breaking News or even Earthquakes that occur near San Francisco) so that you can be instantly informed about events happening at a given instant.

Twitter has also always had the ability to send and receive cell phone text messages. You can have the service text you when your favorite friends update their status and likewise you can update yours by sending a text too. Many smartphones have Facebook applications or web browsers, but twitters SMS tie-in is, again, designed to make you feel continuously connected (no matter how old your phone is).

Status Update Size

Twitter messages have a size limit of 140 characters, which isn’t much (note how easily it fits into a 160 character SMS message? Surely their choice of size was deliberate!). Twitterers learn to abbreviate and be witty in a very small space.

Facebook, however, lets users write multiple paragraphs about their current thoughts. This works much better for ideas you just can’t convey in a short burst. Twitter is referred to as micro-blogging, and Facebook is in between Twitter and a full-size, long-winded blog like this one.

Data vs Presentation

Another major difference between Facebook and Twitter is the presentation. Twitter is all about the content and the data. It doesn’t concentrate on presenting it in fancy graphics on their site (though many desktop applications actually look much better than the Twitter home page). Twitter just wants to bring you data fast and it excels at doing just that.

Facebook, on the other hand, is a complete package. It’s like the “Hotel California” as it wants you to never leave. It’s entrance hall is splendidly decorated with fancy graphics, profiles, pretty colored reply boxes, etc. Every link from Facebook tends to take you to another Facebook wrapped external page or application so you’re always encouraged to return to Facebook immediately. But, their web interface is a beautiful blend of simplicity and function (apple would be proud).

Twitter is also just status messages only with no extra features, while Facebook is constantly tempting you to take a new quiz or play a new game. Facebook’s interactive and highly-addictive multi-player games are wonderful distractions and suck up hours of your time. Twitter almost seems dull after having spent an hour trolling around Facebook’s site.

So which should you use?

You’ve probably guessed my answer by now: Both!! I have both a Facebook and a Twitter account and use them both daily. I love them equally, but for very different reasons. Facebook is a collection of conversations with friends and family. But Twitter has actually helped me make new friends through it’s openness.

The truth is, they’re very different beasts that serve fairly different purposes. Regardless of what Facebook does to become more Twitter-like it may not matter if the users don’t want or use the Twitter-like changes (I for one like the differences). If Facebook adopts many of the Twitter attributes of openness it will mean losing out on an important aspect of Facebook: your status updates go to your friends and family and people you trust.

So I suggest you try them both and hopefully you’ll even use them both. They’re free, after all. What do you have to lose (but time)?

Comments (1)

My Wife’s Solution to Random Farmers Dropping By

These days if you play FarmTown and you visit “The Marketplace” in order to sell some goods, get hired, or whatever you’re likely to find occasionally that random people follow you back home to your farm when you leave. This seems a bit odd to many people. I mean, if you go to your local grocery store and some random person followed you back to your house you’d probably call the police right? In fact, this is the whole reason we have these things called “locks” on our front doors. To prevent everyone, including friends, from randomly entering our house. Farmtown, however, doesn’t have locks. (Fortunately there isn’t much they can do in your farm so it’s not really a huge concern)

Why people are doing this in facebook too I’m not sure. I suspect that they’re looking for a job (ie, they want to work in your fields for cash) and they’re hoping you’ll hire them.

My Wife’s Solution

So, my wife had a smart idea: never hire them. In fact, make sure you can’t. She does this by clicking on them and then clicking “ignore”. By doing this you add them to the list of folks that are functionally “banned” from your view of the game. The result is that no matter how much they beg you for a job in the marketplace in the future, you’ll never see them and will never hire them. Plus they immediately disappear from your farm as well.

I thought this was a great idea to solve the annoying-farmers problem.

Comments (6)

How I Cheated at FarmTown Today

Cheat??? Why??? Well, after posting my previous blog entry about FarmTown cheating I noticed a huge number of Google and other search engine hits by people looking for “how can I cheat at FarmTown”, etc. Apparently I’m not alone in the desire to overcome FarmTown boredom.

There is a huge amount of wonderful pages devoted to farmtown data, but not as much about advice about how to play efficiently. For those just looking for how much stuff costs, what level you get it at, etc, I recommend
Uncle Joe’s Farm Town Addicts Site

Today’s Progress

While working diligently away on my farm today and jumping from level 19 or 20 (I forget) to level 24 I:

  • Ate a wonderful father’s day breakfast with my family that was prepared by my wife
  • Filled up the car with gas
  • Packed the car
  • Went shopping
  • Played a game of pool
  • Read to my daughter

Motivation

Well, simply put I wanted to be level 27 so I could buy rivers. I didn’t get all the way there today, but I made a good leap forward. The problem with farmtown is that after the first 15 levels or so it gets very boring when it comes to the farming aspect itself. Not the building pretty pathways and stuff aspect, but the aspect of cultivating a huge set of crops just to try and get more experience points.

This, in my opinion, is a fault of FarmTown’s. They should, after a certain level, make it easier to clear and plant a field full of crops with one “select a rectangle” type motion. It’s cute when you first start to plant each square, but boy does it get boring by the time you get up there in levels. And because levels get harder and harder to achieve the level reward is less and less (aside from the financial increase, which is constant).

FarmTown isn’t the only game with this problem. It dates back to any large “build an empire” type games including empire (the old ascii text game for those that remember it) to warcraft and to the latest in the line: FarmTown. Maintaining a huge set of maintenance tasks gets dull and dry.

But… I really wanted to be level 27. I just didn’t want to spend the time.

Enter The Cheat

Ok, it’s not a “real” cheat. It’s well known, as I’ve discussed previously that you can turn FarmTown cash into FarmTown experience points. The cheapest way to do this is by adding hay bails to your farm. At the end cost of roughly 1 experience point per 10 FarmTown coins spent the hay bails are the best return.

But, it’s boring putting out a gazillion hay bails too, so why is that any better? It provides you increased speed at yet more boring work.

Or does it. I handled this by recording mouse clicks with a mouse event recorder and then playing them back. I’d buy a hay bail and then sell it. And then tell my computer to repeat the process over and over for me while I went and did something else.

Sure, occasionally it would mess up and start trying to place a bail on another, but in general it worked and I got a lot of house-hold chores done instead! Yay! I’m level 24 now!

So if you want the amount of coins you have divided by 10 in experience points, you might give this approach a shot. I don’t have software to recommend to you (see below for my linux notes) but I’m sure if you search for some for your OS of choice you’ll find something. I know stuff exists for windows, and I suspect for OSX as well.

Advice for FarmTown Developers

Don’t get mad at the people that want to cheat. Fix the issue within the game. I’ve noticed that a lot of my friends simply stop playing near level 28 or so because it’s just boring after that. You’ll loose customers unless you can fix the boring aspect of the higher levels. Add something else for them to do instead that captures their interest again.

Final Linux Geek Note

Turns out that all the linux event recording software is dated and doesn’t work. There is some playback software though. I wrote a quick script to wrap around xte from xautomation to record and then replay what I needed.

Comments (14)

How to win (sort of) at Facebook’s FarmTown

[Update: make sure to read my follow on article as well: How I Cheated at FarmTown Today]

Any game, is of course, accompanied by a number of different ways you can attack the problem of “how do I get a high score as quickly as possible”.

Facebook’s FarmTown game is highly addictive to many people and some of my friends have spent endless hours carefully laying out rice fields for harvest two days later.

Status in FarmTown

There are really only two things worth achieving in FarmTown: Money and Levels/Experience Points. Money is earned by planting and harvesting crops (or better yet, having someone else harvest your crops for you). And, if you harvest someone else’s crops then you get some extra cash too (it’s a good deal for both sides). The fastest way to get cash is to go hang out in the market place and beg people for jobs harvesting their fields.

But experience points you only get by either plowing, planting crops, visiting friends farms, or building infrastructure. Now, you can only visit your friends for experience points roughly twice a day. And there is only so much space on your farm so after you’ve filled you soil with crops and farming infrastructure (virtual barns, paths, scarecrows and hay bails) you have to sit back and wait until the crops are ready.

Or do you…

[Update: as people have pointed out in the comments and as I discuss in How I Cheated at FarmTown Today using hay bails for converting cash to experience points is more efficient]

Many people have figured out that planting grapes earns quick experience points because in 4 hours their ready again. Yes, they’re not worth much but they do turn around quickly. Thus if you’re shooting for straight XP then grapes seem like the right way to go.

But there is a better way:

  1. Plow your whole field per normal (20 coins per square and it’s worth 1 XP)
  2. Plant grapes in your whole field (also 20 coins per square and it’s worth 2 XP)
  3. Buldoze them over immediately (gasp!!!)
  4. Go back to step #1

(and for you slashdot readers add in “Profit!” somewhere)

See… If you’re willing to spend the cash (40 coins) and the time (something you’ll admittedly never get back) then you can earn 3 XP points per square. Quickly. Keep repeating till your out of cash. You’ve probably just levelled up quite a bit.

When you run out of cash, go to the market place and beg people for a job to get more cash. I bet following this formual you could go from level 1 to level 20 in a day without breaking a sweat on anything other than your index finger.

Begging for jobs

Having done a bit of job begging, here’s my advice: be smart, be witty, be silly. You’re much more likely to get a stranger to hire you than if you just keep chanting “hire me”. When I’ve simply made funny jokes about wanting to get hired I’ve gotten jobs much faster than the others around me that were closer to “annoying”.

After all is said and done

Go outside into the real world and mow the real lawn. You probably need it at this point.

Comments (32)