/* Search socket list of the SAP and finds connection using the local mac, and local sap. Returns pointer for socket found, NULL otherwise.  */
static struct sock* llc_lookup_dgram(struct llc_sap *sap, const struct llc_addr *laddr)
/* Search socket list of the SAP and finds connection using the local mac, and local sap. Returns pointer for socket found, NULL otherwise.  */
static struct sock* llc_lookup_dgram(struct llc_sap *sap, const struct llc_addr *laddr)
{
	struct sock *rc;
	struct hlist_node *node;
	read_lock_bh(&sap->sk_list.lock);
	sk_for_each(rc, node, &sap->sk_list.list) {
		struct llc_sock *llc = llc_sk(rc);
		if (rc->sk_type == SOCK_DGRAM &&
		    llc->laddr.lsap == laddr->lsap &&
		    llc_mac_match(llc->laddr.mac, laddr->mac)) {
			sock_hold(rc);
			goto found;
		}
	}
	rc = NULL;
found:
	read_unlock_bh(&sap->sk_list.lock);
	return rc;
}