core/net/uip: Rename uip_ethaddr to uip_lladdr.

There isn't really a good reason I can think of for these
to be different between IPv4 and IPv6.
This commit is contained in:
Robert Quattlebaum 2013-01-09 08:03:57 -08:00
parent 9c8f1d5356
commit 1d113f52ad
11 changed files with 33 additions and 34 deletions

View file

@ -114,7 +114,7 @@ PROCESS_THREAD(dhcp_process, ev, data)
CTK_WIDGET_FOCUS(&window, &getbutton);
ctk_window_open(&window);
dhcpc_init(uip_ethaddr.addr, sizeof(uip_ethaddr.addr));
dhcpc_init(uip_lladdr.addr, sizeof(uip_lladdr.addr));
while(1) {

View file

@ -115,14 +115,14 @@ const uip_ipaddr_t uip_broadcast_addr =
const uip_ipaddr_t uip_all_zeroes_addr = { { 0x0, /* rest is 0 */ } };
#if UIP_FIXEDETHADDR
const struct uip_eth_addr uip_ethaddr = {{UIP_ETHADDR0,
const uip_lladdr_t uip_lladdr = {{UIP_ETHADDR0,
UIP_ETHADDR1,
UIP_ETHADDR2,
UIP_ETHADDR3,
UIP_ETHADDR4,
UIP_ETHADDR5}};
#else
struct uip_eth_addr uip_ethaddr = {{0,0,0,0,0,0}};
uip_lladdr_t uip_lladdr = {{0,0,0,0,0,0}};
#endif
/* The packet buffer that contains incoming packets. */
@ -1050,7 +1050,7 @@ uip_process(uint8_t flag)
uip_ipaddr_copy(&ICMPBUF->srcipaddr, &uip_hostaddr);
ICMPBUF->options[0] = ICMP6_OPTION_TARGET_LINK_ADDRESS;
ICMPBUF->options[1] = 1; /* Options length, 1 = 8 bytes. */
memcpy(&(ICMPBUF->options[2]), &uip_ethaddr, sizeof(uip_ethaddr));
memcpy(&(ICMPBUF->options[2]), &uip_lladdr, sizeof(uip_lladdr));
ICMPBUF->icmpchksum = 0;
ICMPBUF->icmpchksum = ~uip_icmp6chksum();

View file

@ -311,8 +311,8 @@ uip_arp_arpin(void)
BUF->opcode = UIP_HTONS(ARP_REPLY);
memcpy(BUF->dhwaddr.addr, BUF->shwaddr.addr, 6);
memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6);
memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
memcpy(BUF->shwaddr.addr, uip_lladdr.addr, 6);
memcpy(BUF->ethhdr.src.addr, uip_lladdr.addr, 6);
memcpy(BUF->ethhdr.dest.addr, BUF->dhwaddr.addr, 6);
uip_ipaddr_copy(&BUF->dipaddr, &BUF->sipaddr);
@ -408,8 +408,8 @@ uip_arp_out(void)
memset(BUF->ethhdr.dest.addr, 0xff, 6);
memset(BUF->dhwaddr.addr, 0x00, 6);
memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6);
memcpy(BUF->ethhdr.src.addr, uip_lladdr.addr, 6);
memcpy(BUF->shwaddr.addr, uip_lladdr.addr, 6);
uip_ipaddr_copy(&BUF->dipaddr, &ipaddr);
uip_ipaddr_copy(&BUF->sipaddr, &uip_hostaddr);
@ -429,7 +429,7 @@ uip_arp_out(void)
/* Build an ethernet header. */
memcpy(IPBUF->ethhdr.dest.addr, tabptr->ethaddr.addr, 6);
}
memcpy(IPBUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
memcpy(IPBUF->ethhdr.src.addr, uip_lladdr.addr, 6);
IPBUF->ethhdr.type = UIP_HTONS(UIP_ETHTYPE_IP);

View file

@ -54,7 +54,6 @@
#include "net/uip.h"
CCIF extern struct uip_eth_addr uip_ethaddr;
/**
* The Ethernet header.
@ -130,12 +129,12 @@ void uip_arp_timer(void);
*
* \hideinitializer
*/
#define uip_setethaddr(eaddr) do {uip_ethaddr.addr[0] = eaddr.addr[0]; \
uip_ethaddr.addr[1] = eaddr.addr[1];\
uip_ethaddr.addr[2] = eaddr.addr[2];\
uip_ethaddr.addr[3] = eaddr.addr[3];\
uip_ethaddr.addr[4] = eaddr.addr[4];\
uip_ethaddr.addr[5] = eaddr.addr[5];} while(0)
#define uip_setethaddr(eaddr) do {uip_lladdr.addr[0] = eaddr.addr[0]; \
uip_lladdr.addr[1] = eaddr.addr[1];\
uip_lladdr.addr[2] = eaddr.addr[2];\
uip_lladdr.addr[3] = eaddr.addr[3];\
uip_lladdr.addr[4] = eaddr.addr[4];\
uip_lladdr.addr[5] = eaddr.addr[5];} while(0)
/** @} */

