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;
|
||||
while (dp != NULL) {
|
||||
now = sys_now();
|
||||
|
||||
|
||||
if (dp->time <= now) {
|
||||
delif->input(dp->p, netif);
|
||||
if (dp->next != NULL) {
|
||||
if (dp->next->time > now) {
|
||||
timeout = dp->next->time - now;
|
||||
} else {
|
||||
timeout = 0;
|
||||
}
|
||||
LWIP_DEBUGF(DELIF_DEBUG, ("delif_output_timeout: timeout %u.\n", timeout));
|
||||
if (dp->next->time > now) {
|
||||
timeout = dp->next->time - now;
|
||||
} else {
|
||||
timeout = 0;
|
||||
}
|
||||
LWIP_DEBUGF(DELIF_DEBUG, ("delif_output_timeout: timeout %u.\n", timeout));
|
||||
|
||||
}
|
||||
input_list = dp->next;
|
||||
|
@ -122,26 +122,26 @@ delif_output_timeout(void *arg)
|
|||
|
||||
netif = arg;
|
||||
delif = netif->state;
|
||||
|
||||
|
||||
/* Check if there is anything on the output list. */
|
||||
dp = output_list;
|
||||
while (dp != NULL) {
|
||||
now = sys_now();
|
||||
if (dp->time <= now) {
|
||||
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);
|
||||
if (dp->next != NULL) {
|
||||
if (dp->next->time > now) {
|
||||
timeout = dp->next->time - now;
|
||||
} else {
|
||||
timeout = 0;
|
||||
}
|
||||
LWIP_DEBUGF(DELIF_DEBUG, ("delif_output_timeout: timeout %u.\n", timeout));
|
||||
|
||||
if (dp->next->time > now) {
|
||||
timeout = dp->next->time - now;
|
||||
} else {
|
||||
timeout = 0;
|
||||
}
|
||||
LWIP_DEBUGF(DELIF_DEBUG, ("delif_output_timeout: timeout %u.\n", timeout));
|
||||
|
||||
}
|
||||
pbuf_free(dp->p);
|
||||
|
||||
|
||||
output_list = dp->next;
|
||||
free(dp);
|
||||
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
|
||||
pcapif_output(struct netif *netif, struct pbuf *p,
|
||||
ip_addr_t *ipaddr)
|
||||
pcapif_output(struct netif *netif, struct pbuf *p, ip_addr_t *ipaddr)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
@ -107,15 +106,15 @@ timeout(void *arg)
|
|||
|
||||
if (p != NULL) {
|
||||
/* 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;
|
||||
for(q = p; q != NULL; q = q->next) {
|
||||
/* Read enough bytes to fill this pbuf in the chain. The
|
||||
available data in the pbuf is given by the q->len
|
||||
variable. */
|
||||
/* read data into(q->payload, q->len); */
|
||||
bcopy(bufptr, q->payload, q->len);
|
||||
bufptr += q->len;
|
||||
/* Read enough bytes to fill this pbuf in the chain. The
|
||||
available data in the pbuf is given by the q->len
|
||||
variable. */
|
||||
/* read data into(q->payload, q->len); */
|
||||
bcopy(bufptr, q->payload, q->len);
|
||||
bufptr += q->len;
|
||||
}
|
||||
|
||||
#if defined(LWIP_DEBUG) && defined(LWIP_TCPDUMP)
|
||||
|
@ -124,17 +123,24 @@ timeout(void *arg)
|
|||
|
||||
ethhdr = p->payload;
|
||||
switch (htons(ethhdr->type)) {
|
||||
/* IP or ARP packet? */
|
||||
case ETHTYPE_IP:
|
||||
etharp_ip_input(netif, p);
|
||||
pbuf_header(p, -14);
|
||||
netif->input(p, netif);
|
||||
break;
|
||||
case ETHTYPE_ARP:
|
||||
etharp_arp_input(netif, pcapif->ethaddr, p);
|
||||
break;
|
||||
default:
|
||||
pbuf_free(p);
|
||||
break;
|
||||
#if PPPOE_SUPPORT
|
||||
/* 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;
|
||||
default:
|
||||
pbuf_free(p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -289,22 +289,20 @@ tapif_input(struct netif *netif)
|
|||
ethhdr = p->payload;
|
||||
|
||||
switch(htons(ethhdr->type)) {
|
||||
/* IP or ARP packet? */
|
||||
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:
|
||||
LWIP_DEBUGF(TAPIF_DEBUG, ("tapif_input: ARP packet\n"));
|
||||
etharp_arp_input(netif, tapif->ethaddr, p);
|
||||
#if PPPOE_SUPPORT
|
||||
/* 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;
|
||||
default:
|
||||
pbuf_free(p);
|
||||
|
@ -334,7 +332,7 @@ tapif_init(struct netif *netif)
|
|||
netif->name[1] = IFNAME1;
|
||||
netif->output = etharp_output;
|
||||
netif->linkoutput = low_level_output;
|
||||
netif->mtu = 1500;
|
||||
netif->mtu = 1500;
|
||||
/* hardware address length */
|
||||
netif->hwaddr_len = 6;
|
||||
|
||||
|
|
Loading…
Reference in New Issue