IrNET for Linux-IrDA



Linux-IrDA Java-IrDA e-Squirt Linux & Wireless LANs Papers Main page

Presentation Download Information Implementation Compilation Setup Usage Performance & debug


What is IrNET ?

The IrNET for Linux-IrDA is an Open Source project with contributors from all over the world (Norway, Brazil, France...). I initially wrote the IrNET module in spring 2000 thanks to Hewlett Packard sponsoring my work.

IrNET is a protocol allowing to carry TCP/IP traffic between two IrDA peers in an efficient fashion. It is a thin layer, passing PPP packets to IrTTP and vice versa. It uses PPP in synchronous mode, because IrTTP offer a reliable sequenced packet service (as opposed to a byte stream). In fact, you could see IrNET as carrying TCP/IP in a IrDA socket, using PPP to provide the glue.

The main difference with traditional PPP over IrCOMM is that we avoid the framing and serial emulation which are a performance bottleneck. It also allows multipoint communications in a sensible fashion. And finally, we can automatically handle incomming connections through irnetd.

The main difference with IrLAN is that we use PPP for the link management, which is more standard, interoperable and flexible than the IrLAN protocol. For example, PPP adds authentication, encryption, compression, header compression and automated routing setup. And, as IrNET let PPP do the hard work, the implementation is much simpler than IrLAN.

IrNET was first introduced by Microsoft in the IrDA stack of Windows 2000, and they decided to remove both IrCOMM and IrLAN in favor of IrNET in their new IrDA stack. IrNET is a great idea (removing IrLAN and IrCOMM, on the other hand...), however IrNET is not an IrDA specification (at least, not yet, but there are rumors of something called IrDial...).

IrNET has been included in Linux kernel 2.4.0-test11, so all subsequent version of the kernel should support it out of the box (provided everything is set up properly). The latest version is in Linux kernel 2.4.15.


IrNET bits to download

Here are the things you may want to grab :


More information

A few ressources :


The Linux implementation

IrNET is written on top of the Linux-IrDA stack, and interface with the generic Linux PPP driver. Because IrNET depend on recent changes of the PPP driver interface, IrNET will work only with recent kernel (2.3.99-pre6 and up).

The present implementation offer the following features :

Currently missing :


Setting up IrNET

It's very simple : Then, on top of the regular IrDA configuration, you need to add the following line to /etc/modules.conf :
--------------------------
# IrNET module...
alias char-major-10-187 irnet           # Official allocation of IrNET
--------------------------

Then, you need to create the corresponding device :

> mknod /dev/irnet c 10 187

If you use IrNET on a regular basis, you may set the default pppd flags that you use directly in a config file instead of having to type them on the command line each time. Christian Gennerat recommend to create a /etc/ppp/options.irnet configuration file, and you can put in it the following content :

--------------------------
local
noauth
nolock
connect-delay 0
idle 10
lcp-echo-failure 2
lcp-echo-interval 5
nobsdcomp
deflate 11 11
--------------------------
Of course, please modify this example with your own favorite flags...


There is a couple of classic gotchas. The kernel 2.4.X need a newer version of the modutils package. Without that, none of the modules will load.

Also, the new ppp driver in this kernel may need extra configuration in /etc/modules.conf, like this :

--------------------------
alias char-major-108	ppp_generic
alias /dev/ppp		ppp_generic
alias tty-ldisc-3	ppp_async
alias ppp-compress-21	bsd_comp
alias ppp-compress-24	ppp_deflate
alias ppp-compress-26	ppp_deflate
--------------------------
However, most modern distributions do that correctly for you.

Finally, you may want to upgrade to the latest version of pppd (2.4.0 or later) wich adds the "nolock" flag...

Setting up and testing the standard Linux-IrDA

Before attempting to try out IrNET, you must make sure that Linux-IrDA works for you. Quite often, getting Linux-IrDA to work the first time is a bit a challenge, but once it is working it tend to be solid and reliable.

Of course, the main problem is the documentation and the stack are not in sync, so it's often difficult to know if a snipset of info apply to a version of the stack or another.

I've put together a quick tutorial on the basics of Linux-IrDA, you may want to read it ;-)

Dag is also very helpful and reply sometimes quickly to any inquiries on the Linux-IrDA mailing list. However, do not abuse of him too much, because maintaining the Linux-IrDA stack is hard work. Also, mention explicitely which version of the stack you are using, which hardware and which setup/application to avoid wasting his time...


Simple use of IrNET

Once all the above is done, to set up a IrNET link between 2 computer, just start the IrDA stack the normal way, and then just run on each side simultaneously :
> pppd /dev/irnet 9600 local noauth

Each pppd will attempt to connect to the other side and after a few seconds will exit. Please note that the speed setting is totally ignored by IrNET, but pppd insist on it...

If you want one computer wait forever for incomming connection (instead of exiting after a few seconds - to act as a server), you would run on it :

> pppd /dev/irnet 9600 local noauth passive

Also, you may want the IrNET connection to go down when inactive, because otherwise it would stay forever unless the IrDA link is broken. You can do it like this :

> pppd /dev/irnet 9600 local noauth idle 10

Note that in some cases, pppd doesn't allocate automatically the IP addresses. This may happen if the ppp option "noipdefault" is set, if the computer use DHCP, or if it is poorly configured. In those cases, you need to specify the IP address on each side of the link via the pppd command line, and you would do :

> pppd /dev/irnet 9600 local noauth 10.0.0.1:10.0.0.2

For more fun, refer to the documentation of pppd...

Multipoint operation

For multipoint operation, you are required to use pppd 2.4.X. This version of pppd support the "nolock" option.

