Minor coding style changes

This commit is contained in:
goldsimon 2007-11-28 21:44:17 +00:00
parent 1b07fecbf3
commit 788892ee7c

View File

@ -173,7 +173,8 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
* processed, but currently always returns ERR_OK) * processed, but currently always returns ERR_OK)
*/ */
err_t err_t
ip_input(struct pbuf *p, struct netif *inp) { ip_input(struct pbuf *p, struct netif *inp)
{
struct ip_hdr *iphdr; struct ip_hdr *iphdr;
struct netif *netif; struct netif *netif;
u16_t iphdrlen; u16_t iphdrlen;
@ -229,19 +230,16 @@ ip_input(struct pbuf *p, struct netif *inp) {
/* match packet against an interface, i.e. is this packet for us? */ /* match packet against an interface, i.e. is this packet for us? */
#if LWIP_IGMP #if LWIP_IGMP
if (ip_addr_ismulticast(&(iphdr->dest))) if (ip_addr_ismulticast(&(iphdr->dest))) {
{ if ((inp->flags & NETIF_FLAG_IGMP) && (igmp_lookfor_group( inp, &(iphdr->dest)))) if ((inp->flags & NETIF_FLAG_IGMP) && (igmp_lookfor_group(inp, &(iphdr->dest)))) {
{ netif = inp; netif = inp;
} else {
netif = NULL;
} }
else } else
{ netif = NULL;
}
}
else
{
#endif /* LWIP_IGMP */ #endif /* LWIP_IGMP */
{
for (netif = netif_list; netif != NULL; netif = netif->next) { for (netif = netif_list; netif != NULL; netif = netif->next) {
LWIP_DEBUGF(IP_DEBUG, ("ip_input: iphdr->dest 0x%"X32_F" netif->ip_addr 0x%"X32_F" (0x%"X32_F", 0x%"X32_F", 0x%"X32_F")\n", LWIP_DEBUGF(IP_DEBUG, ("ip_input: iphdr->dest 0x%"X32_F" netif->ip_addr 0x%"X32_F" (0x%"X32_F", 0x%"X32_F", 0x%"X32_F")\n",
iphdr->dest.addr, netif->ip_addr.addr, iphdr->dest.addr, netif->ip_addr.addr,
iphdr->dest.addr & netif->netmask.addr, iphdr->dest.addr & netif->netmask.addr,
@ -249,8 +247,7 @@ ip_input(struct pbuf *p, struct netif *inp) {
iphdr->dest.addr & ~(netif->netmask.addr))); iphdr->dest.addr & ~(netif->netmask.addr)));
/* interface is up and configured? */ /* interface is up and configured? */
if ((netif_is_up(netif)) && (!ip_addr_isany(&(netif->ip_addr)))) if ((netif_is_up(netif)) && (!ip_addr_isany(&(netif->ip_addr)))) {
{
/* unicast to this interface address? */ /* unicast to this interface address? */
if (ip_addr_cmp(&(iphdr->dest), &(netif->ip_addr)) || if (ip_addr_cmp(&(iphdr->dest), &(netif->ip_addr)) ||
/* or broadcast on this interface network address? */ /* or broadcast on this interface network address? */
@ -262,9 +259,7 @@ ip_input(struct pbuf *p, struct netif *inp) {
} }
} }
} }
#if LWIP_IGMP
} }
#endif /* LWIP_IGMP */
#if LWIP_DHCP #if LWIP_DHCP
/* Pass DHCP messages regardless of destination address. DHCP traffic is addressed /* Pass DHCP messages regardless of destination address. DHCP traffic is addressed
@ -292,8 +287,7 @@ ip_input(struct pbuf *p, struct netif *inp) {
if (!ip_addr_isbroadcast(&(iphdr->dest), inp)) { if (!ip_addr_isbroadcast(&(iphdr->dest), inp)) {
/* try to forward IP packet on (other) interfaces */ /* try to forward IP packet on (other) interfaces */
ip_forward(p, iphdr, inp); ip_forward(p, iphdr, inp);
} } else
else
#endif /* IP_FORWARD */ #endif /* IP_FORWARD */
{ {
snmp_inc_ipinaddrerrors(); snmp_inc_ipinaddrerrors();
@ -351,8 +345,9 @@ ip_input(struct pbuf *p, struct netif *inp) {
#if LWIP_RAW #if LWIP_RAW
/* raw input did not eat the packet? */ /* raw input did not eat the packet? */
if (raw_input(p, inp) == 0) { if (raw_input(p, inp) == 0)
#endif /* LWIP_RAW */ #endif /* LWIP_RAW */
{
switch (IPH_PROTO(iphdr)) { switch (IPH_PROTO(iphdr)) {
#if LWIP_UDP #if LWIP_UDP
@ -398,9 +393,8 @@ ip_input(struct pbuf *p, struct netif *inp) {
IP_STATS_INC(ip.drop); IP_STATS_INC(ip.drop);
snmp_inc_ipinunknownprotos(); snmp_inc_ipinunknownprotos();
} }
#if LWIP_RAW }
} /* LWIP_RAW */
#endif
return ERR_OK; return ERR_OK;
} }