Lines Matching refs:addr
81 static inline u8 llc_ui_addr_null(struct sockaddr_llc *addr) in llc_ui_addr_null() argument
83 return !memcmp(addr, &llc_ui_addrnull, sizeof(*addr)); in llc_ui_addr_null()
95 static inline u8 llc_ui_header_len(struct sock *sk, struct sockaddr_llc *addr) in llc_ui_header_len() argument
99 if (addr->sllc_test || addr->sllc_xid) in llc_ui_header_len()
261 static int llc_ui_autobind(struct socket *sock, struct sockaddr_llc *addr) in llc_ui_autobind() argument
273 if (llc->dev && addr->sllc_arphrd != llc->dev->type) { in llc_ui_autobind()
278 llc->dev = dev_getfirstbyhwtype(&init_net, addr->sllc_arphrd); in llc_ui_autobind()
290 memcpy(&llc->addr, addr, sizeof(llc->addr)); in llc_ui_autobind()
315 struct sockaddr_llc *addr = (struct sockaddr_llc *)uaddr; in llc_ui_bind() local
321 dprintk("%s: binding %02X\n", __func__, addr->sllc_sap); in llc_ui_bind()
324 if (unlikely(!sock_flag(sk, SOCK_ZAPPED) || addrlen != sizeof(*addr))) in llc_ui_bind()
327 if (unlikely(addr->sllc_family != AF_LLC)) in llc_ui_bind()
334 if (!addr->sllc_arphrd) in llc_ui_bind()
335 addr->sllc_arphrd = llc->dev->type; in llc_ui_bind()
336 if (is_zero_ether_addr(addr->sllc_mac)) in llc_ui_bind()
337 memcpy(addr->sllc_mac, llc->dev->dev_addr, in llc_ui_bind()
339 if (addr->sllc_arphrd != llc->dev->type || in llc_ui_bind()
340 !ether_addr_equal(addr->sllc_mac, in llc_ui_bind()
347 llc->dev = dev_getbyhwaddr_rcu(&init_net, addr->sllc_arphrd, in llc_ui_bind()
348 addr->sllc_mac); in llc_ui_bind()
354 if (!addr->sllc_sap) { in llc_ui_bind()
356 addr->sllc_sap = llc_ui_autoport(); in llc_ui_bind()
357 if (!addr->sllc_sap) in llc_ui_bind()
360 sap = llc_sap_find(addr->sllc_sap); in llc_ui_bind()
362 sap = llc_sap_open(addr->sllc_sap, NULL); in llc_ui_bind()
376 memcpy(laddr.mac, addr->sllc_mac, IFHWADDRLEN); in llc_ui_bind()
377 laddr.lsap = addr->sllc_sap; in llc_ui_bind()
385 llc->laddr.lsap = addr->sllc_sap; in llc_ui_bind()
386 memcpy(llc->laddr.mac, addr->sllc_mac, IFHWADDRLEN); in llc_ui_bind()
387 memcpy(&llc->addr, addr, sizeof(llc->addr)); in llc_ui_bind()
450 struct sockaddr_llc *addr = (struct sockaddr_llc *)uaddr; in llc_ui_connect() local
454 if (unlikely(addrlen != sizeof(*addr))) in llc_ui_connect()
457 if (unlikely(addr->sllc_family != AF_LLC)) in llc_ui_connect()
467 rc = llc_ui_autobind(sock, addr); in llc_ui_connect()
471 llc->daddr.lsap = addr->sllc_sap; in llc_ui_connect()
472 memcpy(llc->daddr.mac, addr->sllc_mac, IFHWADDRLEN); in llc_ui_connect()
477 addr->sllc_mac, addr->sllc_sap); in llc_ui_connect()
696 memcpy(&newllc->addr, &llc->addr, sizeof(newllc->addr)); in llc_ui_accept()
703 llc_sk(sk)->addr.sllc_sap, newllc->daddr.lsap); in llc_ui_accept()
899 DECLARE_SOCKADDR(struct sockaddr_llc *, addr, msg->msg_name); in llc_ui_sendmsg()
909 if (addr) { in llc_ui_sendmsg()
910 if (msg->msg_namelen < sizeof(*addr)) in llc_ui_sendmsg()
913 if (llc_ui_addr_null(&llc->addr)) in llc_ui_sendmsg()
915 addr = &llc->addr; in llc_ui_sendmsg()
920 rc = llc_ui_autobind(sock, addr); in llc_ui_sendmsg()
924 hdrlen = llc->dev->hard_header_len + llc_ui_header_len(sk, addr); in llc_ui_sendmsg()
935 skb->protocol = llc_proto_type(addr->sllc_arphrd); in llc_ui_sendmsg()
940 if (sk->sk_type == SOCK_DGRAM || addr->sllc_ua) { in llc_ui_sendmsg()
941 llc_build_and_send_ui_pkt(llc->sap, skb, addr->sllc_mac, in llc_ui_sendmsg()
942 addr->sllc_sap); in llc_ui_sendmsg()
945 if (addr->sllc_test) { in llc_ui_sendmsg()
946 llc_build_and_send_test_pkt(llc->sap, skb, addr->sllc_mac, in llc_ui_sendmsg()
947 addr->sllc_sap); in llc_ui_sendmsg()
950 if (addr->sllc_xid) { in llc_ui_sendmsg()
951 llc_build_and_send_xid_pkt(llc->sap, skb, addr->sllc_mac, in llc_ui_sendmsg()
952 addr->sllc_sap); in llc_ui_sendmsg()
956 if (!(sk->sk_type == SOCK_STREAM && !addr->sllc_ua)) in llc_ui_sendmsg()