Net::Libdnet (a wrapper module for libdnet API) is a prerequisite for other framework modules like Net::Packet and Net::Frame. The only version of Net::Libdnet available in PPM repository for Windows (MSWin32) is the very first and obsolete version 0.01. Because it is painful to install a newer Net::Libdnet (e.g. v0.98) via CPAN or manually under Windows (too many error messages), one has to rely on the obsolete Net::Libdnet 0.01.

Net::Libdnet 0.01 does properly work under WinXP, but does NOT work under Win7.

With a following sample code, the config structures of the installed network interfaces can be normally accessed under WinXP:

use warnings; use strict; use Data::Dumper; use Net::Libdnet; my $addr; # IP address my $interf_ref; # hash reference to the NIC interface structure my %interf_hash; # hash with the interface structure referenced as +$interf_ref $addr = '10.100.20.1'; # gateway IP addr $interf_ref = Net::Libdnet::intf_get_dst($addr); # Net::Libdnet: +:intf_get_dst() -- retrieves the configuration for the best interface + with which to reach the specified destination IP address print Data::Dumper->Dump([\$interf_ref], [qw(interface)]); $addr = '10.100.20.69'; # my IP addr $interf_ref = Net::Libdnet::intf_get_src($addr); # Net::Libdnet: +:intf_get_src() -- retrieves the configuration for the interface with + the specified source IP address. print Data::Dumper->Dump([\$interf_ref], [qw(interface)]); $interf_ref = Net::Libdnet::intf_get('eth0'); # Net::Libdnet::in +tf_get() -- retrieves an interface configuration entry, keyed on name %interf_hash = %{$interf_ref}; print Data::Dumper->Dump([\%interf_hash], [qw(interface_eth0)]); print "Key value: ", $interf_hash{'mtu'}, "\n"; print "Key value: ", ${$interf_ref}{'link_addr'}, "\n"; $interf_ref = Net::Libdnet::intf_get('eth1'); print Data::Dumper->Dump([\$interf_ref], [qw(interface_eth1)]); $interf_ref = Net::Libdnet::intf_get('eth2'); print Data::Dumper->Dump([\$interf_ref], [qw(interface_eth2)]); system('pause'); exit(0);

A similar snippet code does not work (crashes) under Win7.

After installation of the Bundle::Net::Frame 1.02 and Net::Libdnet 0.01 via PPM, I always get following critical error messages from Net::Frame::Device under Win7:

Net::Frame::Device: updateFromDefault: unable to get dnet - or - Net::Frame::Device: updateFromDev: unable to get dnet - or - Net::Frame::Device: updateFromTarget: unable to get dnet

It is the issue with the module Net::Libdnet 0.01 which function intf_get() is called from _getDevWin32() in Net::Frame::Device (the error messages are shown above). intf_get() does not work as expected for ethernet interfaces under Windows 7.

The situation is as follows:

1. Net::Libdnet 0.01 works under WinXP, but does NOT work under Win7.

2. WinXP is not supported any more by Microsoft. But for a newer Windows OS like Win7, there is no real support, bugfixes, or maintenance of Net::Libdnet for current Windows platforms (Win 7/8/10).

3. Under Win7, I could not manage to install Net::Libdnet 0.98 via CPAN (Cygwin+MinGW) or manually - too many error messages as shown below.

cpan> install Net::Libdnet Net-Libdnet-0.98/ ... Configuring G/GO/GOMOR/Net-Libdnet-0.98.tar.gz with Makefile.PL Note (probably harmless): No library found for -ldnet ... Libdnet.xs:37:18: dnet.h: No such file or directory In file included from Libdnet.xs:77: c/intf_entry.c: In function `intf_c2sv': c/intf_entry.c:38: error: dereferencing pointer to incomplete type c/intf_entry.c:39: error: dereferencing pointer to incomplete type c/intf_entry.c:40: error: dereferencing pointer to incomplete type c/intf_entry.c:41: error: dereferencing pointer to incomplete type c/intf_entry.c:42: error: dereferencing pointer to incomplete type c/intf_entry.c:44: error: dereferencing pointer to incomplete type ... dmake.exe: Error code 129, while making 'Libdnet.o' GOMOR/Net-Libdnet-0.98.tar.gz C:\ACTIVE~1\site\bin\dmake.exe -- NOT OK Failed during this command: GOMOR/Net-Libdnet-0.98.tar.gz : make NO

Questions:

- How to get Net::Libdnet working under Win7?

- Can I encourage somebody to write a working and maintainable Net::Libdnet clone for current Windows platforms (Win 7/8/10)?

- Are there other options to get Net::Packet and Net::Frame working under Windows 7?


In reply to Net::Libdnet 0.01 does not work under Window 7 by perlusr193

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.