Note also the the IrDA LAP layer accept only one connection per physical port at a time (this is a limitation of the protocol, so there is not much we can do about it). This doesn't prevent you to have multiple inactive instances, but in order to have multipoint IrNET instance running simultaneously, the computer must have multiple IrDA ports. For example, in my setup I use a dongle on each serial port :

> irattach /dev/ttyS0 -d actisys+ -s
> irattach /dev/ttyS1 -d actisys+ -s

If you want a node to accept more than one incomming IrNET connection, you would do :

> pppd /dev/irnet 9600 local noauth nolock passive
> pppd /dev/irnet 9600 local noauth nolock passive

If you want a node to connect to a specific IrDA node, you would do :

> pppd /dev/irnet 9600 local noauth nolock connect "echo name MyIrDANode"

If you want to accept incomming connections only from a specific IrDA node, you would do :

> pppd /dev/irnet 9600 local noauth nolock passive connect "echo name MyIrDANode"

You can also specify an IrDA address if you wish :

> pppd /dev/irnet 9600 local noauth nolock connect "echo addr MyIrDAAddr"

User space daemon (handling incomming connections)

There is only one task that pppd and irnetd don't do for you, which is automatically accepting incomming connections, so that you don't have to start pppd on both end but only on one side (for the record, W2k doesn't provide this feature either).

Fortunately, the task is trivial. We have written a sample implementation of irnetd. All what irnetd does is to wait for incomming requests on the event channel and launch the appropriate pppd command. irnetd consume very little ressources, so can be lauched in background at system startup.

The single link operation of irnetd is as follows :

> irnetd &

It will display the pppd command that it will use, and will just sit there. When another box try to connect to this one, you don't need to lauch pppd or have a passive instance waiting. To connect to other machines, you can still use pppd as described above.

For multipoint setup, it can be lauched as follows :

> irnetd noauth nolock idle 10 &

This version of irnetd is experimental. You may want to refine it, change the pppd flags, improve on it or submit a version in your favorite language (C, Java, Perl, Python...).


Performance

We haven't done any detailed performance benchmark. I have done a few tests using my SIR dongles (115 kb/s), and here are some numbers : I did more tests with two NSC FIR devices with a link at 4 Mb/s. The results are : I welcome tests with more 4 Mb/s IrDA devices and comparative benchmark with IrLAN and PPP over IrCOMM.

Info and debugging...

The first useful tool is the information in /proc/net/irda/irnet, listing all the IrNET instances :
> cat /proc/net/irda/irnet
IrNET server - IrDA state: running, stsap_sel: 10, dtsap_sel: 00

IrNET socket 0 - Requested IrDA name: "", addr: ffffffff
        PPP state: registered, unit: ppp1, channel: 2, mru: 1500
        IrDA state: connected, daddr: 640ad68b, stsap_sel: 10, dtsap_sel: 12

IrNET socket 1 - Requested IrDA name: "MyIrDANode", addr: ffffffff
        PPP state: registered, unit: ppp0, channel: 1, mru: 1500
        IrDA state: idle, daddr: ffffffff, stsap_sel: 00, dtsap_sel: 00
>

The server is running fine, there is one instance accepting any incomming connection, and it is currently connected, the other instance is waiting for a specific node.

The second thing is to look at the IrNET events on /dev/irnet :

> cat /dev/irnet 
Discovered 255e7c59 (MyIrDANode)
Discovered 255e7c59 (MyIrDANode)
Discovered 255e7c59 (MyIrDANode)
Connected to 255e7c59 (MyIrDANode) on ppp0
Disconnected with 255e7c59 (MyIrDANode) on ppp0
Discovered 255e7c59 (MyIrDANode)
Discovered 255e7c59 (MyIrDANode)
Discovered 255e7c59 (MyIrDANode)
Discovered 640ad68b (AnotherOne)
Discovered 640ad68b (AnotherOne)
Discovered 640ad68b (AnotherOne)
Connection from 640ad68b (AnotherOne) on ppp1
Request from 255e7c59 (MyIrDANode)
>

Of course, all the usual IrDA and PPP tools are still useful to see what's going on (irdadump, /proc/net/irda/discovery, /proc/net/irda/lmp, ifconfig, pppd debug...).

The Windows 2000 situation

We did some really quick test with Windows 2000, and Luiz managed to get some IrNET link between a Linux box and a W2k box in a somewhat reliable fashion. There are two parts to getting a connection: creating the irNET "dial-up" on the Windows 2000 box, and setting the PPP configuration on the linux box.

One of the first roadblock is to enable IrNET on the Windows 2000 side. In the Control Panel, you need to open the "Network & Dial-up Connections" box. It may ask you at this point your phone setup, don't worry. Then, you create a new connection, and you specify "Connect directly to another computer" and then select the IrDA port.

The second thing is that W2k doesn't automatically setup IP addresses, therefore you need to put some IP addresses on the pppd command line (see above). It will not connect if both addresses are not specified, but once they are it connects reliably. Furthermore, it seem that W2k doesn't like to be set up an address which already exist within the already configured routes, so you can't reuse the IP address of another interface, you need to give it something else. If you try to repeat the address of your main Ethernet interface, which is valid under linux and under the general PPP specification, it will complain of an address conflict, and will abort the connection. The safest address to use in this case is one belonging to the old non-routed class C addresses (192.168.X.X).

Following the steps above we managed to TCP/IP connectivity (telnet, ftp...) between W2k and Linux using IrNET - we have not tried to play with routing and see if we can do an infrared bridge, for instance.

I'm not very interested in W2k, and I'm sure that somebody with more knowledge of PPP and W2k will figure if there is a trick that will allow the reuse of already established addresses.


IrDA, e-Squirt and Wireless LANs - jt@hpl.hp.com
Created 10 May 00
Updated 10 August 01
    Project hosted and sponsored by :