LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-29-2012, 06:47 AM   #1
franmf
LQ Newbie
 
Registered: Oct 2012
Posts: 28

Rep: Reputation: Disabled
need to personalize some ping command.


Hi, I'll give my best to explain the next. I'm programming a sniffer which is suppossed to sniff frames which pass through my router (openwrt firmware). What I have to do is to detect if any of these frames are destined to any of the PCs of my net, and if it is so, I have to check if they are awake or asleep. If they are asleep, I send an etherwake MAC frame in order to wake it up.

my problem is the next. I've also created a monotorized routine which does a ping -q -c 1 -W 1 host_address for each PC connected to the net which is automatically executed each minute.. If any PC is asleep, it puts an 1 in the apropiate PCs array list place, so that when the sniffer detects a frame going to PC X.X.X.X, and if it is also asleep, it executes the etherwake command.

so...as you can see, the problem is that when the monotorized routine sends a ping, which is an arp frame, it wakes my PC up, and I just want to test if it is asleep or not.

how can I send a modificated/personalized ping so that I could configure my sniffer and let that frames go away?

thank you. Sorry for my english, I'm doing my best, I promise.

Last edited by franmf; 10-29-2012 at 06:49 AM.
 
Old 10-29-2012, 01:08 PM   #2
ComputeWorldwide
LQ Newbie
 
Registered: May 2006
Posts: 17

Rep: Reputation: 1
Dear FranMF:
I have a design proposal for you. Have the sniffing router listen for traffic from each affected device, and develop a probability that the device is awake, based on recent activity. You might even have the client devices run a program when they're awake, which pings the sniffing router periodically, as part of the solution. In any case, if you send a packet to a device and do not see an acknowledgment, then you could wake it and re-send. But I thought network devices normally did this anyway.

HTH
MontyMan.
 
Old 10-29-2012, 02:17 PM   #3
franmf
LQ Newbie
 
Registered: Oct 2012
Posts: 28

Original Poster
Rep: Reputation: Disabled
I'll explain why I do that. I've been told to do, for my final degree proyect, an automatic wake on lan. So when it finds a frame with x.x.x.x dest ip, and if x.x.x.x is asleep, it wakes it up automaticaly. Apart from that, in order not to send frames every time you find a frame with x.x.x.x dest(hundreds each second), I've been told to monitorize it and each Y seconds update the stade of the machines so that when frame x.x.x.x dest & is asleep then wake it up.

the problem is when I'm asking the pc if is asleep or not, the sniffer detects the frame and wake it up. As if I wanted to make a special frame or whatever that the sniffer doesn't care about that frame.
 
Old 10-31-2012, 04:18 PM   #4
Hidden Windshield
Member
 
Registered: Jul 2010
Distribution: Fedora
Posts: 68

Rep: Reputation: 27
One option is to quit using the "ping" utility entirely. Instead, have a little program that uses raw sockets to generate the ICMP echo request, then listens for the echo reply. This program can put anything it wants in the payload of the packet, then your monitor checks for that specific payload, and ignores the packet.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ping command hangs indefinitely i.e.system(ping -w 10 [ip address]) Anshu Tomar Linux - Newbie 4 07-05-2012 07:16 AM
[SOLVED] Where can I modify ls command to personalize with my preferred options? Foxbat1155 Linux - Newbie 9 11-25-2011 07:12 AM
I cannot ping with command 'ping IP' address but can ping with 'ping IP -I eth0' sanketmlad Linux - Networking 2 07-15-2011 05:32 AM
How to personalize email boToo Linux - Software 2 11-17-2006 09:02 PM
Simple question about command syntax ping/log ping results ohalnet Linux - Networking 1 07-25-2006 04:46 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration