all: Removes unnecessary newline character in logs

Closes https://github.com/espressif/esp-idf/issues/11465
This commit is contained in:
KonstantinKondrashov
2023-06-09 02:56:11 +08:00
parent f875978fb3
commit e72061695e
145 changed files with 754 additions and 763 deletions
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@@ -53,7 +53,7 @@ static socklen_t resolve_v6addr(char *addr_str_i, struct sockaddr_in6 *addr_o)
// Resolve source using getaddrinfo().
if (0 != getaddrinfo(addr_str_i, NULL, &hints, &res)) {
ESP_LOGE(TAG, "getaddrinfo(): Could not resolve address, got error: %d\n", errno);
ESP_LOGE(TAG, "getaddrinfo(): Could not resolve address, got error: %d", errno);
return 0;
}
@@ -94,13 +94,13 @@ static void send_ping(char *src_addr_str, char *dst_addr_str, char *interface)
// Resolve source address.
if (0 == (srclen = resolve_v6addr(src_addr_str, &src))) {
ESP_LOGE(TAG, "resolve_v6addr(): Source address error\n");
ESP_LOGE(TAG, "resolve_v6addr(): Source address error");
return;
}
// Resolve destination address.
if (0 == resolve_v6addr(dst_addr_str, &dst)) {
ESP_LOGE(TAG, "resolve_v6addr(): Destination address error\n");
ESP_LOGE(TAG, "resolve_v6addr(): Destination address error");
return;
}
@@ -145,34 +145,34 @@ static void send_ping(char *src_addr_str, char *dst_addr_str, char *interface)
// Request a socket descriptor sd.
if ((sd = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) < 0) {
ESP_LOGE(TAG, "Failed to get socket descriptor.: %d\n", errno);
ESP_LOGE(TAG, "Failed to get socket descriptor.: %d", errno);
return;
}
// Bind the socket descriptor to the source address.
if (bind(sd, (struct sockaddr *)&src, srclen) != 0) {
ESP_LOGE(TAG, "Failed to bind the socket descriptor to the source address.: %d\n", errno);
ESP_LOGE(TAG, "Failed to bind the socket descriptor to the source address.: %d", errno);
return;
}
// Bind socket to interface index.
strcpy(ifr.ifr_name, interface);
if (setsockopt(sd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr)) < 0) {
ESP_LOGE(TAG, "setsockopt() failed to bind to interface: %d\n", errno);
ESP_LOGE(TAG, "setsockopt() failed to bind to interface: %d", errno);
return;
}
// Send packet.
int ret = 0;
if ((ret = sendmsg(sd, &msghdr, 0)) < 0) {
ESP_LOGE(TAG, "sendmsg() failed: %d\n", errno);
ESP_LOGE(TAG, "sendmsg() failed: %d", errno);
return;
}
free(msghdr.msg_control);
ESP_LOGI(TAG, "ICMPv6 msg payload:");
ESP_LOG_BUFFER_HEXDUMP(TAG, &(psdhdr[IP6_HLEN]), ICMP6_HLEN + datalen, ESP_LOG_INFO);
ESP_LOGI(TAG, "Sent ICMPv6 msg: type: %d, code: %d, id: %d, seqno: %d\n",
ESP_LOGI(TAG, "Sent ICMPv6 msg: type: %d, code: %d, id: %d, seqno: %d",
icmphdr->type,
icmphdr->code,
icmphdr->id,
@@ -199,13 +199,13 @@ static void send_ping(char *src_addr_str, char *dst_addr_str, char *interface)
icmphdr = (struct icmp6_echo_hdr *)(inpack + IP6_HLEN);
while (ICMP6_TYPE_EREP != icmphdr->type) {
if ((len = recvmsg(sd, &msghdr, 0)) < 0) {
ESP_LOGE(TAG, "recvmsg() failed: %d\n", errno);
ESP_LOGE(TAG, "recvmsg() failed: %d", errno);
return;
}
ESP_LOGI(TAG, "ICMPv6 msg payload:");
ESP_LOG_BUFFER_HEXDUMP(TAG, inpack, IP6_HLEN + ICMP6_HLEN + datalen, ESP_LOG_INFO);
ESP_LOGI(TAG, "Received ICMPv6 msg: type: %d, code: %d, id: %d, seqno: %d\n",
ESP_LOGI(TAG, "Received ICMPv6 msg: type: %d, code: %d, id: %d, seqno: %d",
icmphdr->type,
icmphdr->code,
icmphdr->id,
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@@ -192,7 +192,7 @@ void tcp_client(void)
ESP_LOGI(TAG, "Socket created, connecting to %s:%d", host_ip, PORT);
if (0 != get_src_iface(interface)) {
ESP_LOGE(TAG, "Interface: Unavailable\n");
ESP_LOGE(TAG, "Interface: Unavailable");
break;
}
@@ -205,7 +205,7 @@ void tcp_client(void)
}
#if defined(CONFIG_EXAMPLE_IPV6)
dest_addr.sin6_scope_id = ifr.ifr_ifindex;
ESP_LOGI(TAG, "Interface index: %d\n", dest_addr.sin6_scope_id);
ESP_LOGI(TAG, "Interface index: %d", dest_addr.sin6_scope_id);
#endif
#else
if (NULL == (netif = get_esp_netif_from_iface(interface))) {
@@ -214,7 +214,7 @@ void tcp_client(void)
}
#if defined(CONFIG_EXAMPLE_IPV6)
dest_addr.sin6_scope_id = esp_netif_get_netif_impl_index(netif);
ESP_LOGI(TAG, "Interface index: %d\n", dest_addr.sin6_scope_id);
ESP_LOGI(TAG, "Interface index: %d", dest_addr.sin6_scope_id);
#endif
#endif
@@ -125,7 +125,7 @@ static void udp_server_task(void *pvParameters)
if ( cmsgtmp->cmsg_level == IPPROTO_IP && cmsgtmp->cmsg_type == IP_PKTINFO ) {
struct in_pktinfo *pktinfo;
pktinfo = (struct in_pktinfo*)CMSG_DATA(cmsgtmp);
ESP_LOGI(TAG, "dest ip: %s\n", inet_ntoa(pktinfo->ipi_addr));
ESP_LOGI(TAG, "dest ip: %s", inet_ntoa(pktinfo->ipi_addr));
}
}
#endif