Problem Receiving the first OSPF packet

I trying to send and receive OSPF packets. I am using RAW Sockets(socket(AF_INET, SOCK_RAW, IPPROTO_OSPF)) to do this.

I am successfully able to send an OSPF Hello packet however I am not able to receive a OSPF packet if I have not sent an OSPF packet earlier on the RAW SOCKET.
Scenario:

Working
Send_OSPF_packet()
Receive_OSPF_packet()

Not Working
Receive_OSPF_packet()

I see the receive packet using ethereal packet capture. However my application does not get the packet. I see that its got to do with kernal/os/lower layer (Not sure which one) not passing the packet to my RAW socket.

What do I have to do to Receive the First OSPF packet?

The Code written by me is in C language.
I use Winsock. The OS I use is Microsoft XP professional sp2

Please let me know of anymore details required.

What happens when you send yourself a hello packet? Have you tried sending a HELLO packet from another client? (zebra, cisco, etc).

Are you listening on 224.0.0.5? or 224.0.0.6?
If the IP next-header field set correctly? (89)

Just some wild stabs in the dark :slight_smile:

/Fimblo

Thanks for the reply and sorry for late reply. but I think that problem is not understood correctly.
I will try more explanation.
This is what I do. I do not interact with a an OSPF client as yet.
I am trying to develop code which could just send and receive OSPF packet.

Scenario1:
PC1

1) send any ospf packet(need not be an Hello packet) to PC2.
and wait for a OSPF packet.

PC2

2) See in Ethereal packet sniffer the packet

PC2

3) Send any OSPF packet to PC1.

PC1

4) My application is able to receive the OSPF packet. and also can see the packet in the ethereal packet sniffer

The above scenario works as expected but when
scenario2.

PC1

1) Wait for any OSPF packet(Application has not sent an OSPF packet yet)

PC2

2) Send an OSPF packet to PC1

PC1

3) Can see the packet in ethereal packet sniffer but my application times out waiting on the raw socket(Not received the data).

Why in the second scenario would my application not get the data from the kernal/os?

Well for fimblo's question

1) What happens when you send yourself a hello packet? Have you tried sending a HELLO packet from another client? (zebra, cisco, etc).

Ans. I just receive and ICMP message (Destination Unreacable | Protocol Unreachable). As I do not have a OSPF client on the other machine.
However this gives me an idea of going through zebra code. and figuring out how are they able to receive the packets.
I will also try doing as suggested in coming days. as that is my next step.

2) Are you listening on 224.0.0.5? or 224.0.0.6?
If the IP next-header field set correctly? (89)

Ans. I was just listening on the raw socket that I used to send and receive data in scenario 1.

Please Forgive me any inconsistencies I am just an amateur programmer and new to discussion forums.