ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.