[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Misfeature (or bug) when generating packetheaders



Hi!

I have found a misfeature (and/or a bug) in the way that packetheaders and their offsets are created.

Consider the case where you have added a packetheader by subclassing PacketHeader e.g. (in C++)

BluetoothPacketHeaderClass(): PacketHeaderClass("PacketHeader/Mac/Bluetooth", sizeof(bt_hdr)){}

To use the packet header we add in ~ns/tcl/lib/nspacket.tcl:

{Mac/Bluetooth, off_bt_}

BUT no packetheader will be created due to how the code 
in 'Simulator instproc create_packetformat' works (also located in ~ns/tcl/lib/nspacket.tcl).

The problem is the line:
set off [$pm allochdr [lindex [split $cl  /] 1]]

I assume that the purpose of split is to remove "PacketHeader" from "PacketHeader/Mac/Bluetooth" and 
get the rest of the name.
If the name of the packetheader contains just one '/', the code above will work but if it contains more /'s, it will not.
no packetheader for "Mac/Bluetooth" will be created, just for "Mac" (if enabled by {Mac off_mac_}).

So if you want to use names for packetheaders with multiple /'s in it, this code must be fixed (I have no fix since I'm not that good at TCL)

Best regards, Henrik Eriksson
Ericsson Research