View file

@ -202,7 +202,7 @@ PROCESS_THREAD(ipconfig_process, ev, data)
/* Allow resolver to set DNS server address. */
PROCESS_PAUSE();
dhcpc_init(uip_ethaddr.addr, sizeof(uip_ethaddr.addr));
dhcpc_init(uip_lladdr.addr, sizeof(uip_lladdr.addr));
while(1) {
PROCESS_WAIT_EVENT();

View file

@ -298,7 +298,7 @@ create_msg(CC_REGISTER_ARG struct dhcp_msg *m)
m->op = DHCP_REPLY;
/* m->htype = DHCP_HTYPE_ETHERNET; */
/* m->hlen = DHCP_HLEN_ETHERNET; */
/* memcpy(m->chaddr, &uip_ethaddr,DHCP_HLEN_ETHERNET); */
/* memcpy(m->chaddr, &uip_lladdr,DHCP_HLEN_ETHERNET); */
m->hops = 0;
m->secs = 0;
memcpy(m->siaddr, &uip_hostaddr, 4);

View file

@ -155,11 +155,11 @@ HMODULE wpcap;
static struct pcap *pcap;
/* uip_ethaddr is defined in uip.c. It is not used in uip6.c.
/* uip_lladdr is defined in uip.c. It is not used in uip6.c.
* If needed for some purpose it can be defined here
*/
#if UIP_CONF_IPV6
//struct uip_eth_addr uip_ethaddr;
//struct uip_eth_addr uip_lladdr;
#endif
static int (* pcap_findalldevs)(struct pcap_if **, char *);
@ -266,7 +266,7 @@ set_ethaddr(struct in_addr addr)
adapters->PhysicalAddress[4], adapters->PhysicalAddress[5]);
log_message("set_ethaddr: ethernetaddr: ", buffer);
#if UIP_CONF_IPV6
// int i;for (i=0;i<6;i++) uip_ethaddr.addr[i] = adapters->PhysicalAddress[i];
// int i;for (i=0;i<6;i++) uip_lladdr.addr[i] = adapters->PhysicalAddress[i];
#else
uip_setethaddr((*(struct uip_eth_addr *)adapters->PhysicalAddress));
#endif
@ -328,7 +328,7 @@ set_ethaddr6(struct in_addr6 addr)
adapters->PhysicalAddress[4], adapters->PhysicalAddress[5]);
log_message("set_ethaddr: ethernetaddr: ", buffer);
#if UIP_CONF_IPV6
// int i;for (i=0;i<6;i++) uip_ethaddr.addr[i] = adapters->PhysicalAddress[i]; //does this need doing?
// int i;for (i=0;i<6;i++) uip_lladdr.addr[i] = adapters->PhysicalAddress[i]; //does this need doing?
#else
uip_setethaddr((*(struct uip_eth_addr *)adapters->PhysicalAddress));
#endif

View file

@ -187,7 +187,7 @@ tapdev_send(void)
printf("\n");
} else {
memcpy(&BUF->dest, addr, 6);
memcpy(&BUF->src, &uip_ethaddr, 6);
memcpy(&BUF->src, &uip_lladdr, 6);
uip_len += sizeof(struct uip_eth_hdr);
do_send();
}

View file

@ -685,7 +685,7 @@ LOAD /cygdrive/c/mspgcc/bin/../lib/gcc-lib/msp430/3.2.3/msp2/libgcc.a
.data 0x000002d8 0x2 contiki-esb.a(service.o)
.data 0x000002da 0x0 contiki-esb.a(timer.o)
.data 0x000002da 0x6 contiki-esb.a(uip.o)
0x000002da uip_ethaddr
0x000002da uip_lladdr
.data 0x000002e0 0xa contiki-esb.a(tr1001-drv.o)
0x000002e0 tr1001_drv_process
.data 0x000002ea 0x0 contiki-esb.a(esb-sensors.o)

