aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/llc_if.h30
-rw-r--r--net/llc/af_llc.c6
-rw-r--r--net/llc/llc_conn.c6
-rw-r--r--net/llc/llc_sap.c4
4 files changed, 8 insertions, 38 deletions
diff --git a/include/net/llc_if.h b/include/net/llc_if.h
index b595a004d31b..f0cb909b60eb 100644
--- a/include/net/llc_if.h
+++ b/include/net/llc_if.h
@@ -62,36 +62,6 @@
62#define LLC_STATUS_CONFLICT 7 /* disconnect conn */ 62#define LLC_STATUS_CONFLICT 7 /* disconnect conn */
63#define LLC_STATUS_RESET_DONE 8 /* */ 63#define LLC_STATUS_RESET_DONE 8 /* */
64 64
65/**
66 * llc_mac_null - determines if a address is a null mac address
67 * @mac: Mac address to test if null.
68 *
69 * Determines if a given address is a null mac address. Returns 0 if the
70 * address is not a null mac, 1 if the address is a null mac.
71 */
72static inline int llc_mac_null(const u8 *mac)
73{
74 return is_zero_ether_addr(mac);
75}
76
77static inline int llc_mac_multicast(const u8 *mac)
78{
79 return is_multicast_ether_addr(mac);
80}
81/**
82 * llc_mac_match - determines if two mac addresses are the same
83 * @mac1: First mac address to compare.
84 * @mac2: Second mac address to compare.
85 *
86 * Determines if two given mac address are the same. Returns 0 if there
87 * is not a complete match up to len, 1 if a complete match up to len is
88 * found.
89 */
90static inline int llc_mac_match(const u8 *mac1, const u8 *mac2)
91{
92 return !compare_ether_addr(mac1, mac2);
93}
94
95extern int llc_establish_connection(struct sock *sk, u8 *lmac, 65extern int llc_establish_connection(struct sock *sk, u8 *lmac,
96 u8 *dmac, u8 dsap); 66 u8 *dmac, u8 dsap);
97extern int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb); 67extern int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb);
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index 48aaa89253e0..6cba486353e8 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -321,12 +321,12 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen)
321 if (llc->dev) { 321 if (llc->dev) {
322 if (!addr->sllc_arphrd) 322 if (!addr->sllc_arphrd)
323 addr->sllc_arphrd = llc->dev->type; 323 addr->sllc_arphrd = llc->dev->type;
324 if (llc_mac_null(addr->sllc_mac)) 324 if (is_zero_ether_addr(addr->sllc_mac))
325 memcpy(addr->sllc_mac, llc->dev->dev_addr, 325 memcpy(addr->sllc_mac, llc->dev->dev_addr,
326 IFHWADDRLEN); 326 IFHWADDRLEN);
327 if (addr->sllc_arphrd != llc->dev->type || 327 if (addr->sllc_arphrd != llc->dev->type ||
328 !llc_mac_match(addr->sllc_mac, 328 !ether_addr_equal(addr->sllc_mac,
329 llc->dev->dev_addr)) { 329 llc->dev->dev_addr)) {
330 rc = -EINVAL; 330 rc = -EINVAL;
331 llc->dev = NULL; 331 llc->dev = NULL;
332 } 332 }
diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c
index 0d0d416dfab6..cd8724177965 100644
--- a/net/llc/llc_conn.c
+++ b/net/llc/llc_conn.c
@@ -478,8 +478,8 @@ static inline bool llc_estab_match(const struct llc_sap *sap,
478 478
479 return llc->laddr.lsap == laddr->lsap && 479 return llc->laddr.lsap == laddr->lsap &&
480 llc->daddr.lsap == daddr->lsap && 480 llc->daddr.lsap == daddr->lsap &&
481 llc_mac_match(llc->laddr.mac, laddr->mac) && 481 ether_addr_equal(llc->laddr.mac, laddr->mac) &&
482 llc_mac_match(llc->daddr.mac, daddr->mac); 482 ether_addr_equal(llc->daddr.mac, daddr->mac);
483} 483}
484 484
485/** 485/**
@@ -550,7 +550,7 @@ static inline bool llc_listener_match(const struct llc_sap *sap,
550 550
551 return sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_LISTEN && 551 return sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_LISTEN &&
552 llc->laddr.lsap == laddr->lsap && 552 llc->laddr.lsap == laddr->lsap &&
553 llc_mac_match(llc->laddr.mac, laddr->mac); 553 ether_addr_equal(llc->laddr.mac, laddr->mac);
554} 554}
555 555
556static struct sock *__llc_lookup_listener(struct llc_sap *sap, 556static struct sock *__llc_lookup_listener(struct llc_sap *sap,
diff --git a/net/llc/llc_sap.c b/net/llc/llc_sap.c
index 78be45cda5c1..e5850699098e 100644
--- a/net/llc/llc_sap.c
+++ b/net/llc/llc_sap.c
@@ -302,7 +302,7 @@ static inline bool llc_dgram_match(const struct llc_sap *sap,
302 302
303 return sk->sk_type == SOCK_DGRAM && 303 return sk->sk_type == SOCK_DGRAM &&
304 llc->laddr.lsap == laddr->lsap && 304 llc->laddr.lsap == laddr->lsap &&
305 llc_mac_match(llc->laddr.mac, laddr->mac); 305 ether_addr_equal(llc->laddr.mac, laddr->mac);
306} 306}
307 307
308/** 308/**
@@ -425,7 +425,7 @@ void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb)
425 llc_pdu_decode_da(skb, laddr.mac); 425 llc_pdu_decode_da(skb, laddr.mac);
426 llc_pdu_decode_dsap(skb, &laddr.lsap); 426 llc_pdu_decode_dsap(skb, &laddr.lsap);
427 427
428 if (llc_mac_multicast(laddr.mac)) { 428 if (is_multicast_ether_addr(laddr.mac)) {
429 llc_sap_mcast(sap, &laddr, skb); 429 llc_sap_mcast(sap, &laddr, skb);
430 kfree_skb(skb); 430 kfree_skb(skb);
431 } else { 431 } else {