Net-DHCPv6

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    - [FIX] Replace die with croak, add explicit imports (RequireCarping, ProhibitCallsToUndeclaredSubs)
    - [FIX] Replace non-ASCII characters in comments (RequireASCII)
    - [FIX] Variable reuse, name reuse, and sub name homonyms

0.002    2026-06-01
    - [CHANGE] Option 31 renamed from NtpServer to SntpServers
    - [CHANGE] `use strictures 2` moved before `package` in all modules
    - [ADD] Option 56 NTP Server module (Net::DHCPv6::Option::NtpServer)
    - [ADD] Recursion depth guard for compression-pointer label decoding
    - [ADD] GitHub Actions CI workflow (Perl 5.36, 5.42)
    - [ADD] Test coverage for DUID::length, type(), msg_type_name(), relay truncation, streaming DUID types
    - [FIX] PdExclude prefix-length=0 edge case per RFC 6603
    - [FIX] _resolve_ipv6 false positive on wire-format addresses
    - [FIX] Circular compile-time dependency Option -> OptionList -> Generic -> Option
    - [FIX] Test success assertions in PCAP decode tests (failures no longer silently skipped)
    - [FIX] Remove redundant as_bytes() overrides from immutable Option modules
    - [INFRA] Pin Test2::V1 to 1.302217
    - [INFRA] Enable Test::Perl::Critic in dist.ini
    - [INFRA] Perl::Critic compliance sweep: zero violations across lib/

MANIFEST  view on Meta::CPAN

lib/Net/DHCPv6/X/BadMessage.pm
lib/Net/DHCPv6/X/BadOption.pm
lib/Net/DHCPv6/X/Internal.pm
lib/Net/DHCPv6/X/Truncated.pm
t/00-compile.t
t/001-constants.t
t/002-duid.t
t/003-option.t
t/004-packet.t
t/005-decoder.t
t/006-streaming.t
t/007-new-options.t
t/008-warnings.t
t/009-helpers.t
t/010-from_bytes.t
t/030-constants-coverage.t
t/100-pcap-wireshark.t
t/101-pcap-ztp.t
t/102-pcap-ia-pd.t
t/103-pcap-ntp-server.t
t/104-pcap-aftr-name.t

lib/Net/DHCPv6.pm  view on Meta::CPAN

    if ( !defined $bytes || CORE::length( $bytes ) < $MIN_LEN ) {
        $error = 'No data provided';
    }
    else {
        eval { $packet = Net::DHCPv6::Packet->from_bytes( $bytes ); 1 }
            or $error = $@;
    }
    return ( $packet, $error );
}

# DUID streaming helpers
sub decode_duid_with_error {
    my ( $class, $bytes ) = @_;
    return Net::DHCPv6::DUID->try_from_bytes( $bytes );
}

sub decode_duid_or_null {
    my ( $class, $bytes ) = @_;
    my ( $duid ) = Net::DHCPv6::DUID->try_from_bytes( $bytes );
    return $duid;
}

sub decode_duid_or_croak {
    my ( $class, $bytes ) = @_;
    my ( $duid,  $error ) = Net::DHCPv6::DUID->try_from_bytes( $bytes );
    croak $error if $error;
    return $duid;
}

# Option-list streaming helpers
sub decode_options_with_error {
    my ( $class, $bytes ) = @_;
    return Net::DHCPv6::OptionList->try_from_bytes( $bytes );
}

sub decode_options_or_null {
    my ( $class, $bytes ) = @_;
    my ( $ol ) = Net::DHCPv6::OptionList->try_from_bytes( $bytes );
    return $ol;
}

t/006-streaming.t  view on Meta::CPAN


use lib 't/lib';
use lib 'lib';

use Net::DHCPv6            ();
use Net::DHCPv6::Constants qw( $DUID_EN $DUID_LLT $DUID_UUID $LINK_TYPE_ETHERNET );
my $EMPTY = q();

my $mac = pack( 'H*', '001122334455' );

# --- DUID streaming helpers ----------------------------------------

# decode_duid_with_error -- full DUID-LLT
my ( $duid, $err ) =
    Net::DHCPv6->decode_duid_with_error( pack( 'n n N a*', $DUID_LLT, $LINK_TYPE_ETHERNET, 123_456, $mac ) );
ok( defined $duid, 'decode_duid_with_error full DUID-LLT returns duid' );
ok( !defined $err, 'decode_duid_with_error full DUID-LLT no error' );
is( $duid->duid_type,       $DUID_LLT,           'full DUID-LLT type' );
is( $duid->link_layer_type, $LINK_TYPE_ETHERNET, 'full DUID-LLT hwtype' );
is( $duid->time,            123_456,             'full DUID-LLT time' );
is( $duid->identifier,      $mac,                'full DUID-LLT identifier' );

t/006-streaming.t  view on Meta::CPAN

$duid = Net::DHCPv6->decode_duid_or_croak( pack( 'n n N a*', $DUID_LLT, $LINK_TYPE_ETHERNET, 123_456, $mac ) );
ok( defined $duid, 'decode_duid_or_croak full returns duid' );

# decode_duid_or_croak -- partial (croaks)
ok( dies { Net::DHCPv6->decode_duid_or_croak( pack( 'n n', $DUID_LLT, $LINK_TYPE_ETHERNET ) ) },
    'decode_duid_or_croak partial croaks' );

# decode_duid_or_croak -- empty (croaks)
ok( dies { Net::DHCPv6->decode_duid_or_croak( $EMPTY ) }, 'decode_duid_or_croak empty croaks' );

# --- Options streaming helpers -------------------------------------

# Build a known good options byte string
my $cid        = Net::DHCPv6::Option::ClientId->new( duid => Net::DHCPv6::DUID->new_llt( 1, 123_456, $mac ) );
my $sid        = Net::DHCPv6::Option::ServerId->new( duid => Net::DHCPv6::DUID->new_llt( 1, 123_456, $mac ) );
my $opts_bytes = $cid->as_bytes . $sid->as_bytes;

# decode_options_with_error -- full
my $ol;
( $ol, $err ) = Net::DHCPv6->decode_options_with_error( $opts_bytes );
ok( defined $ol,   'decode_options_with_error full returns OptionList' );

t/author-eol.t  view on Meta::CPAN

    'lib/Net/DHCPv6/Option/SubscriberId.pm',        'lib/Net/DHCPv6/Option/Unicast.pm',
    'lib/Net/DHCPv6/Option/UserClass.pm',           'lib/Net/DHCPv6/Option/VendorClass.pm',
    'lib/Net/DHCPv6/Option/VendorOpts.pm',          'lib/Net/DHCPv6/OptionList.pm',
    'lib/Net/DHCPv6/Packet.pm',                     'lib/Net/DHCPv6/Packet/Relay.pm',
    'lib/Net/DHCPv6/X.pm',                          'lib/Net/DHCPv6/X/BadDUID.pm',
    'lib/Net/DHCPv6/X/BadMessage.pm',               'lib/Net/DHCPv6/X/BadOption.pm',
    'lib/Net/DHCPv6/X/Internal.pm',                 'lib/Net/DHCPv6/X/Truncated.pm',
    't/00-compile.t',                               't/001-constants.t',
    't/002-duid.t',                                 't/003-option.t',
    't/004-packet.t',                               't/005-decoder.t',
    't/006-streaming.t',                            't/007-new-options.t',
    't/008-warnings.t',                             't/009-helpers.t',
    't/010-from_bytes.t',                           't/030-constants-coverage.t',
    't/100-pcap-wireshark.t',                       't/101-pcap-ztp.t',
    't/102-pcap-ia-pd.t',                           't/103-pcap-ntp-server.t',
    't/104-pcap-aftr-name.t',                       't/105-pcap-ia-ta.t',
    't/106-pcap-mud.t',                             't/107-pcap-sip-server-d.t',
    't/author-clean-namespaces.t',                  't/author-critic.t',
    't/author-distmeta.t',                          't/author-eof.t',
    't/author-eol.t',                               't/author-no-breakpoints.t',
    't/author-no-tabs.t',                           't/author-pod-coverage.t',

t/author-no-tabs.t  view on Meta::CPAN

    'lib/Net/DHCPv6/Option/SubscriberId.pm',        'lib/Net/DHCPv6/Option/Unicast.pm',
    'lib/Net/DHCPv6/Option/UserClass.pm',           'lib/Net/DHCPv6/Option/VendorClass.pm',
    'lib/Net/DHCPv6/Option/VendorOpts.pm',          'lib/Net/DHCPv6/OptionList.pm',
    'lib/Net/DHCPv6/Packet.pm',                     'lib/Net/DHCPv6/Packet/Relay.pm',
    'lib/Net/DHCPv6/X.pm',                          'lib/Net/DHCPv6/X/BadDUID.pm',
    'lib/Net/DHCPv6/X/BadMessage.pm',               'lib/Net/DHCPv6/X/BadOption.pm',
    'lib/Net/DHCPv6/X/Internal.pm',                 'lib/Net/DHCPv6/X/Truncated.pm',
    't/00-compile.t',                               't/001-constants.t',
    't/002-duid.t',                                 't/003-option.t',
    't/004-packet.t',                               't/005-decoder.t',
    't/006-streaming.t',                            't/007-new-options.t',
    't/008-warnings.t',                             't/009-helpers.t',
    't/010-from_bytes.t',                           't/030-constants-coverage.t',
    't/100-pcap-wireshark.t',                       't/101-pcap-ztp.t',
    't/102-pcap-ia-pd.t',                           't/103-pcap-ntp-server.t',
    't/104-pcap-aftr-name.t',                       't/105-pcap-ia-ta.t',
    't/106-pcap-mud.t',                             't/107-pcap-sip-server-d.t',
    't/author-clean-namespaces.t',                  't/author-critic.t',
    't/author-distmeta.t',                          't/author-eof.t',
    't/author-eol.t',                               't/author-no-breakpoints.t',
    't/author-no-tabs.t',                           't/author-pod-coverage.t',



( run in 1.738 second using v1.01-cache-2.11-cpan-140bd7fdf52 )