Perl Module for Sockets that can Mark DSCP

Perl Module for Sockets that can Mark DSCP

am 27.04.2006 01:11:03 von smchugh

Hey all,
I am new to modules as I have only used perl on Solaris to call external
executeables and write log files. I am really a Network Engineer that has
been saddled with running Openview on Solaris to manage VoIP.

What I want to do is create a client app and a server app that sends IP
traffic to each other but would allow me to pass in QoS/ToS values as well
as port numbers. This will be used for testing in my lab

Bassically I want to create traffic to go through a few hops and will be
able to test out Cisco routers and how they react to the packets that are
marked for queing and of course use perl to mark the packets.

TIA

Re: Perl Module for Sockets that can Mark DSCP

am 28.04.2006 01:57:20 von Jim Gibson

In article ,
Scooter\ wrote:

> Hey all,
> I am new to modules as I have only used perl on Solaris to call external
> executeables and write log files. I am really a Network Engineer that has
> been saddled with running Openview on Solaris to manage VoIP.
>
> What I want to do is create a client app and a server app that sends IP
> traffic to each other but would allow me to pass in QoS/ToS values as well
> as port numbers. This will be used for testing in my lab
>
> Bassically I want to create traffic to go through a few hops and will be
> able to test out Cisco routers and how they react to the packets that are
> marked for queing and of course use perl to mark the packets.

While perl has socket functions built-in, you should look into using
the IO::Socket module and its derivative IO::Socket::Inet. Also look at
the Perl documentation 'perldoc perlipc'.

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Re: Perl Module for Sockets that can Mark DSCP

am 30.04.2006 19:09:39 von nobull67

Jim Gibson wrote:
> In article ,
> Scooter\ wrote:
>
> > Hey all,
> > I am new to modules as I have only used perl on Solaris to call external
> > executeables and write log files. I am really a Network Engineer that has
> > been saddled with running Openview on Solaris to manage VoIP.
> >
> > What I want to do is create a client app and a server app that sends IP
> > traffic to each other but would allow me to pass in QoS/ToS values as well
> > as port numbers. This will be used for testing in my lab
> >
> > Bassically I want to create traffic to go through a few hops and will be
> > able to test out Cisco routers and how they react to the packets that are
> > marked for queing and of course use perl to mark the packets.
>
> While perl has socket functions built-in, you should look into using
> the IO::Socket module and its derivative IO::Socket::Inet.

That's way too high level.

You may be able to manipulate ToS with something like

setsockopt($socket, SOL_IP, IP_TOS, IPTOS_LOWDELAY);

But note the constants SOL_IP, IP_TOS and IPTOS_LOWDELAY are probably
not in the Socket module so you'll hace to grab them out of the C
header files yourself.

My answer is based on Linux - ymmv.

Re: Perl Module for Sockets that can Mark DSCP

am 03.05.2006 00:57:31 von smchugh

Thanks guys! I am new to this stuff I know what I need to do just don't
have a budget to spend on a vendor tool.

This is really cool. Got a udp flood perl script to work today!

Re: Perl Module for Sockets that can Mark DSCP

am 03.05.2006 01:58:00 von smchugh

"Brian McCauley" wrote in message
> But note the constants SOL_IP, IP_TOS and IPTOS_LOWDELAY are probably
> not in the Socket module so you'll hace to grab them out of the C
> header files yourself.

Ughhh sorry but I am really a newbie. How do I grab them from the C header
files? I have googled for this but I am just really lost.
TIA

Re: Perl Module for Sockets that can Mark DSCP

am 03.05.2006 15:34:41 von Donald King

Scott (Scooter) McHugh wrote:
> "Brian McCauley" wrote in message
>
>>But note the constants SOL_IP, IP_TOS and IPTOS_LOWDELAY are probably
>>not in the Socket module so you'll hace to grab them out of the C
>>header files yourself.
>
>
> Ughhh sorry but I am really a newbie. How do I grab them from the C header
> files? I have googled for this but I am just really lost.
> TIA
>
>

Assuming you have the C header files installed, the following command
ought to find what you're looking for:

find /usr/include -name "*.h" -type f | \
xargs grep '\<\(SOL_IP\|IP_TOS\|IPTOS_LOWDELAY\)\>'

For instance, I dredge up the following on Debian Linux:

#define SOL_IP 0
#define IP_TOS 1
#define IPTOS_LOWDELAY 0x10

The equivalent Perl code is:

use constant SOL_IP => 0;
use constant IP_TOS => 1;
use constant IPTOS_LOWDELAY => 0x10;

--
Donald King, a.k.a. Chronos Tachyon
http://chronos-tachyon.net/