netlib: fix nxstyle issue for netlink related code
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
63157f3a4d
commit
95efbf7e62
@ -144,7 +144,7 @@ ssize_t netlib_get_arptable(FAR struct arp_entry_s *arptab,
|
||||
addr.nl_groups = 0;
|
||||
|
||||
ret = bind(fd, (FAR const struct sockaddr *)&addr,
|
||||
sizeof( struct sockaddr_nl));
|
||||
sizeof(struct sockaddr_nl));
|
||||
if (ret < 0)
|
||||
{
|
||||
int errcode = errno;
|
||||
@ -195,17 +195,17 @@ ssize_t netlib_get_arptable(FAR struct arp_entry_s *arptab,
|
||||
goto errout_with_socket;
|
||||
}
|
||||
|
||||
/* The sequence number in the response should match the sequence
|
||||
* number in the request (since we created the socket, this should
|
||||
* always be true).
|
||||
*/
|
||||
/* The sequence number in the response should match the sequence
|
||||
* number in the request (since we created the socket, this should
|
||||
* always be true).
|
||||
*/
|
||||
|
||||
if (resp->hdr.nlmsg_seq != thiseq)
|
||||
{
|
||||
if (resp->hdr.nlmsg_seq != thiseq)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Bad sequence number in response\n");
|
||||
ret = -EIO;
|
||||
goto errout_with_socket;
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy the ARP table data to the caller's buffer */
|
||||
|
||||
|
@ -132,7 +132,7 @@ ssize_t netlib_get_devices(FAR struct netlib_device_s *devlist,
|
||||
addr.nl_groups = 0;
|
||||
|
||||
ret = bind(fd, (FAR const struct sockaddr *)&addr,
|
||||
sizeof( struct sockaddr_nl));
|
||||
sizeof(struct sockaddr_nl));
|
||||
if (ret < 0)
|
||||
{
|
||||
int errcode = errno;
|
||||
@ -203,7 +203,9 @@ ssize_t netlib_get_devices(FAR struct netlib_device_s *devlist,
|
||||
|
||||
switch (resp.hdr.nlmsg_type)
|
||||
{
|
||||
/* NLMSG_DONE means that the entire list of devices has been returned */
|
||||
/* NLMSG_DONE means that the entire list of devices has been
|
||||
* returned
|
||||
*/
|
||||
|
||||
case NLMSG_DONE:
|
||||
enddump = true;
|
||||
@ -220,7 +222,8 @@ ssize_t netlib_get_devices(FAR struct netlib_device_s *devlist,
|
||||
|
||||
if (nrecvd != sizeof(struct netlib_recvfrom_response_s))
|
||||
{
|
||||
fprintf(stderr, "ERROR: Bad massage size: %ld\n", (long)nrecvd);
|
||||
fprintf(stderr, "ERROR: Bad massage size: %ld\n",
|
||||
(long)nrecvd);
|
||||
goto errout_with_socket;
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ ssize_t netlib_get_nbtable(FAR struct neighbor_entry_s *nbtab,
|
||||
addr.nl_groups = 0;
|
||||
|
||||
ret = bind(fd, (FAR const struct sockaddr *)&addr,
|
||||
sizeof( struct sockaddr_nl));
|
||||
sizeof(struct sockaddr_nl));
|
||||
if (ret < 0)
|
||||
{
|
||||
int errcode = errno;
|
||||
@ -196,17 +196,17 @@ ssize_t netlib_get_nbtable(FAR struct neighbor_entry_s *nbtab,
|
||||
goto errout_with_socket;
|
||||
}
|
||||
|
||||
/* The sequence number in the response should match the sequence
|
||||
* number in the request (since we created the socket, this should
|
||||
* always be true).
|
||||
*/
|
||||
/* The sequence number in the response should match the sequence
|
||||
* number in the request (since we created the socket, this should
|
||||
* always be true).
|
||||
*/
|
||||
|
||||
if (resp->hdr.nlmsg_seq != thiseq)
|
||||
{
|
||||
if (resp->hdr.nlmsg_seq != thiseq)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Bad sequence number in response\n");
|
||||
ret = -EIO;
|
||||
goto errout_with_socket;
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy the Neighbor table data to the caller's buffer */
|
||||
|
||||
|
@ -161,7 +161,7 @@ ssize_t netlib_get_route(FAR struct rtentry *rtelist,
|
||||
addr.nl_groups = 0;
|
||||
|
||||
ret = bind(fd, (FAR const struct sockaddr *)&addr,
|
||||
sizeof( struct sockaddr_nl));
|
||||
sizeof(struct sockaddr_nl));
|
||||
if (ret < 0)
|
||||
{
|
||||
int errcode = errno;
|
||||
@ -258,7 +258,8 @@ ssize_t netlib_get_route(FAR struct rtentry *rtelist,
|
||||
if (nrecvd <= sizeof(struct netlib_recvfrom_response_s) ||
|
||||
u.resp.rte.rtm_family != family)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Bad massage size: %ld\n", (long)nrecvd);
|
||||
fprintf(stderr, "ERROR: Bad massage size: %ld\n",
|
||||
(long)nrecvd);
|
||||
goto errout_with_socket;
|
||||
}
|
||||
|
||||
@ -320,8 +321,8 @@ ssize_t netlib_get_route(FAR struct rtentry *rtelist,
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "ERROR: Message type %u, length %lu\n",
|
||||
u.resp.hdr.nlmsg_type, (unsigned long)u.resp.hdr.nlmsg_len);
|
||||
fprintf(stderr, "ERROR: Message type %u, length %u\n",
|
||||
u.resp.hdr.nlmsg_type, (unsigned)u.resp.hdr.nlmsg_len);
|
||||
ret = -EIO;
|
||||
goto errout_with_socket;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user