Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[LLC]: station source mac address

kill unnecessary llc_station_mac_sa.

Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Joonwoo Park and committed by
David S. Miller
a5a04819 27785d83

+4 -11
-1
include/net/llc.h
··· 65 65 66 66 extern struct list_head llc_sap_list; 67 67 extern rwlock_t llc_sap_list_lock; 68 - extern unsigned char llc_station_mac_sa[ETH_ALEN]; 69 68 70 69 extern int llc_rcv(struct sk_buff *skb, struct net_device *dev, 71 70 struct packet_type *pt, struct net_device *orig_dev);
+1 -7
net/llc/llc_core.c
··· 25 25 LIST_HEAD(llc_sap_list); 26 26 DEFINE_RWLOCK(llc_sap_list_lock); 27 27 28 - unsigned char llc_station_mac_sa[ETH_ALEN]; 29 - 30 28 /** 31 29 * llc_sap_alloc - allocates and initializes sap. 32 30 * ··· 35 37 struct llc_sap *sap = kzalloc(sizeof(*sap), GFP_ATOMIC); 36 38 37 39 if (sap) { 40 + /* sap->laddr.mac - leave as a null, it's filled by bind */ 38 41 sap->state = LLC_SAP_STATE_ACTIVE; 39 - memcpy(sap->laddr.mac, llc_station_mac_sa, ETH_ALEN); 40 42 rwlock_init(&sap->sk_list.lock); 41 43 atomic_set(&sap->refcnt, 1); 42 44 } ··· 165 167 if (dev != NULL) 166 168 dev = next_net_device(dev); 167 169 168 - if (dev != NULL) 169 - memcpy(llc_station_mac_sa, dev->dev_addr, ETH_ALEN); 170 - else 171 - memset(llc_station_mac_sa, 0, ETH_ALEN); 172 170 dev_add_pack(&llc_packet_type); 173 171 dev_add_pack(&llc_tr_packet_type); 174 172 return 0;
+3 -3
net/llc/llc_station.c
··· 259 259 goto out; 260 260 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, 0, LLC_PDU_CMD); 261 261 llc_pdu_init_as_xid_cmd(nskb, LLC_XID_NULL_CLASS_2, 127); 262 - rc = llc_mac_hdr_init(nskb, llc_station_mac_sa, llc_station_mac_sa); 262 + rc = llc_mac_hdr_init(nskb, skb->dev->dev_addr, skb->dev->dev_addr); 263 263 if (unlikely(rc)) 264 264 goto free; 265 265 llc_station_send_pdu(nskb); ··· 283 283 llc_pdu_decode_ssap(skb, &dsap); 284 284 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, dsap, LLC_PDU_RSP); 285 285 llc_pdu_init_as_xid_rsp(nskb, LLC_XID_NULL_CLASS_2, 127); 286 - rc = llc_mac_hdr_init(nskb, llc_station_mac_sa, mac_da); 286 + rc = llc_mac_hdr_init(nskb, skb->dev->dev_addr, mac_da); 287 287 if (unlikely(rc)) 288 288 goto free; 289 289 llc_station_send_pdu(nskb); ··· 307 307 llc_pdu_decode_ssap(skb, &dsap); 308 308 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, dsap, LLC_PDU_RSP); 309 309 llc_pdu_init_as_test_rsp(nskb, skb); 310 - rc = llc_mac_hdr_init(nskb, llc_station_mac_sa, mac_da); 310 + rc = llc_mac_hdr_init(nskb, skb->dev->dev_addr, mac_da); 311 311 if (unlikely(rc)) 312 312 goto free; 313 313 llc_station_send_pdu(nskb);