Ethereal-dev: [Ethereal-dev] HMIPv6 Lifetime issue on Linux i386

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Greg Daley <greg.daley@xxxxxxxxxxxxxxxxx>
Date: Mon, 22 Oct 2001 17:14:50 +1000
	Hi, 

	In the header file this is being shown as a uint32 (as defined in 
	the HMIP6 draft)  but in the packet-icmpv6.c file, it is being treated
	as a short by using pntohs.

	On my 32 bit platform this is a 16 bit integer (albeit unsigned).
	would it be appropriate to change the pntohs to a pntohl?

	Would this break other platforms?

		Greg Daley


[gdaley@host ethereal]$ grep map_lifetime *.h
packet-ipv6.h:  guint32                 nd_opt_map_lifetime;

[gdaley@host ethereal]$ grep map_lifetime *.c
packet-icmpv6.c:            offset + offsetof(struct nd_opt_map_info,
nd_opt_map_lifetime),
packet-icmpv6.c:            4, "Lifetime: %d",
pntohs(&map->nd_opt_map_lifetime));
[gdaley@host ethereal]$


---------------------------------------------------
Patch : converet pntohs to pntohl

[gdaley@host ethereal-0.8.20.cvs]$ cvs diff ethereal 2> /dev/null |
./ethereal/tools/cvsdiff-fix.py
Index: ethereal/packet-icmpv6.c
===================================================================
RCS file: /cvsroot/ethereal/packet-icmpv6.c,v
retrieving revision 1.53
diff -u -r1.53 ethereal/packet-icmpv6.c
--- ethereal/packet-icmpv6.c    2001/10/01 08:29:34     1.53
+++ ethereal/packet-icmpv6.c    2001/10/22 07:07:50
@@ -380,7 +380,7 @@
                ND_OPT_MAP_FLAG_P, 8, "P", ""));
        proto_tree_add_text(icmp6opt_tree, tvb,
            offset + offsetof(struct nd_opt_map_info,
nd_opt_map_lifetime),
-           4, "Lifetime: %d", pntohs(&map->nd_opt_map_lifetime));
+           4, "Lifetime: %d", pntohl(&map->nd_opt_map_lifetime));
 
        proto_tree_add_text(icmp6opt_tree, tvb,
            offset + offsetof(struct nd_opt_map_info,
nd_opt_map_address), 16,
[gdaley@host ethereal-0.8.20.cvs]$

--------------------------------------------------------

	Output of my hacked radvdump:

Router advertisement from fe80::201:3ff:fe45:81fc (hoplimit 255)
        AdvCurHopLimit: 64
        AdvManagedFlag: off
        AdvOtherConfigFlag: off
        AdvHomeAgentFlag: on
        AdvReachableTime: 0
        AdvRetransTimer: 0
        Prefix 3ffe:8001:12:188:201:3ff:fe45:81fc/64
                AdvValidLifetime: 1200
                AdvPreferredLifetime: 1200
                AdvOnLink: on
                AdvAutonomous: on
                AdvRouterAddr: on
        AdvSourceLLAddress: 00 01 03 45 81 FC
        AdvIntervalOpt:
                AdvInterval: 2
        AdvHomeAgentInfo:
                HomeAgentPreference: 0
                HomeAgentLifetime: 400
        MAP 3ffe:8001:12:4188:201:3ff:fe45:81fc/64
                MapDistance: 1
                MapPreference: 128
                MapRcoaPrefix: on
                MapExtendedMode: off
                MapTopology: off
                MapPrivacy: off
                MapPacketSource: off
                MapValidLifetime: 2592000
        MAP 3ffe:8001:12:5188:201:3ff:fe45:81fc/64
                MapDistance: 2
                MapPreference: 100
                MapRcoaPrefix: on
                MapExtendedMode: off
                MapTopology: off
                MapPrivacy: on
                MapPacketSource: off
                MapValidLifetime: 1200


-----------------------------------------------
WITHOUT Patch applied (Current Ethereal)


Frame 1 (190 on wire, 190 captured)
    Arrival Time: Oct 22, 2001 17:09:54.113638000
    Time delta from previous packet: 0.000000000 seconds
    Time relative to first packet: 0.000000000 seconds
    Frame Number: 1
    Packet Length: 190 bytes
    Capture Length: 190 bytes
Ethernet II
    Destination: 33:33:00:00:00:01 (33:33:00:00:00:01)
    Source: 00:01:03:45:81:fc (00:01:03:45:81:fc)
    Type: IPv6 (0x86dd)
Internet Protocol Version 6
    Version: 6
    Traffic class: 0x00
    Flowlabel: 0x00000
    Payload length: 136
    Next header: ICMPv6 (0x3a)
    Hop limit: 255
    Source address: fe80::201:3ff:fe45:81fc (fe80::201:3ff:fe45:81fc)
    Destination address: ff02::1 (ff02::1)
Internet Control Message Protocol v6
    Type: 134 (Router advertisement)
    Code: 0
    Checksum: 0x2f93 (correct)
    Cur hop limit: 64
    Flags: 0x20
        0... .... = Not managed
        .0.. .... = Not other
        ..1. .... = Home Agent
        ...0 0... = Router preference: Medium
    Router lifetime: 200
    Reachable time: 0
    Retrans time: 0
    ICMPv6 options
        Type: 3 (Prefix information)
        Length: 32 bytes (4)
        Prefix length: 64
        Flags: 0xe0
            1... .... = Onlink
            .1.. .... = Auto
            ..1. .... = Router Address
            ...0 .... = Not site prefix
        Valid lifetime: 0x000004b0
        Preferred lifetime: 0x000004b0
        Prefix: 3ffe:8001:12:188:201:3ff:fe45:81fc
    ICMPv6 options
        Type: 1 (Source link-layer address)
        Length: 8 bytes (1)
        Link-layer address: 00:01:03:45:81:fc
    ICMPv6 options
        Type: 7 (Advertisement Interval)
        Length: 8 bytes (1)
        Advertisement Interval: 2000
    ICMPv6 options
        Type: 8 (Home Agent Information)
        Length: 8 bytes (1)
        Home Agent Preference: 0
        Home Agent Lifetime: 400
    ICMPv6 options
        Type: 201 (HMIPv6 MAP option)
        Length: 32 bytes (4)
        Distance: 1
        Preference: 128
        Prefix Length: 64
        Flags: 0x80
            1... .... = R
            .0.. .... =
            ..0. .... =
            ...0 .... =
            .... 0... =
        Lifetime: 39
        Address of MAP: 3ffe:8001:12:4188:201:3ff:fe45:81fc
(3ffe:8001:12:4188:201:3ff:fe45:81fc)
    ICMPv6 options
        Type: 201 (HMIPv6 MAP option)
        Length: 32 bytes (4)
        Distance: 2
        Preference: 100
        Prefix Length: 64
        Flags: 0xa0
            1... .... = R
            .0.. .... =
            ..1. .... = I
            ...0 .... =
            .... 0... =
        Lifetime: 0
        Address of MAP: 3ffe:8001:12:5188:201:3ff:fe45:81fc
(3ffe:8001:12:5188:201:3ff:fe45:81fc)




--------------------------------------------------
With patch applied:


Frame 7 (190 on wire, 190 captured)
    Arrival Time: Oct 22, 2001 17:03:10.253550000
    Time delta from previous packet: 0.942526000 seconds
    Time relative to first packet: 4.109927000 seconds
    Frame Number: 7
    Packet Length: 190 bytes
    Capture Length: 190 bytes
Ethernet II
    Destination: 33:33:00:00:00:01 (33:33:00:00:00:01)
    Source: 00:01:03:45:81:fc (00:01:03:45:81:fc)
    Type: IPv6 (0x86dd)
Internet Protocol Version 6
    Version: 6
    Traffic class: 0x00
    Flowlabel: 0x00000
    Payload length: 136
    Next header: ICMPv6 (0x3a)
    Hop limit: 255
    Source address: fe80::201:3ff:fe45:81fc (fe80::201:3ff:fe45:81fc)
    Destination address: ff02::1 (ff02::1)
Internet Control Message Protocol v6
    Type: 134 (Router advertisement)
    Code: 0
    Checksum: 0x2f93 (correct)
    Cur hop limit: 64
    Flags: 0x20
        0... .... = Not managed
        .0.. .... = Not other
        ..1. .... = Home Agent
        ...0 0... = Router preference: Medium
    Router lifetime: 200
    Reachable time: 0
    Retrans time: 0
    ICMPv6 options
        Type: 3 (Prefix information)
        Length: 32 bytes (4)
        Prefix length: 64
        Flags: 0xe0
            1... .... = Onlink
            .1.. .... = Auto
            ..1. .... = Router Address
            ...0 .... = Not site prefix
        Valid lifetime: 0x000004b0
        Preferred lifetime: 0x000004b0
        Prefix: 3ffe:8001:12:188:201:3ff:fe45:81fc
    ICMPv6 options
        Type: 1 (Source link-layer address)
        Length: 8 bytes (1)
        Link-layer address: 00:01:03:45:81:fc
    ICMPv6 options
        Type: 7 (Advertisement Interval)
        Length: 8 bytes (1)
        Advertisement Interval: 2000
    ICMPv6 options
        Type: 8 (Home Agent Information)
        Length: 8 bytes (1)
        Home Agent Preference: 0
        Home Agent Lifetime: 400
    ICMPv6 options
        Type: 201 (HMIPv6 MAP option)
        Length: 32 bytes (4)
        Distance: 1
        Preference: 128
        Prefix Length: 64
        Flags: 0x80
            1... .... = R
            .0.. .... =
            ..0. .... =
            ...0 .... =
            .... 0... =
        Lifetime: 2592000
        Address of MAP: 3ffe:8001:12:4188:201:3ff:fe45:81fc
(3ffe:8001:12:4188:201:3ff:fe45:81fc)
    ICMPv6 options
        Type: 201 (HMIPv6 MAP option)
        Length: 32 bytes (4)
        Distance: 2
        Preference: 100
        Prefix Length: 64
        Flags: 0xa0
            1... .... = R
            .0.. .... =
            ..1. .... = I
            ...0 .... =
            .... 0... =
        Lifetime: 1200
        Address of MAP: 3ffe:8001:12:5188:201:3ff:fe45:81fc
(3ffe:8001:12:5188:201:3ff:fe45:81fc)