in reply to Net::RawIP question

In the initialisation:
Net::RawIP->new({ ARGPROTO => {PROTOKEY => PROTOVALUE,...} ip => {IPKEY => IPVALUE,...}, });
the ip key should point to a hash of the header data. Probably NetPacket::IP will get you the data to assemble into the hash. I see the module promises to help you manipulate the header, but "manipulate" seems vague in the context of the module you refer to. Generally, NetPacket::TCP has what I would call a manipulation toolkit for your packets.

One world, one people

Replies are listed 'Best First'.
Re^2: Net::RawIP question
by mark200 (Novice) on Aug 16, 2018 at 13:09 UTC
    This:
    $n->send; $n->ethnew("eth0"); $n->ethset(source => 'my.target.lan', dest =>'my.target.lan'); $n->ethsend;
    the packet is first send then setting the ethernet header? how? can you explain me this?
      The documentation says:

      ethset

      is a method for set an ethernet parameters in the current object. The given parameters must look like parameters for the ethnew without a $device.

      So for your manipulation, it expects the new header to be given in the ethset call as ip => { header keys and values }

      update: you might also want to check whether your calls are returning a true value i.e.

      $n->methodname(parms) or die "Net::RawIP->methodname failed";

      One world, one people

        thanks for information, this debug helps but i always get error at: Net::RawIP->ethnew failed
        #!/usr/bin/perl use Net::RawIP; $n = Net::RawIP->new({ ip => { saddr => '192.168.1.1', daddr => '192.168.1.2', }, tcp => { source => 139, dest => 139, psh => 1, syn => 1, }, }); $n->send; $n->ethnew("eth0") or die "Net::RawIP->ethnew failed"; # error here $n->ethset(source => 'my.target.lan', dest =>'my.target.lan'); $n->ethsend;
Re^2: Net::RawIP question
by mark200 (Novice) on Aug 16, 2018 at 13:09 UTC
    This:
    $n->send; $n->ethnew("eth0"); $n->ethset(source => 'my.target.lan', dest =>'my.target.lan'); $n->ethsend;
    the packet is first send then setting the ethernet header? how? can you explain me this?