Opened 3 weeks ago

Last modified 3 weeks ago

#19296 new bug

Review IPv6 IsEmpty parsing of BNetworkAddress — at Version 1

Reported by: kallisti5 Owned by: axeld
Priority: normal Milestone: Unscheduled
Component: Network & Internet/IPv6 Version: R1/beta5
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description (last modified by kallisti5)

While the BNetworkAddress object properly detects an empty IPv4 address. (0.0.0.0 .IsEmpty() == true), it appears BNetworkAddress may not properly detect an empty IPv6 address.

Test Code:

// g++ test.cpp  -lnetwork -lbe -lroot -lbnetapi

#include <stdio.h>
#include <NetworkAddress.h>

int
main()
{   
    BNetworkAddress address;
    address.SetTo(AF_INET6, "::");
    printf(":: Address Is Empty: %s\n", address.IsEmpty() ? "true" : "false");
    address.SetTo(AF_INET6, "dead::beef");
    printf("dead::beef Address Is Empty: %s\n", address.IsEmpty() ? "true" : "false");
    
    address.SetTo(AF_INET, "0.0.0.0");
    printf("0.0.0.0 Address Is Empty: %s\n", address.IsEmpty() ? "true" : "false");
    address.SetTo(AF_INET, "10.0.0.0");
    printf("10.0.0.0 Address Is Empty: %s\n", address.IsEmpty() ? "true" : "false");

    return 0;
}
 ./a.out 
:: Address Is Empty: true
dead::beef Address Is Empty: true
0.0.0.0 Address Is Empty: true
10.0.0.0 Address Is Empty: false

:: should be Empty. dead::beef should not be.

Change History (1)

comment:1 by kallisti5, 3 weeks ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.