Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^5: Net::RawIP question

by anonymized user 468275 (Curate)
on Aug 16, 2018 at 19:18 UTC ( [id://1220457]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Net::RawIP question
in thread Net::RawIP question

I understand your frustration and I am thankful I didn't write this module, "there but for the grace of god go I", but you have to repeat the parameter
ip => { saddr => '192.168.1.1', daddr => '192.168.1.2', }
yet again for the ethset call as counter-intuitive as it might be.

One world, one people

Replies are listed 'Best First'.
Re^6: Net::RawIP question
by mark200 (Novice) on Aug 16, 2018 at 19:58 UTC
    I did not understand what you mean, it's hard for me to understand this lanuguage please speak simple english. if you can give example this will be helpful. thanks for helping.
      According to my understanding of the docs, you have to add a parameter to this:
      $n->ethset(source => 'my.target.lan', dest =>'my.target.lan');
      so that it has also
      $n->ethset(source => 'my.target.lan', dest =>'my.target.lan', ip => hash);
      where ip => hash is exactly what you put for the call to Net::RawIP->new;

      One world, one people

        Can you give full example? i don't understand what you mean by what i put in call of net:rawip from the module source:

        sub ethset { my ($self, %hash) = @_; map { $self->{ethhdr}->$_($hash{$_}) } keys %hash; my $source = $self->{ethhdr}->source; my $dest = $self->{ethhdr}->dest; if ($source =~ /^(\w\w):(\w\w):(\w\w):(\w\w):(\w\w):(\w\w)$/) { $self->{ethhdr}->source( pack("C6",hex($1),hex($2),hex($3),hex($4),hex($5),hex($6)) ); $source = $self->{ethhdr}->source; } if ($dest =~ /^(\w\w):(\w\w):(\w\w):(\w\w):(\w\w):(\w\w)$/) { $self->{ethhdr}->dest( pack("C6", hex($1),hex($2),hex($3),hex($4),hex($5),hex($6) +) ); $dest = $self->{ethhdr}->dest; } # host_to_ip returns IP address of target in host byteorder format $self->{ethhdr}->source(mac(host_to_ip($source))) unless($source =~ /[^A-Za-z0-9\-.]/ && length($source) == 6); $self->{ethhdr}->dest(mac(host_to_ip($dest))) unless($dest =~ /[^A-Za-z0-9\-.]/ && length($dest) == 6); my $ipproto = pack ("n1",0x0800); $self->{ethpack}=$self->{ethhdr}->dest.$self->{ethhdr}->source.$ip +proto; }

        which you mean? i think it take two parameters the source and dest: 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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1220457]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-24 05:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found