Skip to content

Commit a5a0481

Browse files
joonwparkdavem330
authored andcommitted
[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>
1 parent 27785d8 commit a5a0481

3 files changed

Lines changed: 4 additions & 11 deletions

File tree

‎include/net/llc.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ struct llc_sap {
6565

6666
extern struct list_head llc_sap_list;
6767
extern rwlock_t llc_sap_list_lock;
68-
extern unsigned char llc_station_mac_sa[ETH_ALEN];
6968

7069
extern int llc_rcv(struct sk_buff *skb, struct net_device *dev,
7170
struct packet_type *pt, struct net_device *orig_dev);

‎net/llc/llc_core.c‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
LIST_HEAD(llc_sap_list);
2626
DEFINE_RWLOCK(llc_sap_list_lock);
2727

28-
unsigned char llc_station_mac_sa[ETH_ALEN];
29-
3028
/**
3129
* llc_sap_alloc - allocates and initializes sap.
3230
*
@@ -37,8 +35,8 @@ static struct llc_sap *llc_sap_alloc(void)
3735
struct llc_sap *sap = kzalloc(sizeof(*sap), GFP_ATOMIC);
3836

3937
if (sap) {
38+
/* sap->laddr.mac - leave as a null, it's filled by bind */
4039
sap->state = LLC_SAP_STATE_ACTIVE;
41-
memcpy(sap->laddr.mac, llc_station_mac_sa, ETH_ALEN);
4240
rwlock_init(&sap->sk_list.lock);
4341
atomic_set(&sap->refcnt, 1);
4442
}
@@ -167,10 +165,6 @@ static int __init llc_init(void)
167165
if (dev != NULL)
168166
dev = next_net_device(dev);
169167

170-
if (dev != NULL)
171-
memcpy(llc_station_mac_sa, dev->dev_addr, ETH_ALEN);
172-
else
173-
memset(llc_station_mac_sa, 0, ETH_ALEN);
174168
dev_add_pack(&llc_packet_type);
175169
dev_add_pack(&llc_tr_packet_type);
176170
return 0;

‎net/llc/llc_station.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ static int llc_station_ac_send_null_dsap_xid_c(struct sk_buff *skb)
259259
goto out;
260260
llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, 0, LLC_PDU_CMD);
261261
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);
263263
if (unlikely(rc))
264264
goto free;
265265
llc_station_send_pdu(nskb);
@@ -283,7 +283,7 @@ static int llc_station_ac_send_xid_r(struct sk_buff *skb)
283283
llc_pdu_decode_ssap(skb, &dsap);
284284
llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, dsap, LLC_PDU_RSP);
285285
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);
287287
if (unlikely(rc))
288288
goto free;
289289
llc_station_send_pdu(nskb);
@@ -307,7 +307,7 @@ static int llc_station_ac_send_test_r(struct sk_buff *skb)
307307
llc_pdu_decode_ssap(skb, &dsap);
308308
llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, dsap, LLC_PDU_RSP);
309309
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);
311311
if (unlikely(rc))
312312
goto free;
313313
llc_station_send_pdu(nskb);

0 commit comments

Comments
 (0)