weblog d’un abbe

20080530

Getting 8139too to work at 100 Mbps Full Duplex

Filed under: Experiences — Tags: , , , , — abbe @ 1210

I recently switched to my RTL-8139 NIC instead of default onboard Intel NIC, after I came to know that e100 uses binary blobs. I’ve a Netgear WGT624 WiFi router (acting as switch, atm). I plug-in my desktop at a 100 Mbps switch port in the switch. So now when I connected my RTL8139 NIC to my wireless enabled wired-switch, it comes online at 10 Mbps (full-duplex)

abbe@chateau ~ $ sudo ethtool rl0
Settings for rl0:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
        Advertised auto-negotiation: No
        Speed: 10Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 32
        Transceiver: internal
        Auto-negotiation: off
        Supports Wake-on: pumbg
        Wake-on: p
        Current message level: 0x00000007 (7)
        Link detected: yes

Now, I tried manually switching it 100 Mbps (full-duplex):

abbe@chateau ~ $ sudo ethtool -s rl0 speed 10
abbe@chateau ~ $ sudo ethtool rl0
Settings for rl0:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
        Advertised auto-negotiation: No
        Speed: 100Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 32
        Transceiver: internal
        Auto-negotiation: off
        Supports Wake-on: pumbg
        Wake-on: p
        Current message level: 0x00000007 (7)
        Link detected: yes

Now, to automate this, I added following line into /etc/modprobe.d/options and executed update-modules.

abbe@chateau ~ $ cat /etc/modprobe.d/options
options 8139too media=0x231
abbe@chateau ~ $ sudo modprobe -r 8139too
abbe@chateau ~ $ sudo update-modules
 * Updating /etc/modprobe.conf by hand ...                                                                                                                                 [ ok ]
 * Updating modules.dep ...                                                                                                                                                [ ok ]
abbe@chateau ~ $ sudo modprobe 8139too
abbe@chateau /etc/modprobe.d $ sudo /usr/sbin/ethtool rl0
Settings for rl0:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
        Advertised auto-negotiation: No
        Speed: 100Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 32
        Transceiver: internal
        Auto-negotiation: off
        Supports Wake-on: pumbg
        Wake-on: p
        Current message level: 0x00000007 (7)
        Link detected: yes

How to arrive at the number 0x231, check out modinfo 8139too and drivers/net/8139too.c source code. BtW, I just noticed that rl0 has auto-negotiation off, so I decided to turn it on, and following are the results:

abbe@chateau ~ $ sudo ethtool -s rl0 autoneg on
abbe@chateau ~ $ sudo ethtool rl0 
Settings for rl0:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
        Advertised auto-negotiation: Yes
        Speed: 10Mb/s
        Duplex: Half
        Port: MII
        PHYAD: 32
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: pumbg
        Wake-on: p
        Current message level: 0x00000007 (7)
        Link detected: no
abbe@chateau ~ $ sudo ethtool -s rl0 speed 100 duplex full
abbe@chateau ~ $ sudo ethtool rl0 
Settings for rl0:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
        Advertised auto-negotiation: Yes
        Speed: 100Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 32
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: pumbg
        Wake-on: p
        Current message level: 0x00000007 (7)
        Link detected: yes

After this I tried testing network speed using iperf, and got speeds of ~ 67 Mbps. With e100, I used to get ~ 97 Mbps. Anyways this is an 3-4 year old NIC, plugged (and unused) into my desktop unused since 2-3 years. So will try testing speeds with a new NIC soon.

20080529

Devanagari script rendering in GNU Emacs

Filed under: Hacking — Tags: , , , , — abbe @ 0101

In one of my posting, I mentioned how, Emacs is able to render Devanagari script text flawlessly without any issue. But few days ago, I noticed that this is not true anymore. Rendering is not proper, probably something is broken between the builds, as I emerge emacs-cvs every two-three days. Following is the thumbnail of screenshot (click to enlarge) of issue I was facing.

Emacs 23 not rendering Devanagari text properly

