]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
bridge: netfilter: Use ether_addr_copy
authorJoe Perches <joe@perches.com>
Sun, 23 Feb 2014 08:05:26 +0000 (00:05 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 25 Feb 2014 00:16:44 +0000 (19:16 -0500)
Convert the uses of memcpy to ether_addr_copy because
for some architectures it is smaller and faster.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_netfilter.c
net/bridge/netfilter/ebt_among.c
net/bridge/netfilter/ebt_dnat.c
net/bridge/netfilter/ebt_redirect.c
net/bridge/netfilter/ebt_snat.c

index b008c59a92c4be8dbc5812606ad76777e17d90ae..df0f114fb8cb8c8e4ebdb4009fde8c2908f7d2b4 100644 (file)
@@ -506,7 +506,7 @@ bridged_dnat:
                                               1);
                                return 0;
                        }
-                       memcpy(eth_hdr(skb)->h_dest, dev->dev_addr, ETH_ALEN);
+                       ether_addr_copy(eth_hdr(skb)->h_dest, dev->dev_addr);
                        skb->pkt_type = PACKET_HOST;
                }
        } else {
index 3fb3c848affef74249a1fd9ed610aea7d1db5764..9024283d2bca8206d6976bb7bb72523b514bd68d 100644 (file)
@@ -28,7 +28,7 @@ static bool ebt_mac_wormhash_contains(const struct ebt_mac_wormhash *wh,
        uint32_t cmp[2] = { 0, 0 };
        int key = ((const unsigned char *)mac)[5];
 
-       memcpy(((char *) cmp) + 2, mac, ETH_ALEN);
+       ether_addr_copy(((char *) cmp) + 2, mac);
        start = wh->table[key];
        limit = wh->table[key + 1];
        if (ip) {
index c59f7bfae6e2c3dc8a2e4f3725f43498ae2542a2..4e0b0c3593250bd8a1be0cdafca49ce7e4684f94 100644 (file)
@@ -22,7 +22,7 @@ ebt_dnat_tg(struct sk_buff *skb, const struct xt_action_param *par)
        if (!skb_make_writable(skb, 0))
                return EBT_DROP;
 
-       memcpy(eth_hdr(skb)->h_dest, info->mac, ETH_ALEN);
+       ether_addr_copy(eth_hdr(skb)->h_dest, info->mac);
        return info->target;
 }
 
index 46624bb6d9be5f0ca26b2b845f44f1a857499291..203964997a515a6bc4d961e59b365a5354df6518 100644 (file)
@@ -25,10 +25,10 @@ ebt_redirect_tg(struct sk_buff *skb, const struct xt_action_param *par)
 
        if (par->hooknum != NF_BR_BROUTING)
                /* rcu_read_lock()ed by nf_hook_slow */
-               memcpy(eth_hdr(skb)->h_dest,
-                      br_port_get_rcu(par->in)->br->dev->dev_addr, ETH_ALEN);
+               ether_addr_copy(eth_hdr(skb)->h_dest,
+                               br_port_get_rcu(par->in)->br->dev->dev_addr);
        else
-               memcpy(eth_hdr(skb)->h_dest, par->in->dev_addr, ETH_ALEN);
+               ether_addr_copy(eth_hdr(skb)->h_dest, par->in->dev_addr);
        skb->pkt_type = PACKET_HOST;
        return info->target;
 }
index 0f6b118d6cb21cc19c891c37d974ddd4ad2bcd6a..e56ccd060d2680da042322cea43177a27744b7ca 100644 (file)
@@ -24,7 +24,7 @@ ebt_snat_tg(struct sk_buff *skb, const struct xt_action_param *par)
        if (!skb_make_writable(skb, 0))
                return EBT_DROP;
 
-       memcpy(eth_hdr(skb)->h_source, info->mac, ETH_ALEN);
+       ether_addr_copy(eth_hdr(skb)->h_source, info->mac);
        if (!(info->target & NAT_ARP_BIT) &&
            eth_hdr(skb)->h_proto == htons(ETH_P_ARP)) {
                const struct arphdr *ap;