mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-06-01 23:53:26 +08:00
Major stylo search/replace for "One space between keyword and opening bracket."
This commit is contained in:
@@ -58,11 +58,11 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
||||
|
||||
type = ((char *)p->payload)[0];
|
||||
|
||||
switch(type) {
|
||||
switch (type) {
|
||||
case ICMP6_ECHO:
|
||||
DEBUGF(ICMP_DEBUG, ("icmp_input: ping\n"));
|
||||
|
||||
if(p->tot_len < sizeof(struct icmp_echo_hdr)) {
|
||||
if (p->tot_len < sizeof(struct icmp_echo_hdr)) {
|
||||
DEBUGF(ICMP_DEBUG, ("icmp_input: bad ICMP echo received\n"));
|
||||
|
||||
pbuf_free(p);
|
||||
@@ -74,7 +74,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
||||
}
|
||||
iecho = p->payload;
|
||||
iphdr = (struct ip_hdr *)((char *)p->payload - IP_HLEN);
|
||||
if(inet_chksum_pbuf(p) != 0) {
|
||||
if (inet_chksum_pbuf(p) != 0) {
|
||||
DEBUGF(ICMP_DEBUG, ("icmp_input: checksum failed for received ICMP echo (%x)\n", inet_chksum_pseudo(p, &(iphdr->src), &(iphdr->dest), IP_PROTO_ICMP, p->tot_len)));
|
||||
|
||||
#ifdef ICMP_STATS
|
||||
@@ -88,7 +88,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
||||
ip_addr_set(&(iphdr->dest), &tmpaddr);
|
||||
iecho->type = ICMP6_ER;
|
||||
/* adjust the checksum */
|
||||
if(iecho->chksum >= htons(0xffff - (ICMP6_ECHO << 8))) {
|
||||
if (iecho->chksum >= htons(0xffff - (ICMP6_ECHO << 8))) {
|
||||
iecho->chksum += htons(ICMP6_ECHO << 8) + 1;
|
||||
} else {
|
||||
iecho->chksum += htons(ICMP6_ECHO << 8);
|
||||
@@ -99,7 +99,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
||||
#endif /* ICMP_STATS */
|
||||
|
||||
/* DEBUGF("icmp: p->len %d p->tot_len %d\n", p->len, p->tot_len);*/
|
||||
ip_output_if(p, &(iphdr->src), IP_HDRINCL,
|
||||
ip_output_if (p, &(iphdr->src), IP_HDRINCL,
|
||||
iphdr->hoplim, IP_PROTO_ICMP, inp);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -77,7 +77,7 @@ ip_route(struct ip_addr *dest)
|
||||
struct netif *netif;
|
||||
|
||||
for(netif = netif_list; netif != NULL; netif = netif->next) {
|
||||
if(ip_addr_maskcmp(dest, &(netif->ip_addr), &(netif->netmask))) {
|
||||
if (ip_addr_maskcmp(dest, &(netif->ip_addr), &(netif->netmask))) {
|
||||
return netif;
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,7 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr)
|
||||
|
||||
PERF_START;
|
||||
|
||||
if((netif = ip_route((struct ip_addr *)&(iphdr->dest))) == NULL) {
|
||||
if ((netif = ip_route((struct ip_addr *)&(iphdr->dest))) == NULL) {
|
||||
|
||||
DEBUGF(IP_DEBUG, ("ip_input: no forwarding route found for "));
|
||||
#if IP_DEBUG
|
||||
@@ -110,9 +110,9 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr)
|
||||
return;
|
||||
}
|
||||
/* Decrement TTL and send ICMP if ttl == 0. */
|
||||
if(--iphdr->hoplim == 0) {
|
||||
if (--iphdr->hoplim == 0) {
|
||||
/* Don't send ICMP messages in response to ICMP messages */
|
||||
if(iphdr->nexthdr != IP_PROTO_ICMP) {
|
||||
if (iphdr->nexthdr != IP_PROTO_ICMP) {
|
||||
icmp_time_exceeded(p, ICMP_TE_TTL);
|
||||
}
|
||||
pbuf_free(p);
|
||||
@@ -174,7 +174,7 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
||||
iphdr = p->payload;
|
||||
|
||||
|
||||
if(iphdr->v != 6) {
|
||||
if (iphdr->v != 6) {
|
||||
DEBUGF(IP_DEBUG, ("IP packet dropped due to bad version number\n"));
|
||||
#if IP_DEBUG
|
||||
ip_debug_print(p);
|
||||
@@ -196,13 +196,13 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
||||
ip_addr_debug_print(&(netif->ip_addr));
|
||||
DEBUGF(IP_DEBUG, ("\n"));
|
||||
#endif /* IP_DEBUG */
|
||||
if(ip_addr_cmp(&(iphdr->dest), &(netif->ip_addr))) {
|
||||
if (ip_addr_cmp(&(iphdr->dest), &(netif->ip_addr))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(netif == NULL) {
|
||||
if (netif == NULL) {
|
||||
/* packet not for us, route or discard */
|
||||
#ifdef IP_FORWARD
|
||||
ip_forward(p, iphdr);
|
||||
@@ -223,7 +223,7 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
||||
|
||||
pbuf_header(p, -IP_HLEN);
|
||||
|
||||
switch(iphdr->nexthdr) {
|
||||
switch (iphdr->nexthdr) {
|
||||
case IP_PROTO_UDP:
|
||||
udp_input(p);
|
||||
break;
|
||||
@@ -258,7 +258,7 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
err_t
|
||||
ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||
ip_output_if (struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||
u8_t ttl,
|
||||
u8_t proto, struct netif *netif)
|
||||
{
|
||||
@@ -267,7 +267,7 @@ ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||
PERF_START;
|
||||
|
||||
printf("len %u tot_len %u\n", p->len, p->tot_len);
|
||||
if(pbuf_header(p, IP_HLEN)) {
|
||||
if (pbuf_header(p, IP_HLEN)) {
|
||||
DEBUGF(IP_DEBUG, ("ip_output: not enough room for IP header in pbuf\n"));
|
||||
#ifdef IP_STATS
|
||||
++lwip_stats.ip.err;
|
||||
@@ -280,7 +280,7 @@ ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||
iphdr = p->payload;
|
||||
|
||||
|
||||
if(dest != IP_HDRINCL) {
|
||||
if (dest != IP_HDRINCL) {
|
||||
printf("!IP_HDRLINCL\n");
|
||||
iphdr->hoplim = ttl;
|
||||
iphdr->nexthdr = proto;
|
||||
@@ -289,7 +289,7 @@ ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||
|
||||
iphdr->v = 6;
|
||||
|
||||
if(ip_addr_isany(src)) {
|
||||
if (ip_addr_isany(src)) {
|
||||
ip_addr_set(&(iphdr->src), &(netif->ip_addr));
|
||||
} else {
|
||||
ip_addr_set(&(iphdr->src), src);
|
||||
@@ -323,7 +323,7 @@ ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||
u8_t ttl, u8_t proto)
|
||||
{
|
||||
struct netif *netif;
|
||||
if((netif = ip_route(dest)) == NULL) {
|
||||
if ((netif = ip_route(dest)) == NULL) {
|
||||
DEBUGF(IP_DEBUG, ("ip_output: No route to 0x%lx\n", dest->addr));
|
||||
#ifdef IP_STATS
|
||||
++lwip_stats.ip.rterr;
|
||||
@@ -331,7 +331,7 @@ ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||
return ERR_RTE;
|
||||
}
|
||||
|
||||
return ip_output_if(p, src, dest, ttl, proto, netif);
|
||||
return ip_output_if (p, src, dest, ttl, proto, netif);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
#if IP_DEBUG
|
||||
|
||||
@@ -67,7 +67,7 @@ ip_addr_set(struct ip_addr *dest, struct ip_addr *src)
|
||||
int
|
||||
ip_addr_isany(struct ip_addr *addr)
|
||||
{
|
||||
if(addr == NULL) return 1;
|
||||
if (addr == NULL) return 1;
|
||||
return((addr->addr[0] | addr->addr[1] | addr->addr[2] | addr->addr[3]) == 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user