Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: unbreak IEEE80211_DEBUG
To:
tech@openbsd.org
Date:
Tue, 3 Mar 2026 14:01:07 +0100

Download raw body.

Thread
On Tue, Mar 03, 2026 at 01:43:27PM +0100, Claudio Jeker wrote:
> Fix compile with IEEE80211_DEBUG. Need to lookup the node before calling
> the debug function. Also adjust the if condition to use is_new instead of
> ni == NULL (which is no longer possible).
> 
> Also silence ieee80211_release_node() DPRINTF by adding a
> ieee80211_debug > 1 check. This message is way to noisy and of little
> value in the common case.
> 
> -- 
> :wq Claudio

Agreed. ok stsp@

> 
> Index: net80211/ieee80211_input.c
> ===================================================================
> RCS file: /cvs/src/sys/net80211/ieee80211_input.c,v
> diff -u -p -r1.258 ieee80211_input.c
> --- net80211/ieee80211_input.c	30 Jan 2026 04:25:52 -0000	1.258
> +++ net80211/ieee80211_input.c	3 Mar 2026 12:22:56 -0000
> @@ -1788,12 +1798,20 @@ ieee80211_recv_probe_resp(struct ieee802
>  		return;
>  	}
>  
> +	if ((ni = ieee80211_find_node(ic, wh->i_addr2)) == NULL) {
> +		ni = ieee80211_alloc_node(ic, wh->i_addr2);
> +		if (ni == NULL)
> +			return;
> +		is_new = 1;
> +	} else
> +		is_new = 0;
> +
>  #ifdef IEEE80211_DEBUG
>  	if (ieee80211_debug > 1 &&
> -	    (ni == NULL || ic->ic_state == IEEE80211_S_SCAN ||
> +	    (is_new || ic->ic_state == IEEE80211_S_SCAN ||
>  	    (ic->ic_flags & IEEE80211_F_BGSCAN))) {
>  		printf("%s: %s%s on chan %u (bss chan %u) ",
> -		    __func__, (ni == NULL ? "new " : ""),
> +		    __func__, (is_new ? "new " : ""),
>  		    isprobe ? "probe response" : "beacon",
>  		    chan, bchan);
>  		ieee80211_print_essid(ssid + 2, ssid[1]);
> @@ -1802,14 +1820,6 @@ ieee80211_recv_probe_resp(struct ieee802
>  			__func__, capinfo, bintval, erp);
>  	}
>  #endif
> -
> -	if ((ni = ieee80211_find_node(ic, wh->i_addr2)) == NULL) {
> -		ni = ieee80211_alloc_node(ic, wh->i_addr2);
> -		if (ni == NULL)
> -			return;
> -		is_new = 1;
> -	} else
> -		is_new = 0;
>  
>  	ni->ni_chan = &ic->ic_channels[chan];
>  
> Index: net80211/ieee80211_node.c
> ===================================================================
> RCS file: /cvs/src/sys/net80211/ieee80211_node.c,v
> diff -u -p -r1.209 ieee80211_node.c
> --- net80211/ieee80211_node.c	6 Feb 2026 16:27:46 -0000	1.209
> +++ net80211/ieee80211_node.c	3 Mar 2026 12:25:47 -0000
> @@ -2144,8 +2144,11 @@ ieee80211_release_node(struct ieee80211c
>  	int s;
>  	void (*ni_unref_cb)(struct ieee80211com *, struct ieee80211_node *);
>  
> -	DPRINTF(("%s refcnt %u\n", ether_sprintf(ni->ni_macaddr),
> -	    ni->ni_refcnt));
> +#ifdef IEEE80211_DEBUG
> +	if (ieee80211_debug > 1)
> +		DPRINTF(("%s refcnt %u\n", ether_sprintf(ni->ni_macaddr),
> +		    ni->ni_refcnt));
> +#endif
>  	s = splnet();
>  	if (ieee80211_node_decref(ni) == 0) {
>  		if (ni->ni_unref_cb) {
> 
>