08-31-2005
A really tough one!
What if u try to use write()...
Building ethernet header is fairly simple just look at /usr/include/linux/if_ether.h just 3 data fields which can be filled by data u have read from recvfrom(), You already know how to build an arp reply header ...
... all you have left to do is then write() down the entire buffer eth+arp, check write() ret-code and sniff/monitor the pkt
For the sockaddr cast problem, i really have no clue
10 More Discussions You Might Find Interesting
1. Ubuntu
I hope to post in the right place, otherwise I apologize for this
I wrote a UDP sender and a UDP receiver, my goal is to transmit a file from th sender to the receiver. I'm using Ubuntu 8.04
Compiling goes well but when I execute the sender, its "sendto" gives me the error "Permission denied" .... (0 Replies)
Discussion started by: Puntino
0 Replies
2. IP Networking
Hi
I lost a lot of time in understanding the message "sendto Invalid argument" when I execute the following code.
This code is a simple UDP sender improved with some reliability feature.
My goal is to send a file. I've reported only the code which may be useful.
Can anyone help me?
Thank you... (0 Replies)
Discussion started by: Puntino
0 Replies
3. IP Networking
Hi guys below is the code which I wrote to send some message to the server and the receive a a reply message from the server.
Initially, I wrote one program to sendto and one program to receive from, it is working fine seperately. When I tried coding sendto and recvfrom in a sinlge program then... (0 Replies)
Discussion started by: arunc.kris
0 Replies
4. UNIX for Advanced & Expert Users
Hi,
I was porting ipv4 application to ipv6; i was done with TCP transports. Now i am facing problem with SCTp transport at runtime.
To test SCTP transport I am using following server and client socket programs. Server program runs fine, but client program fails giving Invalid Arguments for... (0 Replies)
Discussion started by: chandrutiptur
0 Replies
5. Programming
Why does this socket function only read the first 1440 chars of the stream. Why not the whole stream ? I checked it with gdm and valgrind and everything seems correct...
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include... (3 Replies)
Discussion started by: cyler
3 Replies
6. Programming
Hello
I try to send DHCP RENEW packets to the network and receive the responses. I broadcast the packet and I can see that it's successfully sent using Wireshark. But I have difficulties receiving the responses.I use packet sockets to catch the packets. I can see that there are responses to my... (0 Replies)
Discussion started by: xyzt
0 Replies
7. IP Networking
I need clarification on whether it is okay to set socket options on a listening socket
simultaneously when it is being used in an accept() call?
Following is the scenario:-
-- Task 1 - is executing in a loop - polling a listen socket, lets call it 'fd', (whose file descriptor is global)... (2 Replies)
Discussion started by: jake24
2 Replies
8. IP Networking
Hi,
I am working to implement a basic WiFi infrastructure in NS3. I have placed 16 APs in grid and one client is moving using random walk. Client and AP can communicate through message exchange. However, when I try a message of size more than 30 bytes, it is crashed. Please help me if anyone have... (0 Replies)
Discussion started by: dandapat
0 Replies
9. Programming
Hi,
I have the requirement to sniff packets from
the Ethernet card on my Linux machine and
process it and feed it to a RANAP protocol stack.
So far I have written the raw packet sniffer
and successfully sniffing packets and do little
processing. However, for huge number of packets ... (9 Replies)
Discussion started by: rstnsrr
9 Replies
10. AIX
(5 Replies)
Discussion started by: Vishal_dba
5 Replies
ARP(9) BSD Kernel Developer's Manual ARP(9)
NAME
arp, arp_ifinit, arpresolve, arpintr -- externally visible ARP functions
SYNOPSIS
#include <netinet/if_inarp.h>
void
arp_ifinit(struct ifnet *ifp, struct ifaddr *ifa);
int
arpresolve(struct ifnet *ifp, struct rtentry *rt, struct mbuf *m, struct sockaddr *dst, u_char *desten);
void
arpintr();
DESCRIPTION
The arp functions provide the interface between the arp module and the network drivers which need arp functionality. Such drivers must
request the arp attribute in their "files" declaration.
arp_ifinit() Sets up the arp specific fields in ifa. Additionally, it sends out a gratuitous arp request on ifp, so that other machines are
warned that we have a (new) address and duplicate addresses can be detected.
You must call this in your drivers' ioctl function when you get a SIOCSIFADDR request with an AF_INET address family.
arpresolve() is called by network output functions to resolve an IPv4 address. If no rt is given, a new one is looked up or created. If
the passed or found rt does not contain a valid gateway link level address, a pointer to the packet in m is stored in the route
entry, possibly replacing older stored packets, and an arp request is sent instead. When an arp reply is received, the last
held packet is send. Otherwise, the looked up address is returned and written into the storage desten points to. arpresolve()
returns 1, if a valid address was stored to desten, and the packet can be sent immediately. Else a 0 is returned.
arpintr() When an arp packet is received, the network driver (class) input interrupt handler queues the packet on the arpintrq queue, and
requests an arpintr() soft interrupt callback. arpintr() dequeues the packets, performs sanity checks and calls (for IPv4 arp
packets, which are the only ones supported currently) the in_arpinput() function. in_arpinput() either generates a reply to
request packets, and adds the sender address translation to the routing table, if a matching route entry is found. If the
route entry contained a pointer to a held packet, that packet is sent.
SEE ALSO
ether_ifattach(9)
Plummer, D., "RFC826", An Ethernet Address Resolution Protocol.
STANDARDS
RFC 826
HISTORY
Rewritten to support other than Ethernet link level addresses in NetBSD 1.3.
AUTHORS
UCB CSRG (original implementation)
Ignatios Souvatzis (support for non-Ethernet)
CODE REFERENCES
The ARP code is implemented in sys/net/if_arp.h, sys/netinet/if_inarp.h and sys/netinet/if_arp.c.
BSD
March 3, 1997 BSD