View file

@ -123,7 +123,7 @@ static int (* pcap_sendpacket)(struct pcap *, unsigned char *, int);
#include "net/uip_arp.h"
struct uip_eth_addr uip_ethaddr = {{0,0,0,0,0,0}};
struct uip_eth_addr uip_lladdr = {{0,0,0,0,0,0}};
static char interface_name[256] = "";
@ -147,7 +147,7 @@ error_exit(char *msg1)
static void
setethaddr(struct uip_eth_addr *a)
{
memcpy(&uip_ethaddr, a, sizeof(struct uip_eth_addr));
memcpy(&uip_lladdr, a, sizeof(struct uip_eth_addr));
}
/*---------------------------------------------------------------------------*/
static void
@ -271,7 +271,7 @@ wpcap_poll(char * buf)
eth_hdr = (struct uip_eth_hdr *)packet;
if(memcmp(&uip_ethaddr,&eth_hdr->src,sizeof(struct uip_eth_addr))!=0){
if(memcmp(&uip_lladdr,&eth_hdr->src,sizeof(struct uip_eth_addr))!=0){
// It's not a packet originated from the interface itself.
return 0;
}

View file

@ -150,7 +150,7 @@ struct arp_entry {
struct uip_eth_addr ethaddr;
uint8_t time;
};
static struct uip_eth_addr uip_ethaddr = {{0,0,0,0,0,0}};
static struct uip_eth_addr uip_lladdr = {{0,0,0,0,0,0}};
static const uip_ipaddr_t all_zeroes_addr = { { 0x0, /* rest is 0 */ } };
static const struct uip_eth_addr broadcast_ethaddr =
{{0xff,0xff,0xff,0xff,0xff,0xff}};
@ -224,7 +224,7 @@ init_pcap(struct in_addr addr)
static void
setethaddr(struct uip_eth_addr *a)
{
memcpy(&uip_ethaddr, a, sizeof(struct uip_eth_addr));
memcpy(&uip_lladdr, a, sizeof(struct uip_eth_addr));
}
/*---------------------------------------------------------------------------*/
static void
@ -439,8 +439,8 @@ arp_out(struct ethip_hdr *iphdr, int len)
memset(arphdr->ethhdr.dest.addr, 0xff, 6);
memset(arphdr->dhwaddr.addr, 0x00, 6);
memcpy(arphdr->ethhdr.src.addr, uip_ethaddr.addr, 6);
memcpy(arphdr->shwaddr.addr, uip_ethaddr.addr, 6);
memcpy(arphdr->ethhdr.src.addr, uip_lladdr.addr, 6);
memcpy(arphdr->shwaddr.addr, uip_lladdr.addr, 6);
uip_ipaddr_copy(&arphdr->dipaddr, &ipaddr);
uip_ipaddr_copy(&arphdr->sipaddr, &netaddr);
@ -460,7 +460,7 @@ arp_out(struct ethip_hdr *iphdr, int len)
memcpy(iphdr->ethhdr.dest.addr, tabptr->ethaddr.addr, 6);
}
#endif /* 0 */
memcpy(iphdr->ethhdr.src.addr, uip_ethaddr.addr, 6);
memcpy(iphdr->ethhdr.src.addr, uip_lladdr.addr, 6);
iphdr->ethhdr.type = UIP_HTONS(UIP_ETHTYPE_IP);
@ -489,8 +489,8 @@ do_arp(void *buf, int len)
hdr->opcode = UIP_HTONS(ARP_REPLY);
memcpy(&hdr->dhwaddr.addr, &hdr->shwaddr.addr, 6);
memcpy(&hdr->shwaddr.addr, &uip_ethaddr.addr, 6);
memcpy(&hdr->ethhdr.src.addr, &uip_ethaddr.addr, 6);
memcpy(&hdr->shwaddr.addr, &uip_lladdr.addr, 6);
memcpy(&hdr->ethhdr.src.addr, &uip_lladdr.addr, 6);
memcpy(&hdr->ethhdr.dest.addr, &hdr->dhwaddr.addr, 6);
uip_ipaddr_copy(&tmpaddr, &hdr->dipaddr);