Hi Per,
Thank's for your answer but that is not what I need. In my case, I need
to know the MAC address of the sender.
Nicolas
[EMAIL PROTECTED] a écrit :
Hi,
I've done this (didn't think of using the ARP cache which seems to be
a nicer solution)
static void callback_recv ( void *arg, struct udp_pcb *pcb, struct
pbuf *p, struct ip_addr *addr, u16_t port )
{
... stuff removed
// This is quite a dirty solution (retreiving the ip header from the
lower layer) to find out
// if the ip-packet was received as an unicast or brodcast. If we
cannot find the start of the
// ip header (probably because the options field wasn't empty) we
will respond with a broadcast.
struct ip_hdr *iphdr = (struct ip_hdr *)((u8_t *)p->payload -
UDP_HLEN - IP_HLEN);
unsigned long reply_addr;
if( *(unsigned char *)iphdr != 0x45 || IPH_PROTO(iphdr) !=
IP_PROTO_UDP )
reply_addr= 0xffffffff; // We have not found the begining of
the ip-header :( Therefore we cannot
// determinate if the destination
address was unicast or broadcast.
// Lets broadcast the reply - to be
sure no arp will be needed
else if( iphdr->dest.addr == 0xffffffff )
reply_addr= 0xffffffff; // broadcast input -> broadcast output
else
reply_addr= addr->addr; // unicast input -> unicast output
... stuff removed
}
/Per/
*Frédéric BERNON <[EMAIL PROTECTED]>*
Sent by: [EMAIL PROTECTED]
2007-12-17 17:52
Please respond to
Mailing list for lwIP users <[email protected]>
To
<[EMAIL PROTECTED]>, "Mailing list for lwIP users"
<[email protected]>
cc
Subject
RE : [lwip-users] Source MAC address
Hi,
I think you could use etharp_find_addr to read the ARP table :
s
/**
* Finds (stable) ethernet/IP address pair from ARP table
* using interface and IP address index.
* @note the addresses in the ARP table are in network order!
*
* @param netif points to interface index
* @param ipaddr points to the (network order) IP address index
* @param eth_ret points to return pointer
* @param ip_ret points to return pointer
* @return table index if found, -1 otherwise
*/
s8_t etharp_find_addr(struct netif *netif, struct ip_addr *ipaddr,
struct eth_addr **eth_ret, struct ip_addr **ip_ret);
====================================
Frédéric BERNON
HYMATOM SA
Chef de projet informatique
Microsoft Certified Professional
Tél. : +33 (0)4-67-87-61-10
Fax. : +33 (0)4-67-70-85-44
Email : [EMAIL PROTECTED]
Web Site : http://www.hymatom.fr
====================================
P Avant d'imprimer, penser à l'environnement
-----Message d'origine-----
De : [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] De
la part de Nicolas Pinault
Envoyé : lundi 17 décembre 2007 17:00
À : Mailing list for lwIP users
Objet : [lwip-users] Source MAC address
Hi all,
My system uses non connected sockets (UDP) to get data from other
machines. Some packets are received thru broadcast address
(255.255.255.255).
In the thread wich manages the rx socket, I'd like to know the sender
MAC address. I allready have the sender IP address but that is not what
I want.
It seems it is not posible to get this information without a big
modification of lwip.
I am wrong ?
Nicolas
_______________________________________________
lwip-users mailing list
[email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users
*** Q-MATIC eSafe scanned this email for malicious content ***
*** IMPORTANT: Do not open attachments from unrecognized senders
***_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users
------------------------------------------------------------------------
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users