net/sockopt: change the socket option style from Linux to BSD
Linux Programmer's Manual ... IP(7) ... NOTES ... Using the SOL_IP socket options level isn't portable; BSD-based stacks use the IPPROTO_IP level. Change-Id: I143477d8884dd44913c5685028ee62854e4c11ac Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
parent
7650a3c71c
commit
24407f16f5
@ -335,7 +335,7 @@ int main(int argc, FAR char *argv[])
|
||||
memcpy(mrec.ipv6mr_multiaddr.s6_addr16, g_grp_addr, sizeof(struct in6_addr));
|
||||
mrec.ipv6mr_interface = if_nametoindex("eth0");
|
||||
|
||||
ret = setsockopt(sockfd, SOL_IPV6, IPV6_JOIN_GROUP, (FAR void *)&mrec,
|
||||
ret = setsockopt(sockfd, IPPROTO_IPV6, IPV6_JOIN_GROUP, (FAR void *)&mrec,
|
||||
sizeof(struct ipv6_mreq));
|
||||
if (ret < 0)
|
||||
{
|
||||
@ -438,7 +438,7 @@ int main(int argc, FAR char *argv[])
|
||||
/* Leave the group */
|
||||
|
||||
printf("Leave group...\n");
|
||||
ret = setsockopt(sockfd, SOL_IPV6, IPV6_LEAVE_GROUP, (FAR void *)&mrec,
|
||||
ret = setsockopt(sockfd, IPPROTO_IPV6, IPV6_LEAVE_GROUP, (FAR void *)&mrec,
|
||||
sizeof(struct ipv6_mreq));
|
||||
if (ret < 0)
|
||||
{
|
||||
|
@ -114,7 +114,7 @@ static int lo_client(void)
|
||||
tv.tv_sec = 5;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
ret = setsockopt(sockfd, SOL_TCP, TCP_KEEPIDLE, &tv, sizeof(struct timeval));
|
||||
ret = setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPIDLE, &tv, sizeof(struct timeval));
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = -errno;
|
||||
@ -125,7 +125,7 @@ static int lo_client(void)
|
||||
tv.tv_sec = 1;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
ret = setsockopt(sockfd, SOL_TCP, TCP_KEEPINTVL, &tv, sizeof(struct timeval));
|
||||
ret = setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPINTVL, &tv, sizeof(struct timeval));
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = -errno;
|
||||
@ -134,7 +134,7 @@ static int lo_client(void)
|
||||
}
|
||||
|
||||
value = 3;
|
||||
ret = setsockopt(sockfd, SOL_TCP, TCP_KEEPCNT, &value, sizeof(int));
|
||||
ret = setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPCNT, &value, sizeof(int));
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = -errno;
|
||||
|
@ -467,7 +467,7 @@ FAR void *dhcpc_open(FAR const char *interface, FAR const void *macaddr,
|
||||
* by definition and purpose of DHCP, undefined yet).
|
||||
*/
|
||||
|
||||
ret = setsockopt(pdhcpc->sockfd, SOL_UDP, UDP_BINDTODEVICE,
|
||||
ret = setsockopt(pdhcpc->sockfd, IPPROTO_UDP, UDP_BINDTODEVICE,
|
||||
pdhcpc->interface, strlen(pdhcpc->interface));
|
||||
if (ret < 0)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user