aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-09-27 01:13:38 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:52:51 -0400
commitb95cce3576813ac3f86bafa6b5daaaaf7574b0fe (patch)
tree54da3f245ee145722623a8e0eaab5fc49ea78511 /net
parent0c4e85813d0a94eeb8bf813397a4907bdd7bb610 (diff)
[NET]: Wrap hard_header_parse
Wrap the hard_header_parse function to simplify next step of header_ops conversion. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ethernet/eth.c4
-rw-r--r--net/ipv4/netfilter/ip_queue.c6
-rw-r--r--net/ipv6/netfilter/ip6_queue.c5
-rw-r--r--net/mac80211/ieee80211.c2
-rw-r--r--net/netfilter/nfnetlink_log.c11
-rw-r--r--net/netfilter/nfnetlink_queue.c13
-rw-r--r--net/packet/af_packet.c8
7 files changed, 20 insertions, 29 deletions
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index 2aaf6faf74ac..bdeb2f0ace32 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -207,9 +207,9 @@ EXPORT_SYMBOL(eth_type_trans);
207 * @skb: packet to extract header from 207 * @skb: packet to extract header from
208 * @haddr: destination buffer 208 * @haddr: destination buffer
209 */ 209 */
210static int eth_header_parse(struct sk_buff *skb, unsigned char *haddr) 210static int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr)
211{ 211{
212 struct ethhdr *eth = eth_hdr(skb); 212 const struct ethhdr *eth = eth_hdr(skb);
213 memcpy(haddr, eth->h_source, ETH_ALEN); 213 memcpy(haddr, eth->h_source, ETH_ALEN);
214 return ETH_ALEN; 214 return ETH_ALEN;
215} 215}
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
index 82fda92e6b97..aaa3f5c56761 100644
--- a/net/ipv4/netfilter/ip_queue.c
+++ b/net/ipv4/netfilter/ip_queue.c
@@ -250,10 +250,8 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp)
250 250
251 if (entry->info->indev && entry->skb->dev) { 251 if (entry->info->indev && entry->skb->dev) {
252 pmsg->hw_type = entry->skb->dev->type; 252 pmsg->hw_type = entry->skb->dev->type;
253 if (entry->skb->dev->hard_header_parse) 253 pmsg->hw_addrlen = dev_parse_header(entry->skb,
254 pmsg->hw_addrlen = 254 pmsg->hw_addr);
255 entry->skb->dev->hard_header_parse(entry->skb,
256 pmsg->hw_addr);
257 } 255 }
258 256
259 if (data_len) 257 if (data_len)
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c
index 2f5a52453834..c75f467a8f51 100644
--- a/net/ipv6/netfilter/ip6_queue.c
+++ b/net/ipv6/netfilter/ip6_queue.c
@@ -248,10 +248,7 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp)
248 248
249 if (entry->info->indev && entry->skb->dev) { 249 if (entry->info->indev && entry->skb->dev) {
250 pmsg->hw_type = entry->skb->dev->type; 250 pmsg->hw_type = entry->skb->dev->type;
251 if (entry->skb->dev->hard_header_parse) 251 pmsg->hw_addrlen = dev_parse_header(entry->skb, pmsg->hw_addr);
252 pmsg->hw_addrlen =
253 entry->skb->dev->hard_header_parse(entry->skb,
254 pmsg->hw_addr);
255 } 252 }
256 253
257 if (data_len) 254 if (data_len)
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 89be6629cfc0..0cdcf0d0c6ca 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -47,7 +47,7 @@ struct ieee80211_tx_status_rtap_hdr {
47 47
48/* common interface routines */ 48/* common interface routines */
49 49
50static int header_parse_80211(struct sk_buff *skb, unsigned char *haddr) 50static int header_parse_80211(const struct sk_buff *skb, unsigned char *haddr)
51{ 51{
52 memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); /* addr2 */ 52 memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); /* addr2 */
53 return ETH_ALEN; 53 return ETH_ALEN;
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 8e4001b8f764..332e0f7f6f9e 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -481,12 +481,13 @@ __build_packet_message(struct nfulnl_instance *inst,
481 NFA_PUT(inst->skb, NFULA_MARK, sizeof(tmp_uint), &tmp_uint); 481 NFA_PUT(inst->skb, NFULA_MARK, sizeof(tmp_uint), &tmp_uint);
482 } 482 }
483 483
484 if (indev && skb->dev && skb->dev->hard_header_parse) { 484 if (indev && skb->dev) {
485 struct nfulnl_msg_packet_hw phw; 485 struct nfulnl_msg_packet_hw phw;
486 int len = skb->dev->hard_header_parse((struct sk_buff *)skb, 486 int len = dev_parse_header(skb, phw.hw_addr);
487 phw.hw_addr); 487 if (len > 0) {
488 phw.hw_addrlen = htons(len); 488 phw.hw_addrlen = htons(len);
489 NFA_PUT(inst->skb, NFULA_HWADDR, sizeof(phw), &phw); 489 NFA_PUT(inst->skb, NFULA_HWADDR, sizeof(phw), &phw);
490 }
490 } 491 }
491 492
492 if (skb->tstamp.tv64) { 493 if (skb->tstamp.tv64) {
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index c97369f48db7..a813185c766d 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -485,14 +485,13 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue,
485 NFA_PUT(skb, NFQA_MARK, sizeof(u_int32_t), &tmp_uint); 485 NFA_PUT(skb, NFQA_MARK, sizeof(u_int32_t), &tmp_uint);
486 } 486 }
487 487
488 if (indev && entskb->dev 488 if (indev && entskb->dev) {
489 && entskb->dev->hard_header_parse) {
490 struct nfqnl_msg_packet_hw phw; 489 struct nfqnl_msg_packet_hw phw;
491 490 int len = dev_parse_header(entskb, phw.hw_addr);
492 int len = entskb->dev->hard_header_parse(entskb, 491 if (len) {
493 phw.hw_addr); 492 phw.hw_addrlen = htons(len);
494 phw.hw_addrlen = htons(len); 493 NFA_PUT(skb, NFQA_HWADDR, sizeof(phw), &phw);
495 NFA_PUT(skb, NFQA_HWADDR, sizeof(phw), &phw); 494 }
496 } 495 }
497 496
498 if (entskb->tstamp.tv64) { 497 if (entskb->tstamp.tv64) {
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index c5244b309640..c9ee343c2a6c 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -519,10 +519,8 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet
519 sll->sll_ifindex = orig_dev->ifindex; 519 sll->sll_ifindex = orig_dev->ifindex;
520 else 520 else
521 sll->sll_ifindex = dev->ifindex; 521 sll->sll_ifindex = dev->ifindex;
522 sll->sll_halen = 0;
523 522
524 if (dev->hard_header_parse) 523 sll->sll_halen = dev_parse_header(skb, sll->sll_addr);
525 sll->sll_halen = dev->hard_header_parse(skb, sll->sll_addr);
526 524
527 PACKET_SKB_CB(skb)->origlen = skb->len; 525 PACKET_SKB_CB(skb)->origlen = skb->len;
528 526
@@ -658,9 +656,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
658 h->tp_usec = tv.tv_usec; 656 h->tp_usec = tv.tv_usec;
659 657
660 sll = (struct sockaddr_ll*)((u8*)h + TPACKET_ALIGN(sizeof(*h))); 658 sll = (struct sockaddr_ll*)((u8*)h + TPACKET_ALIGN(sizeof(*h)));
661 sll->sll_halen = 0; 659 sll->sll_halen = dev_parse_header(skb, sll->sll_addr);
662 if (dev->hard_header_parse)
663 sll->sll_halen = dev->hard_header_parse(skb, sll->sll_addr);
664 sll->sll_family = AF_PACKET; 660 sll->sll_family = AF_PACKET;
665 sll->sll_hatype = dev->type; 661 sll->sll_hatype = dev->type;
666 sll->sll_protocol = skb->protocol; 662 sll->sll_protocol = skb->protocol;