?

Log in

No account? Create an account
On evil routers - 'Twas brillig, and the slithy toves did gyre and gimble in the wabe [entries|archive|friends|userinfo]
Thomas

[ website | Beware the Jabberwock... ]
[ deviantArt | the-boggyb ]
[ FanFiction | Torkell ]
[ Tumblr | torkellr ]

Links
[Random links| BBC news | Vulture Central | Slashdot | Dangerous Prototypes | LWN | Raspberry Pi]
[Fellow blogs| a Half Empty Glass | the Broken Cube | The Music Jungle | Please remove your feet | A letter from home]
[Other haunts| Un4seen Developments | Jazz 2 Online | EmuTalk.net | Feng's shui]

On evil routers [Friday 21st January 2011 at 6:51 pm]
Thomas

boggyb
[Tags|]
[Playing |Columbus (Didn't Find America) ~ Show of Hands/The Best of Show of Hands - Disc 2]

By popular request, another conversation between me and a misbehaving bit of kit.

The other day at work, I was testing a bit of embedded hardware down in the lab. Now, between the lab and my desk is an evil router with delusions of grandeur (it thinks it's a proxy server)...

Me: Upload this file to the unit.
Management tool: Sure thing! Hey unit, gimme a file number.
Unit: 42!
Management tool: Groovy! Right, router, I need to open a TCP connection to the unit.
Evil router: Here's your connection.
Management tool: Yay!
Evil router: Oi, unit, gimme a TCP connection.
Unit: Here you go. I've not got much memory, so you gotta keep all packets under 512 bytes, savvy?
Evil router: Here's your connection, but it's got a 512-byte limit.
Management tool: Uh, you've already given me a connection. You must not have received my "Yay!". *ignores duplicate SYN/ACK*
Management tool: Ok, time to send the data! Here's the first 1024 bytes.
Evil router: *forwards packet*
Unit: Right, let's read this packet... argh! It's too long! *ignores packet*
Management tool: Hmm, unit's not told me it's got the data yet. Here's the first 1024 bytes again.
Evil router: *forwards packet*
Unit: Right, let's read this packet... argh! It's too long! *ignores packet*
Management tool: Hmm, unit's still not told me it's got the data yet. Here's the first 1024 bytes again.
Evil router: *forwards packet*
Unit: Right, let's read this packet... argh! It's too long! Your network really sucks, mate! *ignores packet*

*ten minutes later*

Management tool: Hmm, unit's still not told me it's got the data yet. BORED NOW.
Evil router: Muwhahahaha!
Unit: I'm still waiting for that data.
Me: Wait, what do you mean "time out".
Me: Fine, try again.

*another ten minutes later*

Management tool: Hmm, unit's still not told me it's got the data yet. BORED NOW.
Evil router: Muwhahahaha!
Unit: I'm still waiting for that data. And I'm still waiting for the data from the first connection as well.
Me: Time out again? Weird. Ah well, third time lucky and all that

Me: Upload this file to the unit.
Management tool: Sure thing! Hey unit, gimme a file number.
Unit: 42!
Management tool: Groovy! Right, router, I need to open a TCP connection to the unit.
Evil router: Here's your connection.
Management tool: Yay!
Evil router: Oi, unit, gimme a TCP connection.
Unit: Here you go. I've not got much memory, so you gotta keep all packets under 512 bytes, savvy?
Evil router: Here's your connection, but it's got a 512-byte limit.
Management tool: Uh, you've already given me a connection. You must not have received my "Yay!". *ignores duplicate SYN/ACK*
Unit: Actually, wait, you're using all the data connections I've got. *closes connection*
Management tool: Buwh? I AM ERROR.
Me: Argh!

I spent a lot of time looking at the packet trace for that before I twigged what was going on. The evil router sends a SYN/ACK (with no options) to the client immediately, then forwards the SYN/ACK it received from the server. The client (I believe correctly) ignores the second SYN/ACK, and the result is the server and client have different ideas of how the connection is configured. In this case the unit uses small buffers for network data (for various reasons, including due to having a tiny amount of RAM) and so sets the MTU option in the SYN/ACK to 500 or so bytes. Which works perfectly as long as there isn't an evil router doing nasty stuff.
Link | Previous Entry | Share | Next Entry[ Penny for your thoughts? ]