I reported this issue on Emacs bugtracker. Anyways, I found a workaround against this issue after being pointed out by Kenichi Handa on how to view what font is used for rendering a particular character. C-u C-x = is the keybinding, just move your point to the desired character and do C-u C-x =. On my box, Emacs was using FreeSans (from GNU freefont) font to render the text. Probably, the appropriate font determination algorithm needs to be fixed in Emacs. Anyways, I hacked the following Emacs Lisp code for a workaround, which hints Emacs to use Lohit Hindi-11 Xft font:

(defun my-setup-hindi-rendering()
  "Setup Hindi rendering"
  (interactive)
  (set-fontset-font "fontset-default"
		    (cons (decode-char 'ucs ?\x0900)
			  (decode-char 'ucs ?\x097f))
		    "Lohit Hindi-11"))

I’ve wrapped the code in defun, because I’m looking for a proper fix. So whenever I need to fix that Devanagari script rendering issue, I do M-x my-setup-hindi-rendering. Anyone who is experiencing similar issue, can try this and report any bugs. Happy operating Emacs system… ;)

UPDATE: As of now, this bug is fixed in Emacs CVS. I’m running GNU Emacs 23.0.60.1 (x86_64-pc-linux-gnu, GTK+ Version 2.12.8) of 2008-05-29 on chateau .

20080519

ERC + ctrlproxy

Filed under: Hacking — Tags: , , , — abbe @ 1721

Following is the Emacs LISP code, I hacked for ERC to use ctrlproxy:

(defun setup-ctrlproxy()
  "Setup Emacs for using ctrlproxy"
  (interactive)

  ;; socks.el is part of GNU Emacs 23
  (require 'socks)
  (setq socks-noproxy '("localhost"))
  (setq socks-override-functions 1)
  (setq erc-server-connect-function 'socks-open-network-stream)

  (setq socks-password "password")
  ;; ctrlproxy exposes itself a SOCKS 5 proxy
  (setq socks-server '("ctrlproxy" "localhost" "6680" 5)))

Now, whenever I want to connect to IRC (using ERC) via ctrlproxy, I simply do M-x setup-ctrlproxy which make ERC aware of ctrlproxy, then M-x erc to start ERC and at the IRC Server prompt I enter the name of the ctrlproxy network I want to connect to. Thats it. Happy, Emacsing… :)

20080516

Wanna measure latencies to different servers via ICMP

Filed under: Fun, Hacking — Tags: , , , , — abbe @ 0130
abbe@chateau ~/bin $ cat measure-latencies.sh
#!/bin/sh
# Author: Ashish Shukla 

SIXXS_SERVERS="nlams01 iedub01 nlams04 simbx01 deham01 bebru01 ptlis01 sesto01 noosl01 usewr01 usqas01 usbos01 gblon02 plwaw01 uschi02 chzrh01 dedus01"

for server in ${SIXXS_SERVERS}; do
	echo ${server}.sixxs.net = `ping -n -c4 ${server}.sixxs.net 2>/dev/null |awk '/^rtt min/ { print $4 }' |awk -F/ '{ print $2 }'`ms
done
abbe@chateau ~/bin $ ./measure-latencies.sh 
nlams01.sixxs.net = 353.104ms
iedub01.sixxs.net = 327.646ms
nlams04.sixxs.net = 483.722ms
simbx01.sixxs.net = 279.078ms
deham01.sixxs.net = 358.541ms
bebru01.sixxs.net = 347.362ms
ptlis01.sixxs.net = 346.989ms
sesto01.sixxs.net = 331.026ms
noosl01.sixxs.net = 346.034ms
usewr01.sixxs.net = 349.687ms
usqas01.sixxs.net = 345.009ms
usbos01.sixxs.net = 315.370ms
gblon02.sixxs.net = 359.834ms
plwaw01.sixxs.net = 352.248ms
uschi02.sixxs.net = 361.986ms
chzrh01.sixxs.net = 448.864ms
dedus01.sixxs.net = 321.748ms

I’ve hacked above bash script to measure latencies between my box and SiXXS PoPs. Hope this useful to you while deciding which PoP to use. Anyways, happy IPv6ing…:)

20080513

Emacs 23.0.60.1 renders Devanagari with no issues.

Filed under: Yippee!! — abbe @ 1242

Emacs 23 able to render Devanagari text
Emacs 23.0.60.1 देवनागरी लेख को अच्छे से render करता है .

/me =app-editors/emacs-cvs-23.0.9999 चलाता है .

Posted from GNU Emacs 23.0.60.1 (x86_64-pc-linux-gnu, GTK+ Version 2.12. 8) of 2008-05-13 on chateau

20080510

libjingle licensed under GPLv2

Filed under: Yippee!! — abbe @ 0047

Due to gpl-violations.org‘s efforts Google’s incorrectly licensed library libjingle is now licensed under GPLv2.

Thanks to mauropm for reporting the issue at their bug tracker. And wahjava for reporting this violation to gpl-violations.org.

20080507

Spoofing on Internet

Filed under: Experiences — Tags: , , — abbe @ 0123

Although it seems like dream to be able to successfully spoof on Internet in 21st century, but I realized this dream, yesterday. Thanks to the cheapest cyber café operator Tata Communications pretending to be an ISP. :)

I’ve a GNU/Linux box connected to the internet, via 2 ADSL internet connections from 2 cyber café operators, namely Airtel Broadband (not cheap), and Tata Communications (cheapest). Airtel Broadband connection is connected to my GNU/Linux box at eth1 interface, and Tata Communications connection is connected to eth2 interface. eth1 is assigned a RFC1918 IPv4 address, whereas eth2 is assigned a static and globally routable IPv4 address. Using eth2‘s address, I’ve setup a 6to4 tunnel, with interface name sit0 for my IPv6 internet addiction.

Now, yesterday I wasn’t able to ping google.com via eth2, though I recieved no ICMP errors from gateway. So I switched my default gateway to eth1. And after this, I’m able to ping google.com :). I thought I should also try ping6 ipv6.google.com though I’m sure that it won’t work, since sit0‘s source address is based on eth2‘s address, which is different from the current default gateway interface’s address, eth1. But to my surprise, it worked. I’m getting ICMP echo replies from ipv6.google.com :).

To confirm further, I tried curl http://ipv6.whatismyipv6.net/ |fgrep 'Your IP is' and I received sit0‘s IPv6 address as output. :). Now, this is confusing. Even though I’m able to send spoofed packets, but how I’m receiving replies of those spoofed packets, if internet connection on eth2 is not working, hmm…? So, I connected to #ipv6@ipv6.chat.freenode.net (being able to IRC over IPv6) to figure out what is happening, and at the same time I started sudo tcpdump -i eth2 proto 41 on another terminal to confirm whether I’m really receiving any IPv6-in-IPv4 packets on eth2 interface. And as expected, I’m getting IPv6 traffic over eth2. I thought maybe Tata Communications‘s connectivity has restored, but no success with sudo ping -I eth2 google.com :(. So I asked p1mrx on #ipv6@ipv6.chat.freenode.net to ping IPv4 address of eth2 and I started sudo tcpdump -i eth2 proto icmp in another terminal. I captured ICMP echo requests sent by h{is,er} box and also captured ICMP echo replies sent from my box. {S,}he confirmed that ping is successful.

CONCLUSION. The cheapest cyber café operator Tata Communications, pretending to be an ISP, is dropping my outbound traffic (TCP, UDP, ICMP echo request) but idiot operator’s dumb clueless retarted (and some more words you can think of…..) cyber café incharges, who never studied IPv4 networks, or don’t know that there is a protocol field (size: 1 byte) in the IPv4 header, which identifies what kind of payload that IPv4 packet is carrying, and has forgot to block all other protocols, ROFL. But why’re they doing this. /me is confused why they’ve blocked. Anyways I’ll call them today. Another reason why they’re retarded….

/me is confused how Indian cyber café operators will become an ISP and transition to IPv6 :(

20080506

Test Posting from Emacs

Filed under: Uncategorized — abbe @ 2357

This is a test posting from GNU Emacs operating
system
using weblogger.el
(enhanced).

20080503

Wanna talk to libjingle (or Google Talk) users from GNU/Linux

Filed under: Yippee!! — abbe @ 0245

vu3rdd explains.

Blog at WordPress.com.