Commit 04091142 authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

bridge: netfilter: Use ether_addr_copy

Convert the uses of memcpy to ether_addr_copy because
for some architectures it is smaller and faster.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e5a727f6
...@@ -506,7 +506,7 @@ static int br_nf_pre_routing_finish(struct sk_buff *skb) ...@@ -506,7 +506,7 @@ static int br_nf_pre_routing_finish(struct sk_buff *skb)
1); 1);
return 0; 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; skb->pkt_type = PACKET_HOST;
} }
} else { } else {
......
...@@ -28,7 +28,7 @@ static bool ebt_mac_wormhash_contains(const struct ebt_mac_wormhash *wh, ...@@ -28,7 +28,7 @@ static bool ebt_mac_wormhash_contains(const struct ebt_mac_wormhash *wh,
uint32_t cmp[2] = { 0, 0 }; uint32_t cmp[2] = { 0, 0 };
int key = ((const unsigned char *)mac)[5]; 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]; start = wh->table[key];
limit = wh->table[key + 1]; limit = wh->table[key + 1];
if (ip) { if (ip) {
......
...@@ -22,7 +22,7 @@ ebt_dnat_tg(struct sk_buff *skb, const struct xt_action_param *par) ...@@ -22,7 +22,7 @@ ebt_dnat_tg(struct sk_buff *skb, const struct xt_action_param *par)
if (!skb_make_writable(skb, 0)) if (!skb_make_writable(skb, 0))
return EBT_DROP; 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; return info->target;
} }
......
...@@ -25,10 +25,10 @@ ebt_redirect_tg(struct sk_buff *skb, const struct xt_action_param *par) ...@@ -25,10 +25,10 @@ ebt_redirect_tg(struct sk_buff *skb, const struct xt_action_param *par)
if (par->hooknum != NF_BR_BROUTING) if (par->hooknum != NF_BR_BROUTING)
/* rcu_read_lock()ed by nf_hook_slow */ /* rcu_read_lock()ed by nf_hook_slow */
memcpy(eth_hdr(skb)->h_dest, ether_addr_copy(eth_hdr(skb)->h_dest,
br_port_get_rcu(par->in)->br->dev->dev_addr, ETH_ALEN); br_port_get_rcu(par->in)->br->dev->dev_addr);
else 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; skb->pkt_type = PACKET_HOST;
return info->target; return info->target;
} }
......
...@@ -24,7 +24,7 @@ ebt_snat_tg(struct sk_buff *skb, const struct xt_action_param *par) ...@@ -24,7 +24,7 @@ ebt_snat_tg(struct sk_buff *skb, const struct xt_action_param *par)
if (!skb_make_writable(skb, 0)) if (!skb_make_writable(skb, 0))
return EBT_DROP; 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) && if (!(info->target & NAT_ARP_BIT) &&
eth_hdr(skb)->h_proto == htons(ETH_P_ARP)) { eth_hdr(skb)->h_proto == htons(ETH_P_ARP)) {
const struct arphdr *ap; const struct arphdr *ap;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment