Hi Simon

Simon Kelley <si...@thekelleys.org.uk> writes:

> On 05/12/17 15:00, Gaudenz Steinlin wrote:
>> 
>> Hi
>> 
>> Sorry for the incomplete bug report. I wanted to resume a reported I did
>> not finish with reportbug, but it decided to send the backup copy as is
>> instead of letting me edit it before sending.
>> 
>> Looking at the code the wrong error code results from the return code of
>> the parse_packet function which is passed through via
>> send_release_packet to main and used as exit code there. Returning -1
>> from main results in an exit code of 255 in the shell.
>> 
>> Gaudenz
>> 
>
>
> Are  sure that this isn't a real error? From a quick look, successfully
> doing the release results in a reply with a STATUS_CODE structure
> containing a SUCCESS status value, which is zero. This is returned via
> parse_packet and send_release_packet to main, and results in a zero
> return code. A -1 return from parse_packet implies no STATUS_CODE or
> IA_NA in the reply, which is an error.

I had another look now and took a tcpdump capture. The successfull reply
does not has STATUS_CODE SUCCES, but no IA_NA option set. Which in turn
gives a return -1. But looking at RFC3315 18.2.6 this is the correct
behaviour. If the release is successful, no IA_NA option should be sent.
IA_NA options should only be sent for those addresses where no binding
was found on the server.

Looking at the packet capture I also saw that always two release
requests are sent. This is because the code does not wait at all after
sending the packet and immediately calls recvfrom. In the next iteration
it then first sends the release packet again before processing the
answer of the previous releas packet. This is not really a problem, but
it looked a bit odd in the capture.

See below for the full content of the 4 packets in question. You can
also see that the reply to the second release packet contains an IA_NA
option with NoBinding. This is correct as the binding is already
released by the first packet. But this packet is no longer processed by
dhcp_release6 as it already exited after the first reply.

BTW the DHCP server used is dnsmasq 2.68.

Gaudenz

Frame 263: 146 bytes on wire (1168 bits), 146 bytes captured (1168 bits)
Ethernet II, Src: fa:16:3e:15:e3:67 (fa:16:3e:15:e3:67), Dst: 
IPv6mcast_01:00:02 (33:33:00:01:00:02)
Internet Protocol Version 6, Src: fe80::f816:3eff:fe15:e367, Dst: ff02::1:2
    0110 .... = Version: 6
    .... 0000 0000 .... .... .... .... .... = Traffic Class: 0x00 (DSCP: CS0, 
ECN: Not-ECT)
        .... 0000 00.. .... .... .... .... .... = Differentiated Services 
Codepoint: Default (0)
        .... .... ..00 .... .... .... .... .... = Explicit Congestion 
Notification: Not ECN-Capable Transport (0)
    .... .... .... 0000 0000 0000 0000 0000 = Flow Label: 0x00000
    Payload Length: 92
    Next Header: UDP (17)
    Hop Limit: 1
    Source: fe80::f816:3eff:fe15:e367
    Destination: ff02::1:2
    [Source GeoIP: Unknown]
    [Destination GeoIP: Unknown]
User Datagram Protocol, Src Port: 546, Dst Port: 547
    Source Port: 546
    Destination Port: 547
    Length: 92
    Checksum: 0x578c [unverified]
    [Checksum Status: Unverified]
    [Stream index: 2]
DHCPv6
    Message type: Release (8)
    Transaction ID: 0x000000
    Client Identifier
        Option: Client Identifier (1)
        Length: 14
        Value: 0001000121ba76befa163e9a7c26
        DUID: 0001000121ba76befa163e9a7c26
        DUID Type: link-layer address plus time (1)
        Hardware type: Ethernet (1)
        DUID Time: Dec  6, 2017 10:37:02.000000000 CET
        Link-layer address: fa:16:3e:9a:7c:26
    Server Identifier
        Option: Server Identifier (2)
        Length: 14
        Value: 0001000121b965c5fa163e23f3e0
        DUID: 0001000121b965c5fa163e23f3e0
        DUID Type: link-layer address plus time (1)
        Hardware type: Ethernet (1)
        DUID Time: Dec  5, 2017 15:12:21.000000000 CET
        Link-layer address: fa:16:3e:23:f3:e0
    Identity Association for Non-temporary Address
        Option: Identity Association for Non-temporary Address (3)
        Length: 40
        Value: 3e9a7c260000000000000000000500182a060c0100011902...
        IAID: 3e9a7c26
        T1: 0
        T2: 0
        IA Address
            Option: IA Address (5)
            Length: 24
            Value: 2a060c0100011902000000007a1200180000000000000000
            IPv6 address: 2a06:c01:1:1902::7a12:18
            Preferred lifetime: 0
            Valid lifetime: 0

