Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Net::RawIP - invalid checksum ?

by VinsWorldcom (Prior)
on Dec 07, 2013 at 02:04 UTC ( [id://1066094]=note: print w/replies, xml ) Need Help??


in reply to Net::RawIP - invalid checksum ?

Not sure what you're trying to do - other than create custom UDP packets. If that's the only requirement, you can try the Perl Packet Crafter. It's a shell similar to 'scapy' but this is the Perl version based on the Net::Frame modules.

Find it here:

Script: http://www.vinsworld.com/software/ppc.zip
Perldoc: http://www.vinsworld.com/software/ppc.html

You'll need to get Net::Pcap running if you don't already have it going. Once all prereq's are installed, it's as easy as:

VinsWorldcom@C:\Users\VinsWorldcom\tmp\ppc> ppc -i "Wireless Network C +onnection" Welcome to Perl Packet Crafter (PPC) Copyright (C) Michael Vincent 2012 Wireless Network Connection ppc> sendp packet ETHER,IPv4(src=>'192.168.10.10',dst=>'192.168.10.20' +,protocol=>NF_IPv4_PROTOCOL_UDP),UDP(src=>6544,dst=>514,payload=>'tes +t123'); . Sent 1 packet ppc>

And tcpdump verfies:

VinsWorldcom@C:\Users\VinsWorldcom> tcpdump -i4 -nevvXX udp port 514 tcpdump: listening on \Device\NPF_{731EA781-5FB3-4C71-944A-D70C7EE18AA +7} 21:00:28.058467 c0:cb:38:08:46:76 > 58:6d:8f:78:ad:40, ethertype IPv4 +(0x0800), length 49: (tos 0x0, ttl 128, id 56403, offset 0, flags [none], proto: + UDP (17), length: 35) 192.168.10.10.6544 > 192.168.10.20.514: [udp sum ok] [|sy +slog] 0x0000: 586d 8f78 ad40 c0cb 3808 4676 0800 4500 Xm.x.@..8.Fv +..E. 0x0010: 0023 dc53 0000 8011 c907 c0a8 0a0a c0a8 .#.S........ +.... 0x0020: 0a14 1990 0202 000f 02c3 7465 7374 3132 ..........te +st12 0x0030: 33 3 1 packets captured 28 packets received by filter 0 packets dropped by kernel

And note if you're actually trying to send Syslog, there is a Net::Frame::Layer::Syslog module for that.

Replies are listed 'Best First'.
Re^2: Net::RawIP - invalid checksum ?
by willambender (Initiate) on Dec 07, 2013 at 02:28 UTC

    Cool. Thanks for the info, i'll look into those. Yeah, what im working on is forwarding/creating syslog messages for a project. I have working code in C and wanted to port it over to perl as well. I started looking at using perl Socket but was sidetracked to Net::RawIP when i read it calculated the checksums for ya. Thou, it's looking like that this is not the case?
    - Will

      If you're looking to send Syslog, you don't need to craft custom UDP packets. You can use IO::Socket to create TCP and UDP packets without worrying about checksum calculation - it's done for you by the OS IP/socket stack.

      For Syslog specifically, just use Net::Syslog. You don't even need to worry about sockets with that - it's done behind the scenes.

      If you need to listen to / receive Syslog messages, have a look at Net::Syslogd.

Log In?
Username:
Password:

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

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

    No recent polls found