Commit fc21a76d authored by Johan Hedberg's avatar Johan Hedberg Committed by Anas Nashif
Browse files

net: Fix incorrect logging format specifiers



Fix compilation issues that show up if SYS_LOG is mapped to printk
instead of printf. Unlike printf, printk is annotated so that the
compiler catches incorrect format specifiers passed to it.

Change-Id: Iab7cc6da110e9c98720211a6f773dcf055a3a411
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent d7f8b3e2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ static struct net_buf *udp_recv(const char *name,
	struct net_buf *reply_buf, *frag, *tmp;
	int header_len, recv_len, reply_len;

	NET_INFO("%s received %d bytes", name,
	NET_INFO("%s received %u bytes", name,
	      net_nbuf_appdatalen(buf));

	reply_buf = net_nbuf_get_tx(context);
+1 −1
Original line number Diff line number Diff line
@@ -441,7 +441,7 @@ static void udp_ipv4_received(struct net_context *context,

	if (family == AF_INET) {
		if (expecting_ipv4 != net_nbuf_appdatalen(buf)) {
			NET_ERR("Sent %d bytes, received %d bytes",
			NET_ERR("Sent %d bytes, received %u bytes",
				expecting_ipv4, net_nbuf_appdatalen(buf));
		}

+2 −2
Original line number Diff line number Diff line
@@ -359,7 +359,7 @@ int net_conn_unregister(struct net_conn_handle *handle)
		return -ENOENT;
	}

	NET_DBG("[%d] connection handler %p removed",
	NET_DBG("[%zu] connection handler %p removed",
		(conn - conns) / sizeof(*conn), conn);

	conn->flags = 0;
@@ -380,7 +380,7 @@ int net_conn_change_callback(struct net_conn_handle *handle,
		return -ENOENT;
	}

	NET_DBG("[%d] connection handler %p changed callback",
	NET_DBG("[%zu] connection handler %p changed callback",
		(conn - conns) / sizeof(*conn), conn);

	conn->cb = cb;
+7 −7
Original line number Diff line number Diff line
@@ -864,7 +864,7 @@ static enum net_verdict handle_ns_input(struct net_buf *buf)
	    (NET_ICMP_BUF(buf)->code != 0) ||
	    (NET_IPV6_BUF(buf)->hop_limit != NET_IPV6_ND_HOP_LIMIT) ||
	    net_is_ipv6_addr_mcast(&NET_ICMPV6_NS_BUF(buf)->tgt)) {
		NET_DBG("Preliminary check failed %u/%u, code %u, hop %u",
		NET_DBG("Preliminary check failed %u/%zu, code %u, hop %u",
			total_len, (sizeof(struct net_ipv6_hdr) +
				    sizeof(struct net_icmp_hdr) +
				    sizeof(struct net_icmpv6_ns_hdr)),
@@ -1072,7 +1072,7 @@ static void nd_reachable_timeout(struct k_work *work)
			router = net_if_ipv6_router_lookup(nbr->iface,
							   &data->addr);
			if (router && !router->is_infinite) {
				NET_DBG("nbr %p address %s PROBE ended",
				NET_DBG("nbr %p address %s PROBE ended (%d)",
					nbr, net_sprint_ipv6_addr(&data->addr),
					data->state);

@@ -1677,7 +1677,7 @@ static inline void handle_prefix_onlink(struct net_buf *buf,
					prefix_info->len,
					prefix_info->valid_lifetime);
		if (prefix) {
			NET_DBG("Interface %p add prefix %s/%d lifetime %lu",
			NET_DBG("Interface %p add prefix %s/%d lifetime %u",
				net_nbuf_iface(buf),
				net_sprint_ipv6_addr(&prefix_info->prefix),
				prefix_info->prefix_len,
@@ -1714,7 +1714,7 @@ static inline void handle_prefix_onlink(struct net_buf *buf,
		break;

	default:
		NET_DBG("Interface %p update prefix %s/%d lifetime %lu",
		NET_DBG("Interface %p update prefix %s/%u lifetime %u",
			net_nbuf_iface(buf),
			net_sprint_ipv6_addr(&prefix_info->prefix),
			prefix_info->prefix_len,
@@ -1766,7 +1766,7 @@ static inline void handle_prefix_autonomous(struct net_buf *buf,
		    (prefix_info->valid_lifetime >
		     remaining(&ifaddr->lifetime))) {
			NET_DBG("Timer updating for address %s "
				"long lifetime %lu secs",
				"long lifetime %u secs",
				net_sprint_ipv6_addr(&addr),
				prefix_info->valid_lifetime);

@@ -1774,7 +1774,7 @@ static inline void handle_prefix_autonomous(struct net_buf *buf,
						  prefix_info->valid_lifetime);
		} else {
			NET_DBG("Timer updating for address %s "
				"lifetime %lu secs",
				"lifetime %u secs",
				net_sprint_ipv6_addr(&addr), TWO_HOURS);

			net_if_ipv6_addr_update_lifetime(ifaddr, TWO_HOURS);
@@ -1974,7 +1974,7 @@ static enum net_verdict handle_ra_input(struct net_buf *buf)

			if (mtu > 0xffff) {
				/* TODO: discard packet? */
				NET_ERR("MTU %lu, max is %d", mtu, 0xffff);
				NET_ERR("MTU %u, max is %u", mtu, 0xffff);
			}

			break;
+1 −1
Original line number Diff line number Diff line
@@ -432,7 +432,7 @@ enum net_verdict net_arp_input(struct net_buf *buf)

	if (net_buf_frags_len(buf) < (sizeof(struct net_arp_hdr) -
				       net_nbuf_ll_reserve(buf))) {
		NET_DBG("Invalid ARP header (len %d, min %d bytes)",
		NET_DBG("Invalid ARP header (len %zu, min %zu bytes)",
			net_buf_frags_len(buf),
			sizeof(struct net_arp_hdr) -
			net_nbuf_ll_reserve(buf));
Loading