Frame 264: 124 bytes on wire (992 bits), 124 bytes captured (992 bits)
Ethernet II, Src: fa:16:3e:23:f3:e0 (fa:16:3e:23:f3:e0), Dst: fa:16:3e:15:e3:67 
(fa:16:3e:15:e3:67)
Internet Protocol Version 6, Src: fe80::f816:3eff:fe23:f3e0, Dst: 
fe80::f816:3eff:fe15:e367
    0110 .... = Version: 6
    .... 1100 0000 .... .... .... .... .... = Traffic Class: 0xc0 (DSCP: CS6, 
ECN: Not-ECT)
        .... 1100 00.. .... .... .... .... .... = Differentiated Services 
Codepoint: Class Selector 6 (48)
        .... .... ..00 .... .... .... .... .... = Explicit Congestion 
Notification: Not ECN-Capable Transport (0)
    .... .... .... 0000 0000 0000 0000 0000 = Flow Label: 0x00000
    Payload Length: 70
    Next Header: UDP (17)
    Hop Limit: 64
    Source: fe80::f816:3eff:fe23:f3e0
    Destination: fe80::f816:3eff:fe15:e367
    [Source GeoIP: Unknown]
    [Destination GeoIP: Unknown]
User Datagram Protocol, Src Port: 547, Dst Port: 546
    Source Port: 547
    Destination Port: 546
    Length: 70
    Checksum: 0x6a3c [unverified]
    [Checksum Status: Unverified]
    [Stream index: 3]
DHCPv6
    Message type: Reply (7)
    Transaction ID: 0x000000
    Client Identifier
        Option: Client Identifier (1)
        Length: 14
        Value: 0001000121ba76befa163e9a7c26
        DUID: 0001000121ba76befa163e9a7c26
        DUID Type: link-layer address plus time (1)
        Hardware type: Ethernet (1)
        DUID Time: Dec  6, 2017 10:37:02.000000000 CET
        Link-layer address: fa:16:3e:9a:7c:26
    Server Identifier
        Option: Server Identifier (2)
        Length: 14
        Value: 0001000121b965c5fa163e23f3e0
        DUID: 0001000121b965c5fa163e23f3e0
        DUID Type: link-layer address plus time (1)
        Hardware type: Ethernet (1)
        DUID Time: Dec  5, 2017 15:12:21.000000000 CET
        Link-layer address: fa:16:3e:23:f3:e0
    Status code
        Option: Status code (13)
        Length: 18
        Value: 000072656c65617365207265636569766564
        Status Code: Success (0)
        Status Message: release received

Frame 301: 146 bytes on wire (1168 bits), 146 bytes captured (1168 bits)
Ethernet II, Src: fa:16:3e:15:e3:67 (fa:16:3e:15:e3:67), Dst: 
IPv6mcast_01:00:02 (33:33:00:01:00:02)
Internet Protocol Version 6, Src: fe80::f816:3eff:fe15:e367, Dst: ff02::1:2
    0110 .... = Version: 6
    .... 0000 0000 .... .... .... .... .... = Traffic Class: 0x00 (DSCP: CS0, 
ECN: Not-ECT)
        .... 0000 00.. .... .... .... .... .... = Differentiated Services 
Codepoint: Default (0)
        .... .... ..00 .... .... .... .... .... = Explicit Congestion 
Notification: Not ECN-Capable Transport (0)
    .... .... .... 0000 0000 0000 0000 0000 = Flow Label: 0x00000
    Payload Length: 92
    Next Header: UDP (17)
    Hop Limit: 1
    Source: fe80::f816:3eff:fe15:e367
    Destination: ff02::1:2
    [Source GeoIP: Unknown]
    [Destination GeoIP: Unknown]
User Datagram Protocol, Src Port: 546, Dst Port: 547
    Source Port: 546
    Destination Port: 547
    Length: 92
    Checksum: 0x578c [unverified]
    [Checksum Status: Unverified]
    [Stream index: 2]
