Aug 272014
 

This post came about because HP (in their infinite wisdom) decided to make the web-based printer control all neat and tidy by aligning all of the IP columns and filling up the space with leading zeros. Spotted the problem yet?

Well you’re quicker than I was; although I had the advantage of knowing that something was wrong and that somebody had pasted that IP address with leading zeros, it took me a few seconds to wonder if it was just possible that leading zeros might be doing something “odd”.

The thing about IPv4 addresses (and IPv6 as well, but I’ll not be pasting in examples for those as they’re too long) is that they are not simply what we see on screen as 10.0.0.1 (or whatever). That representation is converted into a 32-bit binary number which is used as the address. As an example :-

✓ mike@pica» ping -c 1 10.0.0.1
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_req=1 ttl=255 time=0.688 ms

--- 10.0.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.688/0.688/0.688/0.000 ms
✓ mike@pica» ping -c 1 167772161  
PING 167772161 (10.0.0.1) 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_req=1 ttl=255 time=6.04 ms

--- 167772161 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 6.040/6.040/6.040/0.000 ms

As you can see, you do not have to use the conventional “dotted quad” representation; you can use the integer equivalent instead. You can also see why the “dotted quad” representation was invented!

To convert the “dotted quad” notation to an integer that can be used at the lowest level, certain calculations are performed. Either because of a peculiar clause in the original specifications of IPv4 addresses, or (and potentially more likely) as a side effect of one of the earliest implementations of IPv4, certain other representations are possible :-

✓ mike@pica» ping -c 1 0xa.0.0.1
PING 0xa.0.0.1 (10.0.0.1) 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_req=1 ttl=255 time=1.34 ms

--- 0xa.0.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.341/1.341/1.341/0.000 ms
✓ mike@pica» ping -c 1 012.0.0.1
PING 012.0.0.1 (10.0.0.1) 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_req=1 ttl=255 time=1.03 ms

--- 012.0.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.034/1.034/1.034/0.000 ms

As you can see, each individual octet (the numbers between the dots) can be represented in decimal (as we expect), in hexadecimal (by prepending “0x”), or most dangerously, octal (by prepending at least one “0”).

So an apparently innocuous IP address like 10.0.0.030 will actually by converted into an integer that can be converted back into a more usual 10.0.0.24 :-

✓ mike@pica» ping 10.0.0.030
PING 10.0.0.030 (10.0.0.24) 56(84) bytes of data.

There are several lessons to learn from this :-

  1. HP needs slapping with a really rotten haddock to make them realise that their printers have web interfaces that are unhelpful in the extreme.
  2. Leading zeros may be harmful, or at least may result in being slapped with a rotten haddock.
  3. Leading zeros in IP addresses indicate the use of octal and so the result may not be what you expect.
  4. Reading the screen can be helpful when diagnosing problems. It may be easy to miss, but there are clues enough to solve this little challenge even without knowing about octal.

 

Aug 212014
 

Everyone knows who I am talking about – those christians who keep banging on about how homosexuals are “broken” or evil or whatever weird names they’ve come up with lately. Like Scott Lively, Fred Phelps, Laura Schlessinger, etc.

The normal and sane response to finding out that someone prefers same-sex partners is to shrug it off as a matter that is nobody’s business but the people involved.

But “god hates homesexuality” claim the christian homophobes. So I gather, but I also gather this god person hates lots of other stuff too – mixed textiles, women who try and stop men fighting, no cursing, no gossiping, weird foods, etc. So why are these people so bent out of shape when it comes to a little harmless sex between consensual adults?

Well, when we normally encounter someone with a prurient interest in the sex lives of other people, we usually find that they like watching other people have sex. And we call them “voyeurs”.

If we were to postulate a hypothetical group of voyeurs who for some reason or another (perhaps “christianity”) repressed their sexual perversion, we would be quite likely to find them coming to hate the “objects” of their unnatural desire.

Which sounds a great deal like these christian homophobes.

Perhaps we should be treating these christian homophobes with compassion. Telling them their desires are perfectly fine (if they get permission first) and sending them free porn!

Aug 202014
 

The average Islamic extremist when he has time to think about anything other that licking his favourite pig, is under the mistaken belief that the western world is fundamentally weak. Weakened by our dissipated and irreligious lives; weakened by our usual sympathy for the underdog.

This is perfectly understandable for the moronic medieval minds that most Islamic extremists carry around with them. Because in some ways the west does look weak.

But the west is not weak as it has shown again and again since the start of WWII. However it is reluctant to start anything without taking care that it is doing the right thing. Time and again, whenever the west has gotten involved with something without thinking enough in advance (Vietnam, Iraq, etc.) it has gotten bogged down in something it realises that it shouldn’t have started.

But the west will get involved if it is provoked enough and it believes that it is on the right side.

The beheading of James Foley by the pig-licking thugs sometimes known as ISIS, ISIL, IS or just Daesh would appear on the surface to be an attempt to discourage the US and the west from getting involved. It would seem that the US air strikes and the push by the Kurdish and Iraqi military have started making things difficult for IS, and they would like to stop the US air strikes.

What they have accomplished is to encourage the US and the rest of the west to stay involved and take more measures.

They may regard themselves as some sort of ultra-religious freedom fighters, but anybody who uses extortion, flogging, amputations, rape, and indiscriminate killings are nothing more mindless pig-licking thugs.

 

 

 

Aug 152014
 

To anyone who is aware of the history of Nazi Germany’s actions leading up to Word War II, there’s something alarmingly familiar about Putin’s actions recently.

Germany lost a lot of territory after World War I, and Russia lost a lot of territory after the break-up of the Soviet Union.

Germany annexed Austria in what became known as the Anschluss, and in a quite similar move Russia annexed the Crimea.

Germany “rescued” the German minorities from “repression” in Czechoslovakia by annexing the parts of the country with large ethnic German populations; Russia appears to be trying the same thing in the eastern Ukraine.

It is probable that Putin is not trying to emulate Hitler by exterminating a whole “race” of people, but Hitler wasn’t considered to be a monster just because he tried to exterminate the Jews (and other minorities he didn’t like), but also because he was a military adventurer who provoked one of the deadliest wars in history.

And Putin does seem to be in the early stages of something like that.