printf("%s: my tsft %ull beacon tsft %ull\n", ic->ic_if.if_xname, local_tsft, beacon_tsft); printf("%s: sync TSF with %s\n", ic->ic_if.if_xname, ether_sprintf(ni->ni_macaddr));
ieee80211_ibss_merge(struct ieee80211com *ic, struct ieee80211_node *ni,    uint64_t local_tsft){	uint64_t beacon_tsft;	int did_print = 0, sign;	union {		uint64_t	word;		uint8_t		tstamp[8];	} u;	/* ensure alignment */	(void)memcpy(&u, &ni->ni_tstamp[0], sizeof(u));	beacon_tsft = letoh64(u.word);	/* we are faster, let the other guy catch up */	if (beacon_tsft < local_tsft)		sign = -1;	else		sign = 1;	if (memcmp(ni->ni_bssid, ic->ic_bss->ni_bssid,	    IEEE80211_ADDR_LEN) == 0) {		if (!ieee80211_do_slow_print(ic, &did_print))			return 0;		printf("%s: tsft offset %s%ull\n", ic->ic_if.if_xname,		    (sign < 0) ? "-" : "",		    (sign < 0)			? (local_tsft - beacon_tsft)			: (beacon_tsft - local_tsft));		return 0;	}	if (sign < 0)		return 0;	if (ieee80211_match_bss(ic, ni) != 0)		return 0;	if (ieee80211_do_slow_print(ic, &did_print)) {		printf("%s: ieee80211_ibss_merge: bssid mismatch %s\n",		    ic->ic_if.if_xname, ether_sprintf(ni->ni_bssid));	}	ic->ic_flags &= ~IEEE80211_F_SIBSS;	/* negotiate rates with new IBSS */	ieee80211_fix_rate(ic, ni, IEEE80211_F_DOFRATE |	    IEEE80211_F_DONEGO | IEEE80211_F_DODEL);	if (ni->ni_rates.rs_nrates == 0) {		if (ieee80211_do_slow_print(ic, &did_print)) {			printf("%s: rates mismatch, BSSID %s\n",			    ic->ic_if.if_xname, ether_sprintf(ni->ni_bssid));		}		return 0;	}	if (ieee80211_do_slow_print(ic, &did_print)) {		printf("%s: sync BSSID %s -> ",		    ic->ic_if.if_xname, ether_sprintf(ic->ic_bss->ni_bssid));		printf("%s ", ether_sprintf(ni->ni_bssid));		printf("(from %s)\n", ether_sprintf(ni->ni_macaddr));	}	ieee80211_node_newstate(ni, IEEE80211_STA_BSS);	(*ic->ic_node_copy)(ic, ic->ic_bss, ni);	return ENETRESET;}