mirror of
https://github.com/ep00ch/lwip-contrib-mac.git
synced 2024-06-02 10:41:29 +00:00
minor: fixed source code layout
This commit is contained in:
parent
17026e30b1
commit
44273aed6f
|
@ -87,16 +87,16 @@ delif_input_timeout(void *arg)
|
||||||
dp = input_list;
|
dp = input_list;
|
||||||
while (dp != NULL) {
|
while (dp != NULL) {
|
||||||
now = sys_now();
|
now = sys_now();
|
||||||
|
|
||||||
if (dp->time <= now) {
|
if (dp->time <= now) {
|
||||||
delif->input(dp->p, netif);
|
delif->input(dp->p, netif);
|
||||||
if (dp->next != NULL) {
|
if (dp->next != NULL) {
|
||||||
if (dp->next->time > now) {
|
if (dp->next->time > now) {
|
||||||
timeout = dp->next->time - now;
|
timeout = dp->next->time - now;
|
||||||
} else {
|
} else {
|
||||||
timeout = 0;
|
timeout = 0;
|
||||||
}
|
}
|
||||||
LWIP_DEBUGF(DELIF_DEBUG, ("delif_output_timeout: timeout %u.\n", timeout));
|
LWIP_DEBUGF(DELIF_DEBUG, ("delif_output_timeout: timeout %u.\n", timeout));
|
||||||
|
|
||||||
}
|
}
|
||||||
input_list = dp->next;
|
input_list = dp->next;
|
||||||
|
@ -122,26 +122,26 @@ delif_output_timeout(void *arg)
|
||||||
|
|
||||||
netif = arg;
|
netif = arg;
|
||||||
delif = netif->state;
|
delif = netif->state;
|
||||||
|
|
||||||
/* Check if there is anything on the output list. */
|
/* Check if there is anything on the output list. */
|
||||||
dp = output_list;
|
dp = output_list;
|
||||||
while (dp != NULL) {
|
while (dp != NULL) {
|
||||||
now = sys_now();
|
now = sys_now();
|
||||||
if (dp->time <= now) {
|
if (dp->time <= now) {
|
||||||
LWIP_DEBUGF(DELIF_DEBUG, ("delif_output_timeout: now %u dp->time %u\n",
|
LWIP_DEBUGF(DELIF_DEBUG, ("delif_output_timeout: now %u dp->time %u\n",
|
||||||
now, dp->time));
|
now, dp->time));
|
||||||
delif->netif->output(delif->netif, dp->p, dp->ipaddr);
|
delif->netif->output(delif->netif, dp->p, dp->ipaddr);
|
||||||
if (dp->next != NULL) {
|
if (dp->next != NULL) {
|
||||||
if (dp->next->time > now) {
|
if (dp->next->time > now) {
|
||||||
timeout = dp->next->time - now;
|
timeout = dp->next->time - now;
|
||||||
} else {
|
} else {
|
||||||
timeout = 0;
|
timeout = 0;
|
||||||
}
|
}
|
||||||
LWIP_DEBUGF(DELIF_DEBUG, ("delif_output_timeout: timeout %u.\n", timeout));
|
LWIP_DEBUGF(DELIF_DEBUG, ("delif_output_timeout: timeout %u.\n", timeout));
|
||||||
|
|
||||||
}
|
}
|
||||||
pbuf_free(dp->p);
|
pbuf_free(dp->p);
|
||||||
|
|
||||||
output_list = dp->next;
|
output_list = dp->next;
|
||||||
free(dp);
|
free(dp);
|
||||||
dp = output_list;
|
dp = output_list;
|
||||||
|
@ -321,6 +321,3 @@ delif_init_thread(struct netif *netif)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -79,8 +79,7 @@ static char errbuf[PCAP_ERRBUF_SIZE];
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
static err_t
|
static err_t
|
||||||
pcapif_output(struct netif *netif, struct pbuf *p,
|
pcapif_output(struct netif *netif, struct pbuf *p, ip_addr_t *ipaddr)
|
||||||
ip_addr_t *ipaddr)
|
|
||||||
{
|
{
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
@ -107,15 +106,15 @@ timeout(void *arg)
|
||||||
|
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
/* We iterate over the pbuf chain until we have read the entire
|
/* We iterate over the pbuf chain until we have read the entire
|
||||||
packet into the pbuf. */
|
packet into the pbuf. */
|
||||||
bufptr = (u_char *)pcapif->pkt;
|
bufptr = (u_char *)pcapif->pkt;
|
||||||
for(q = p; q != NULL; q = q->next) {
|
for(q = p; q != NULL; q = q->next) {
|
||||||
/* Read enough bytes to fill this pbuf in the chain. The
|
/* Read enough bytes to fill this pbuf in the chain. The
|
||||||
available data in the pbuf is given by the q->len
|
available data in the pbuf is given by the q->len
|
||||||
variable. */
|
variable. */
|
||||||
/* read data into(q->payload, q->len); */
|
/* read data into(q->payload, q->len); */
|
||||||
bcopy(bufptr, q->payload, q->len);
|
bcopy(bufptr, q->payload, q->len);
|
||||||
bufptr += q->len;
|
bufptr += q->len;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(LWIP_DEBUG) && defined(LWIP_TCPDUMP)
|
#if defined(LWIP_DEBUG) && defined(LWIP_TCPDUMP)
|
||||||
|
@ -124,17 +123,24 @@ timeout(void *arg)
|
||||||
|
|
||||||
ethhdr = p->payload;
|
ethhdr = p->payload;
|
||||||
switch (htons(ethhdr->type)) {
|
switch (htons(ethhdr->type)) {
|
||||||
|
/* IP or ARP packet? */
|
||||||
case ETHTYPE_IP:
|
case ETHTYPE_IP:
|
||||||
etharp_ip_input(netif, p);
|
|
||||||
pbuf_header(p, -14);
|
|
||||||
netif->input(p, netif);
|
|
||||||
break;
|
|
||||||
case ETHTYPE_ARP:
|
case ETHTYPE_ARP:
|
||||||
etharp_arp_input(netif, pcapif->ethaddr, p);
|
#if PPPOE_SUPPORT
|
||||||
break;
|
/* PPPoE packet? */
|
||||||
default:
|
case ETHTYPE_PPPOEDISC:
|
||||||
pbuf_free(p);
|
case ETHTYPE_PPPOE:
|
||||||
break;
|
#endif /* PPPOE_SUPPORT */
|
||||||
|
/* full packet send to tcpip_thread to process */
|
||||||
|
if (netif->input(p, netif) != ERR_OK) {
|
||||||
|
LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_input: IP input error\n"));
|
||||||
|
pbuf_free(p);
|
||||||
|
p = NULL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
pbuf_free(p);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -289,22 +289,20 @@ tapif_input(struct netif *netif)
|
||||||
ethhdr = p->payload;
|
ethhdr = p->payload;
|
||||||
|
|
||||||
switch(htons(ethhdr->type)) {
|
switch(htons(ethhdr->type)) {
|
||||||
|
/* IP or ARP packet? */
|
||||||
case ETHTYPE_IP:
|
case ETHTYPE_IP:
|
||||||
LWIP_DEBUGF(TAPIF_DEBUG, ("tapif_input: IP packet\n"));
|
|
||||||
#if 0
|
|
||||||
/* CSi disabled ARP table update on ingress IP packets.
|
|
||||||
This seems to work but needs thorough testing. */
|
|
||||||
etharp_ip_input(netif, p);
|
|
||||||
#endif
|
|
||||||
pbuf_header(p, -14);
|
|
||||||
#if defined(LWIP_DEBUG) && defined(LWIP_TCPDUMP)
|
|
||||||
tcpdump(p);
|
|
||||||
#endif /* LWIP_DEBUG && LWIP_TCPDUMP */
|
|
||||||
netif->input(p, netif);
|
|
||||||
break;
|
|
||||||
case ETHTYPE_ARP:
|
case ETHTYPE_ARP:
|
||||||
LWIP_DEBUGF(TAPIF_DEBUG, ("tapif_input: ARP packet\n"));
|
#if PPPOE_SUPPORT
|
||||||
etharp_arp_input(netif, tapif->ethaddr, p);
|
/* PPPoE packet? */
|
||||||
|
case ETHTYPE_PPPOEDISC:
|
||||||
|
case ETHTYPE_PPPOE:
|
||||||
|
#endif /* PPPOE_SUPPORT */
|
||||||
|
/* full packet send to tcpip_thread to process */
|
||||||
|
if (netif->input(p, netif) != ERR_OK) {
|
||||||
|
LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_input: IP input error\n"));
|
||||||
|
pbuf_free(p);
|
||||||
|
p = NULL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
|
@ -334,7 +332,7 @@ tapif_init(struct netif *netif)
|
||||||
netif->name[1] = IFNAME1;
|
netif->name[1] = IFNAME1;
|
||||||
netif->output = etharp_output;
|
netif->output = etharp_output;
|
||||||
netif->linkoutput = low_level_output;
|
netif->linkoutput = low_level_output;
|
||||||
netif->mtu = 1500;
|
netif->mtu = 1500;
|
||||||
/* hardware address length */
|
/* hardware address length */
|
||||||
netif->hwaddr_len = 6;
|
netif->hwaddr_len = 6;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user