How to receive UDP and ICMP packet using one UDP socket, (Path MTUD)

How to receive UDP and ICMP packet using one UDP socket, (Path MTUD)

Post by Raja » Fri, 28 May 2004 15:28:17



Dear All,

Can we configure one socket to receive two different protocols packet.
Like how can we made a UDP socket to receive udp as well as icmp
messages.

Actually I am implementing Path MTUD, so for that I sent some udp
probs to destination host, now I want that the same socket at client
side must be able to receive both udp response and icmp error
messages(like host unreachable, port unreachable etc).

Another approach is that, we will use two sockets for both source and
destination, form source we will send udp probs(through udp socket)
while at destination host, after receiving that prob(through udp
socket), application will make an icmp packet and sent it back to the
source host (using ICMP socket). And here at source host, that message
and other icmp error messages will be received by icmp socket.

But this approch dosen't look efficient to me, what u people say? If
Any one has another approch plz let me know.

Eagerly waiting for some +ve pings.

 
 
 

How to receive UDP and ICMP packet using one UDP socket, (Path MTUD)

Post by James Knot » Fri, 28 May 2004 19:54:33



> Can we configure one socket to receive two different protocols packet.
> Like how can we made a UDP socket to receive udp as well as icmp
> messages.

?????

You don't!

--

Fundamentalism is fundamentally wrong.


james.knott.

 
 
 

How to receive UDP and ICMP packet using one UDP socket, (Path MTUD)

Post by Cameron Ker » Fri, 28 May 2004 17:00:10



> Dear All,

> Can we configure one socket to receive two different protocols packet.
> Like how can we made a UDP socket to receive udp as well as icmp
> messages.

You need to use two sockets and select() on them for readability. The
ICMP socket will need to be a RAW IP socket, IIRC, and will require root
priviledge.

Get yourself a copy of Unix Network Programming (3rd version is
the latest). I have the 2nd version, which I used for teaching network
programming last year. Its a truly great book that everyone will refer
you to in newsgroups.

You might also want to have a look to see what error (if any) you get on
your UDP packet when fragmentation is needed, but Don't Fragment is set.
You may need to use the recvmsg functions for this, plus maybe set some
socket options to turn on Don't Fragment.

Actually, I think UNP covers how to do Path MTUD in one of the
exercises, IIRC (it's at work, I can't currently check.)

--
Cameron Kerr

Empowered by Perl!

 
 
 

How to receive UDP and ICMP packet using one UDP socket, (Path MTUD)

Post by Andrew Keit » Mon, 31 May 2004 03:19:45


i think you cant ..

since UDP and ICMP are really different binds, i dont think you can
make a socket from both at the same time. (SOCKET_UDP, SOCKET_RAW)

Andrew


Quote:> Dear All,

> Can we configure one socket to receive two different protocols packet.
> Like how can we made a UDP socket to receive udp as well as icmp
> messages.

> Actually I am implementing Path MTUD, so for that I sent some udp
> probs to destination host, now I want that the same socket at client
> side must be able to receive both udp response and icmp error
> messages(like host unreachable, port unreachable etc).

> Another approach is that, we will use two sockets for both source and
> destination, form source we will send udp probs(through udp socket)
> while at destination host, after receiving that prob(through udp
> socket), application will make an icmp packet and sent it back to the
> source host (using ICMP socket). And here at source host, that message
> and other icmp error messages will be received by icmp socket.

> But this approch dosen't look efficient to me, what u people say? If
> Any one has another approch plz let me know.

> Eagerly waiting for some +ve pings.

 
 
 

1. aplication to receive [ethernet|IP|UDP] and [ethernet|ppp|IP|UDP] packages over socket

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

2. httpd threads not ending?

3. application to receive ethernet|IP|UDP a ethernet|ppp|IP|UDP packages over socket

4. Telnet Login Show Up After Logout

5. Kernel does not detect UDP/ICMP packets

6. Printing with a BJC-4000

7. missing icmp errors for udp packets

8. mount memory

9. Problem with capturing the icmp and udp packets

10. no ICMP port unreachable for UDP packets

11. recvfrom():how to receive multiple UDP packets.

12. PKERNEL: Warning: RPC/UDP receive queue are full, packet dropping

13. UDP packet receive errors--wazup?