mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-23 06:35:57 +00:00
Minor: coding style cleanups...
This commit is contained in:
parent
d74464e091
commit
a375ea4ee2
|
@ -1721,9 +1721,9 @@ lwip_getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen)
|
||||||
break;
|
break;
|
||||||
/* UNDEFINED LEVEL */
|
/* UNDEFINED LEVEL */
|
||||||
default:
|
default:
|
||||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, level=0x%x, UNIMPL: optname=0x%x, ..)\n",
|
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, level=0x%x, UNIMPL: optname=0x%x, ..)\n",
|
||||||
s, level, optname));
|
s, level, optname));
|
||||||
err = ENOPROTOOPT;
|
err = ENOPROTOOPT;
|
||||||
} /* switch */
|
} /* switch */
|
||||||
|
|
||||||
|
|
||||||
|
@ -1976,10 +1976,11 @@ lwip_getsockopt_internal(void *arg)
|
||||||
switch (optname) {
|
switch (optname) {
|
||||||
#if LWIP_IPV6
|
#if LWIP_IPV6
|
||||||
case IPV6_CHECKSUM:
|
case IPV6_CHECKSUM:
|
||||||
if (sock->conn->pcb.raw->chksum_reqd == 0)
|
if (sock->conn->pcb.raw->chksum_reqd == 0) {
|
||||||
*(int *)optval = -1;
|
*(int *)optval = -1;
|
||||||
else
|
} else {
|
||||||
*(int *)optval = sock->conn->pcb.raw->chksum_offset;
|
*(int *)optval = sock->conn->pcb.raw->chksum_offset;
|
||||||
|
}
|
||||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_RAW, IPV6_CHECKSUM) = %d\n",
|
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_RAW, IPV6_CHECKSUM) = %d\n",
|
||||||
s, (*(int*)optval)) );
|
s, (*(int*)optval)) );
|
||||||
break;
|
break;
|
||||||
|
@ -1988,7 +1989,7 @@ lwip_getsockopt_internal(void *arg)
|
||||||
LWIP_ASSERT("unhandled optname", 0);
|
LWIP_ASSERT("unhandled optname", 0);
|
||||||
break;
|
break;
|
||||||
} /* switch (optname) */
|
} /* switch (optname) */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LWIP_ASSERT("unhandled level", 0);
|
LWIP_ASSERT("unhandled level", 0);
|
||||||
break;
|
break;
|
||||||
|
@ -2159,28 +2160,29 @@ lwip_setsockopt(int s, int level, int optname, const void *optval, socklen_t opt
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @todo: this does not work for datagram sockets, yet */
|
/* @todo: this does not work for datagram sockets, yet */
|
||||||
if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) != NETCONN_TCP)
|
if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) != NETCONN_TCP) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case IPV6_CHECKSUM:
|
case IPV6_CHECKSUM:
|
||||||
err = EINVAL;
|
err = EINVAL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_IPV6, UNIMPL: optname=0x%x, ..)\n",
|
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_IPV6, UNIMPL: optname=0x%x, ..)\n",
|
||||||
s, optname));
|
s, optname));
|
||||||
err = ENOPROTOOPT;
|
err = ENOPROTOOPT;
|
||||||
} /* switch (optname) */
|
} /* switch (optname) */
|
||||||
break;
|
break;
|
||||||
case IPPROTO_ICMPV6:
|
case IPPROTO_ICMPV6:
|
||||||
switch (optname) {
|
switch (optname) {
|
||||||
case IPV6_CHECKSUM:
|
case IPV6_CHECKSUM:
|
||||||
err = EINVAL;
|
err = EINVAL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_ICMPV6, UNIMPL: optname=0x%x, ..)\n",
|
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_ICMPV6, UNIMPL: optname=0x%x, ..)\n",
|
||||||
s, optname));
|
s, optname));
|
||||||
err = ENOPROTOOPT;
|
err = ENOPROTOOPT;
|
||||||
} /* switch (optname) */
|
} /* switch (optname) */
|
||||||
break;
|
break;
|
||||||
#endif /* LWIP_IPV6 */
|
#endif /* LWIP_IPV6 */
|
||||||
|
@ -2194,8 +2196,9 @@ lwip_setsockopt(int s, int level, int optname, const void *optval, socklen_t opt
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If this is no UDP lite socket, ignore any options. */
|
/* If this is no UDP lite socket, ignore any options. */
|
||||||
if (!NETCONNTYPE_ISUDPLITE(netconn_type(sock->conn)))
|
if (!NETCONNTYPE_ISUDPLITE(netconn_type(sock->conn))) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
switch (optname) {
|
switch (optname) {
|
||||||
case UDPLITE_SEND_CSCOV:
|
case UDPLITE_SEND_CSCOV:
|
||||||
|
@ -2215,16 +2218,17 @@ lwip_setsockopt(int s, int level, int optname, const void *optval, socklen_t opt
|
||||||
#if LWIP_IPV6
|
#if LWIP_IPV6
|
||||||
case IPV6_CHECKSUM:
|
case IPV6_CHECKSUM:
|
||||||
/* Per RFC3542, odd offsets are not allowed */
|
/* Per RFC3542, odd offsets are not allowed */
|
||||||
if ((*(int *)optval > 0) && (*(int *)optval & 1))
|
if ((*(int *)optval > 0) && (*(int *)optval & 1)) {
|
||||||
err = EINVAL;
|
err = EINVAL;
|
||||||
break;
|
}
|
||||||
|
break;
|
||||||
#endif /* LWIP_IPV6 */
|
#endif /* LWIP_IPV6 */
|
||||||
default:
|
default:
|
||||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_RAW, UNIMPL: optname=0x%x, ..)\n",
|
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_RAW, UNIMPL: optname=0x%x, ..)\n",
|
||||||
s, optname));
|
s, optname));
|
||||||
err = ENOPROTOOPT;
|
err = ENOPROTOOPT;
|
||||||
} /* switch (optname) */
|
} /* switch (optname) */
|
||||||
break;
|
break;
|
||||||
/* UNDEFINED LEVEL */
|
/* UNDEFINED LEVEL */
|
||||||
default:
|
default:
|
||||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, level=0x%x, UNIMPL: optname=0x%x, ..)\n",
|
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, level=0x%x, UNIMPL: optname=0x%x, ..)\n",
|
||||||
|
|
|
@ -315,12 +315,12 @@ raw_sendto(struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *ipaddr)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LWIP_IPV6
|
#if LWIP_IPV6
|
||||||
/* If requested, based on the IPV6_CHECKSUM socket option per RFC3542, */
|
/* If requested, based on the IPV6_CHECKSUM socket option per RFC3542,
|
||||||
/* compute the checksum and update the checksum in the payload. */
|
compute the checksum and update the checksum in the payload. */
|
||||||
if (PCB_ISIPV6(pcb) && pcb->chksum_reqd) {
|
if (PCB_ISIPV6(pcb) && pcb->chksum_reqd) {
|
||||||
u16_t chksum;
|
u16_t chksum;
|
||||||
chksum = ip6_chksum_pseudo(q, pcb->protocol, q->tot_len, ipX_2_ip6(src_ip), ipX_2_ip6(dst_ip));
|
chksum = ip6_chksum_pseudo(q, pcb->protocol, q->tot_len, ipX_2_ip6(src_ip), ipX_2_ip6(dst_ip));
|
||||||
*(u16_t *)(((u8_t *)q->payload) + pcb->chksum_offset) = chksum;
|
*(u16_t *)(((u8_t *)q->payload) + pcb->chksum_offset) = chksum;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -99,8 +99,8 @@ struct raw_pcb {
|
||||||
void *recv_arg;
|
void *recv_arg;
|
||||||
#if LWIP_IPV6
|
#if LWIP_IPV6
|
||||||
/* fields for handling checksum computations as per RFC3542. */
|
/* fields for handling checksum computations as per RFC3542. */
|
||||||
u8_t chksum_reqd;
|
|
||||||
u16_t chksum_offset;
|
u16_t chksum_offset;
|
||||||
|
u8_t chksum_reqd;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user