Hello Everyone
I am working on a ADSL modem and have the following situation that I would like to have some advice one.
My ADSL modem runs on Monta Vista Linux and comes in 2 models; Bridge and a Router and my question concerns the Bridge.
To monitor the status of the ADSL modem we have an application(host application) running on a PC/MAC that requests data of the modems status from a control application that runs on the ADSL modem. When the host application sends out a request it is in the form of a broadcast using IP/UDP packet based upon a UDP socket setup. Now my problem is when the ADSL modem is a bridge and host runs a PPPoE client to encapsulate the data so that the ISP can receive it. When having a setup like this a Windows machine sends out 2 packages when the host application does a broadcast for status of the modem. One packet is pure: ethernet|IP|UDP while the other one is ethernet|ppp|IP|UDP and my application only picks up one packet which is ethernet|IP|UDP and while the one containing ppp gets lost. Since the 2 packages contains the same request for information its not such a big deal under Windows. However when running this setup on a MAC only 1 packet gets sent out from the host application: ethernet|ppp|IP|UDP and this in NOT received by my control application(its a UDP socket) and no data is sent back to the host application.
After the "history" lesson I move onto my questions: How do I setup a socket on the control application that can receive both types of packages: ethernet|IP|UDP and a ethernet|ppp|IP|UDP
One option is to have a RAW Ethernet socket: sock = socket(AF_INET,SOCK_RAW,htons(ETH_P_ALL)); This would collect ALL Ethernet frames and since this is a ADSL modem there will be quite few of them. I would have to spend a lot of CPU time looking for my control frames(they have a ID in the UDP data so it can be done). I do not feel that this solution is the best but an option that I am exploring.
I have also tried to set up a RAW IP/UDP socket: sock = socket(AF_INET,SOCK_RAW,IPPROTO_UDP); However this socket did only collect the IP/UDP and threw away the PPP packages as it should do:(:(
So what I am looking for is like a middle way between RAW Ethernet and RAW IP/UDP, I want my control application to receive 2 types of packages: ethernet|IP|UDP and ethernet|ppp|IP|UDP.
Any advice or input would be greatly appreciated.
Regards Andreas