aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/network-coding.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/batman-adv/network-coding.c')
-rw-r--r--net/batman-adv/network-coding.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/net/batman-adv/network-coding.c b/net/batman-adv/network-coding.c
index 6b9a54485314..f7c54305a918 100644
--- a/net/batman-adv/network-coding.c
+++ b/net/batman-adv/network-coding.c
@@ -1484,7 +1484,7 @@ void batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv,
1484{ 1484{
1485 struct ethhdr *ethhdr = (struct ethhdr *)skb_mac_header(skb); 1485 struct ethhdr *ethhdr = (struct ethhdr *)skb_mac_header(skb);
1486 1486
1487 if (batadv_is_my_mac(ethhdr->h_dest)) 1487 if (batadv_is_my_mac(bat_priv, ethhdr->h_dest))
1488 return; 1488 return;
1489 1489
1490 /* Set data pointer to MAC header to mimic packets from our tx path */ 1490 /* Set data pointer to MAC header to mimic packets from our tx path */
@@ -1496,6 +1496,7 @@ void batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv,
1496/** 1496/**
1497 * batadv_nc_skb_decode_packet - decode given skb using the decode data stored 1497 * batadv_nc_skb_decode_packet - decode given skb using the decode data stored
1498 * in nc_packet 1498 * in nc_packet
1499 * @bat_priv: the bat priv with all the soft interface information
1499 * @skb: unicast skb to decode 1500 * @skb: unicast skb to decode
1500 * @nc_packet: decode data needed to decode the skb 1501 * @nc_packet: decode data needed to decode the skb
1501 * 1502 *
@@ -1503,7 +1504,7 @@ void batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv,
1503 * in case of an error. 1504 * in case of an error.
1504 */ 1505 */
1505static struct batadv_unicast_packet * 1506static struct batadv_unicast_packet *
1506batadv_nc_skb_decode_packet(struct sk_buff *skb, 1507batadv_nc_skb_decode_packet(struct batadv_priv *bat_priv, struct sk_buff *skb,
1507 struct batadv_nc_packet *nc_packet) 1508 struct batadv_nc_packet *nc_packet)
1508{ 1509{
1509 const int h_size = sizeof(struct batadv_unicast_packet); 1510 const int h_size = sizeof(struct batadv_unicast_packet);
@@ -1537,7 +1538,7 @@ batadv_nc_skb_decode_packet(struct sk_buff *skb,
1537 /* Select the correct unicast header information based on the location 1538 /* Select the correct unicast header information based on the location
1538 * of our mac address in the coded_packet header 1539 * of our mac address in the coded_packet header
1539 */ 1540 */
1540 if (batadv_is_my_mac(coded_packet_tmp.second_dest)) { 1541 if (batadv_is_my_mac(bat_priv, coded_packet_tmp.second_dest)) {
1541 /* If we are the second destination the packet was overheard, 1542 /* If we are the second destination the packet was overheard,
1542 * so the Ethernet address must be copied to h_dest and 1543 * so the Ethernet address must be copied to h_dest and
1543 * pkt_type changed from PACKET_OTHERHOST to PACKET_HOST 1544 * pkt_type changed from PACKET_OTHERHOST to PACKET_HOST
@@ -1608,7 +1609,7 @@ batadv_nc_find_decoding_packet(struct batadv_priv *bat_priv,
1608 1609
1609 /* Select the correct packet id based on the location of our mac-addr */ 1610 /* Select the correct packet id based on the location of our mac-addr */
1610 dest = ethhdr->h_source; 1611 dest = ethhdr->h_source;
1611 if (!batadv_is_my_mac(coded->second_dest)) { 1612 if (!batadv_is_my_mac(bat_priv, coded->second_dest)) {
1612 source = coded->second_source; 1613 source = coded->second_source;
1613 packet_id = coded->second_crc; 1614 packet_id = coded->second_crc;
1614 } else { 1615 } else {
@@ -1675,12 +1676,12 @@ static int batadv_nc_recv_coded_packet(struct sk_buff *skb,
1675 ethhdr = (struct ethhdr *)skb_mac_header(skb); 1676 ethhdr = (struct ethhdr *)skb_mac_header(skb);
1676 1677
1677 /* Verify frame is destined for us */ 1678 /* Verify frame is destined for us */
1678 if (!batadv_is_my_mac(ethhdr->h_dest) && 1679 if (!batadv_is_my_mac(bat_priv, ethhdr->h_dest) &&
1679 !batadv_is_my_mac(coded_packet->second_dest)) 1680 !batadv_is_my_mac(bat_priv, coded_packet->second_dest))
1680 return NET_RX_DROP; 1681 return NET_RX_DROP;
1681 1682
1682 /* Update stat counter */ 1683 /* Update stat counter */
1683 if (batadv_is_my_mac(coded_packet->second_dest)) 1684 if (batadv_is_my_mac(bat_priv, coded_packet->second_dest))
1684 batadv_inc_counter(bat_priv, BATADV_CNT_NC_SNIFFED); 1685 batadv_inc_counter(bat_priv, BATADV_CNT_NC_SNIFFED);
1685 1686
1686 nc_packet = batadv_nc_find_decoding_packet(bat_priv, ethhdr, 1687 nc_packet = batadv_nc_find_decoding_packet(bat_priv, ethhdr,
@@ -1698,7 +1699,7 @@ static int batadv_nc_recv_coded_packet(struct sk_buff *skb,
1698 goto free_nc_packet; 1699 goto free_nc_packet;
1699 1700
1700 /* Decode the packet */ 1701 /* Decode the packet */
1701 unicast_packet = batadv_nc_skb_decode_packet(skb, nc_packet); 1702 unicast_packet = batadv_nc_skb_decode_packet(bat_priv, skb, nc_packet);
1702 if (!unicast_packet) { 1703 if (!unicast_packet) {
1703 batadv_inc_counter(bat_priv, BATADV_CNT_NC_DECODE_FAILED); 1704 batadv_inc_counter(bat_priv, BATADV_CNT_NC_DECODE_FAILED);
1704 goto free_nc_packet; 1705 goto free_nc_packet;