DHCPv6
    Message type: Release (8)
    Transaction ID: 0x000000
    Client Identifier
        Option: Client Identifier (1)
        Length: 14
        Value: 0001000121ba76befa163e9a7c26
        DUID: 0001000121ba76befa163e9a7c26
        DUID Type: link-layer address plus time (1)
        Hardware type: Ethernet (1)
        DUID Time: Dec  6, 2017 10:37:02.000000000 CET
        Link-layer address: fa:16:3e:9a:7c:26
    Server Identifier
        Option: Server Identifier (2)
        Length: 14
        Value: 0001000121b965c5fa163e23f3e0
        DUID: 0001000121b965c5fa163e23f3e0
        DUID Type: link-layer address plus time (1)
        Hardware type: Ethernet (1)
        DUID Time: Dec  5, 2017 15:12:21.000000000 CET
        Link-layer address: fa:16:3e:23:f3:e0
    Identity Association for Non-temporary Address
        Option: Identity Association for Non-temporary Address (3)
        Length: 40
        Value: 3e9a7c260000000000000000000500182a060c0100011902...
        IAID: 3e9a7c26
        T1: 0
        T2: 0
        IA Address
            Option: IA Address (5)
            Length: 24
            Value: 2a060c0100011902000000007a1200180000000000000000
            IPv6 address: 2a06:c01:1:1902::7a12:18
            Preferred lifetime: 0
            Valid lifetime: 0

Frame 302: 190 bytes on wire (1520 bits), 190 bytes captured (1520 bits)
Ethernet II, Src: fa:16:3e:23:f3:e0 (fa:16:3e:23:f3:e0), Dst: fa:16:3e:15:e3:67 
(fa:16:3e:15:e3:67)
Internet Protocol Version 6, Src: fe80::f816:3eff:fe23:f3e0, Dst: 
fe80::f816:3eff:fe15:e367
    0110 .... = Version: 6
    .... 1100 0000 .... .... .... .... .... = Traffic Class: 0xc0 (DSCP: CS6, 
ECN: Not-ECT)
        .... 1100 00.. .... .... .... .... .... = Differentiated Services 
Codepoint: Class Selector 6 (48)
        .... .... ..00 .... .... .... .... .... = Explicit Congestion 
Notification: Not ECN-Capable Transport (0)
    .... .... .... 0000 0000 0000 0000 0000 = Flow Label: 0x00000
    Payload Length: 136
    Next Header: UDP (17)
    Hop Limit: 64
    Source: fe80::f816:3eff:fe23:f3e0
    Destination: fe80::f816:3eff:fe15:e367
    [Source GeoIP: Unknown]
    [Destination GeoIP: Unknown]
User Datagram Protocol, Src Port: 547, Dst Port: 546
    Source Port: 547
    Destination Port: 546
    Length: 136
    Checksum: 0x1bf2 [unverified]
    [Checksum Status: Unverified]
    [Stream index: 3]
DHCPv6
    Message type: Reply (7)
    Transaction ID: 0x000000
    Client Identifier
        Option: Client Identifier (1)
        Length: 14
        Value: 0001000121ba76befa163e9a7c26
        DUID: 0001000121ba76befa163e9a7c26
        DUID Type: link-layer address plus time (1)
        Hardware type: Ethernet (1)
        DUID Time: Dec  6, 2017 10:37:02.000000000 CET
        Link-layer address: fa:16:3e:9a:7c:26
    Server Identifier
        Option: Server Identifier (2)
        Length: 14
        Value: 0001000121b965c5fa163e23f3e0
        DUID: 0001000121b965c5fa163e23f3e0
        DUID Type: link-layer address plus time (1)
        Hardware type: Ethernet (1)
        DUID Time: Dec  5, 2017 15:12:21.000000000 CET
        Link-layer address: fa:16:3e:23:f3:e0
    Identity Association for Non-temporary Address
        Option: Identity Association for Non-temporary Address (3)
        Length: 62
        Value: 3e9a7c260000000000000000000500182a060c0100011902...
        IAID: 3e9a7c26
        T1: 0
        T2: 0
        IA Address
            Option: IA Address (5)
            Length: 24
            Value: 2a060c0100011902000000007a1200180000000000000000
            IPv6 address: 2a06:c01:1:1902::7a12:18
            Preferred lifetime: 0
            Valid lifetime: 0
        Status code
            Option: Status code (13)
            Length: 18
            Value: 00036e6f2062696e64696e6720666f756e64
            Status Code: NoBinding (3)
            Status Message: no binding found
    Status code
        Option: Status code (13)
        Length: 18
        Value: 000072656c65617365207265636569766564
        Status Code: Success (0)
        Status Message: release received

>
> Cheers,
>
> Simon.
>
>
-- 
PGP: 836E 4F81 EFBB ADA7 0852 79BF A97A 7702 BAF9 1EF5

Attachment: signature.asc
Description: PGP signature

Reply via email to