Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: Kill dev_rebuild_header

Now that there are no more users kill dev_rebuild_header and all of it's
implementations.

This is long overdue.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Eric W. Biederman and committed by
David S. Miller
d476059e 945db424

+1 -306
-13
drivers/firewire/net.c
··· 237 237 return -net->hard_header_len; 238 238 } 239 239 240 - static int fwnet_header_rebuild(struct sk_buff *skb) 241 - { 242 - struct fwnet_header *h = (struct fwnet_header *)skb->data; 243 - 244 - if (get_unaligned_be16(&h->h_proto) == ETH_P_IP) 245 - return arp_find((unsigned char *)&h->h_dest, skb); 246 - 247 - dev_notice(&skb->dev->dev, "unable to resolve type %04x addresses\n", 248 - be16_to_cpu(h->h_proto)); 249 - return 0; 250 - } 251 - 252 240 static int fwnet_header_cache(const struct neighbour *neigh, 253 241 struct hh_cache *hh, __be16 type) 254 242 { ··· 270 282 271 283 static const struct header_ops fwnet_header_ops = { 272 284 .create = fwnet_header_create, 273 - .rebuild = fwnet_header_rebuild, 274 285 .cache = fwnet_header_cache, 275 286 .cache_update = fwnet_header_cache_update, 276 287 .parse = fwnet_header_parse,
-33
drivers/isdn/i4l/isdn_net.c
··· 1951 1951 return len; 1952 1952 } 1953 1953 1954 - /* We don't need to send arp, because we have point-to-point connections. */ 1955 - static int 1956 - isdn_net_rebuild_header(struct sk_buff *skb) 1957 - { 1958 - struct net_device *dev = skb->dev; 1959 - isdn_net_local *lp = netdev_priv(dev); 1960 - int ret = 0; 1961 - 1962 - if (lp->p_encap == ISDN_NET_ENCAP_ETHER) { 1963 - struct ethhdr *eth = (struct ethhdr *) skb->data; 1964 - 1965 - /* 1966 - * Only ARP/IP is currently supported 1967 - */ 1968 - 1969 - if (eth->h_proto != htons(ETH_P_IP)) { 1970 - printk(KERN_WARNING 1971 - "isdn_net: %s don't know how to resolve type %d addresses?\n", 1972 - dev->name, (int) eth->h_proto); 1973 - memcpy(eth->h_source, dev->dev_addr, dev->addr_len); 1974 - return 0; 1975 - } 1976 - /* 1977 - * Try to get ARP to resolve the header. 1978 - */ 1979 - #ifdef CONFIG_INET 1980 - ret = arp_find(eth->h_dest, skb); 1981 - #endif 1982 - } 1983 - return ret; 1984 - } 1985 - 1986 1954 static int isdn_header_cache(const struct neighbour *neigh, struct hh_cache *hh, 1987 1955 __be16 type) 1988 1956 { ··· 1973 2005 1974 2006 static const struct header_ops isdn_header_ops = { 1975 2007 .create = isdn_net_header, 1976 - .rebuild = isdn_net_rebuild_header, 1977 2008 .cache = isdn_header_cache, 1978 2009 .cache_update = isdn_header_cache_update, 1979 2010 };
-1
drivers/media/dvb-core/dvb_net.c
··· 1190 1190 static const struct header_ops dvb_header_ops = { 1191 1191 .create = eth_header, 1192 1192 .parse = eth_header_parse, 1193 - .rebuild = eth_rebuild_header, 1194 1193 }; 1195 1194 1196 1195
-55
drivers/net/arcnet/arcnet.c
··· 104 104 static int arcnet_header(struct sk_buff *skb, struct net_device *dev, 105 105 unsigned short type, const void *daddr, 106 106 const void *saddr, unsigned len); 107 - static int arcnet_rebuild_header(struct sk_buff *skb); 108 107 static int go_tx(struct net_device *dev); 109 108 110 109 static int debug = ARCNET_DEBUG; ··· 311 312 312 313 static const struct header_ops arcnet_header_ops = { 313 314 .create = arcnet_header, 314 - .rebuild = arcnet_rebuild_header, 315 315 }; 316 316 317 317 static const struct net_device_ops arcnet_netdev_ops = { ··· 535 537 } 536 538 return proto->build_header(skb, dev, type, _daddr); 537 539 } 538 - 539 - 540 - /* 541 - * Rebuild the ARCnet hard header. This is called after an ARP (or in the 542 - * future other address resolution) has completed on this sk_buff. We now 543 - * let ARP fill in the destination field. 544 - */ 545 - static int arcnet_rebuild_header(struct sk_buff *skb) 546 - { 547 - struct net_device *dev = skb->dev; 548 - struct arcnet_local *lp = netdev_priv(dev); 549 - int status = 0; /* default is failure */ 550 - unsigned short type; 551 - uint8_t daddr=0; 552 - struct ArcProto *proto; 553 - /* 554 - * XXX: Why not use skb->mac_len? 555 - */ 556 - if (skb->network_header - skb->mac_header != 2) { 557 - BUGMSG(D_NORMAL, 558 - "rebuild_header: shouldn't be here! (hdrsize=%d)\n", 559 - (int)(skb->network_header - skb->mac_header)); 560 - return 0; 561 - } 562 - type = *(uint16_t *) skb_pull(skb, 2); 563 - BUGMSG(D_DURING, "rebuild header for protocol %Xh\n", type); 564 - 565 - if (type == ETH_P_IP) { 566 - #ifdef CONFIG_INET 567 - BUGMSG(D_DURING, "rebuild header for ethernet protocol %Xh\n", type); 568 - status = arp_find(&daddr, skb) ? 1 : 0; 569 - BUGMSG(D_DURING, " rebuilt: dest is %d; protocol %Xh\n", 570 - daddr, type); 571 - #endif 572 - } else { 573 - BUGMSG(D_NORMAL, 574 - "I don't understand ethernet protocol %Xh addresses!\n", type); 575 - dev->stats.tx_errors++; 576 - dev->stats.tx_aborted_errors++; 577 - } 578 - 579 - /* if we couldn't resolve the address... give up. */ 580 - if (!status) 581 - return 0; 582 - 583 - /* add the _real_ header this time! */ 584 - proto = arc_proto_map[lp->default_proto[daddr]]; 585 - proto->build_header(skb, dev, type, daddr); 586 - 587 - return 1; /* success */ 588 - } 589 - 590 - 591 540 592 541 /* Called by the kernel in order to transmit a packet. */ 593 542 netdev_tx_t arcnet_send_packet(struct sk_buff *skb,
-1
drivers/net/ipvlan/ipvlan_main.c
··· 336 336 337 337 static const struct header_ops ipvlan_header_ops = { 338 338 .create = ipvlan_hard_header, 339 - .rebuild = eth_rebuild_header, 340 339 .parse = eth_header_parse, 341 340 .cache = eth_header_cache, 342 341 .cache_update = eth_header_cache_update,
-1
drivers/net/macvlan.c
··· 550 550 551 551 static const struct header_ops macvlan_hard_header_ops = { 552 552 .create = macvlan_hard_header, 553 - .rebuild = eth_rebuild_header, 554 553 .parse = eth_header_parse, 555 554 .cache = eth_header_cache, 556 555 .cache_update = eth_header_cache_update,
-1
drivers/net/wireless/hostap/hostap_main.c
··· 798 798 799 799 const struct header_ops hostap_80211_ops = { 800 800 .create = eth_header, 801 - .rebuild = eth_rebuild_header, 802 801 .cache = eth_header_cache, 803 802 .cache_update = eth_header_cache_update, 804 803 .parse = hostap_80211_header_parse,
-1
include/linux/etherdevice.h
··· 35 35 36 36 int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, 37 37 const void *daddr, const void *saddr, unsigned len); 38 - int eth_rebuild_header(struct sk_buff *skb); 39 38 int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr); 40 39 int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh, 41 40 __be16 type);
+1 -11
include/linux/netdevice.h
··· 261 261 unsigned short type, const void *daddr, 262 262 const void *saddr, unsigned int len); 263 263 int (*parse)(const struct sk_buff *skb, unsigned char *haddr); 264 - int (*rebuild)(struct sk_buff *skb); 265 264 int (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type); 266 265 void (*cache_update)(struct hh_cache *hh, 267 266 const struct net_device *dev, ··· 1345 1346 * if one wants to override the ndo_*() functions 1346 1347 * @ethtool_ops: Management operations 1347 1348 * @fwd_ops: Management operations 1348 - * @header_ops: Includes callbacks for creating,parsing,rebuilding,etc 1349 + * @header_ops: Includes callbacks for creating,parsing,caching,etc 1349 1350 * of Layer 2 headers. 1350 1351 * 1351 1352 * @flags: Interface flags (a la BSD) ··· 2396 2397 if (!dev->header_ops || !dev->header_ops->parse) 2397 2398 return 0; 2398 2399 return dev->header_ops->parse(skb, haddr); 2399 - } 2400 - 2401 - static inline int dev_rebuild_header(struct sk_buff *skb) 2402 - { 2403 - const struct net_device *dev = skb->dev; 2404 - 2405 - if (!dev->header_ops || !dev->header_ops->rebuild) 2406 - return 0; 2407 - return dev->header_ops->rebuild(skb); 2408 2400 } 2409 2401 2410 2402 typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len);
-21
net/802/fc.c
··· 75 75 return -hdr_len; 76 76 } 77 77 78 - /* 79 - * A neighbour discovery of some species (eg arp) has completed. We 80 - * can now send the packet. 81 - */ 82 - 83 - static int fc_rebuild_header(struct sk_buff *skb) 84 - { 85 - #ifdef CONFIG_INET 86 - struct fch_hdr *fch=(struct fch_hdr *)skb->data; 87 - struct fcllc *fcllc=(struct fcllc *)(skb->data+sizeof(struct fch_hdr)); 88 - if(fcllc->ethertype != htons(ETH_P_IP)) { 89 - printk("fc_rebuild_header: Don't know how to resolve type %04X addresses ?\n", ntohs(fcllc->ethertype)); 90 - return 0; 91 - } 92 - return arp_find(fch->daddr, skb); 93 - #else 94 - return 0; 95 - #endif 96 - } 97 - 98 78 static const struct header_ops fc_header_ops = { 99 79 .create = fc_header, 100 - .rebuild = fc_rebuild_header, 101 80 }; 102 81 103 82 static void fc_setup(struct net_device *dev)
-26
net/802/fddi.c
··· 87 87 return -hl; 88 88 } 89 89 90 - 91 - /* 92 - * Rebuild the FDDI MAC header. This is called after an ARP 93 - * (or in future other address resolution) has completed on 94 - * this sk_buff. We now let ARP fill in the other fields. 95 - */ 96 - 97 - static int fddi_rebuild_header(struct sk_buff *skb) 98 - { 99 - struct fddihdr *fddi = (struct fddihdr *)skb->data; 100 - 101 - #ifdef CONFIG_INET 102 - if (fddi->hdr.llc_snap.ethertype == htons(ETH_P_IP)) 103 - /* Try to get ARP to resolve the header and fill destination address */ 104 - return arp_find(fddi->daddr, skb); 105 - else 106 - #endif 107 - { 108 - printk("%s: Don't know how to resolve type %04X addresses.\n", 109 - skb->dev->name, ntohs(fddi->hdr.llc_snap.ethertype)); 110 - return 0; 111 - } 112 - } 113 - 114 - 115 90 /* 116 91 * Determine the packet's protocol ID and fill in skb fields. 117 92 * This routine is called before an incoming packet is passed ··· 152 177 153 178 static const struct header_ops fddi_header_ops = { 154 179 .create = fddi_header, 155 - .rebuild = fddi_rebuild_header, 156 180 }; 157 181 158 182
-28
net/802/hippi.c
··· 91 91 92 92 93 93 /* 94 - * Rebuild the HIPPI MAC header. This is called after an ARP has 95 - * completed on this sk_buff. We now let ARP fill in the other fields. 96 - */ 97 - 98 - static int hippi_rebuild_header(struct sk_buff *skb) 99 - { 100 - struct hippi_hdr *hip = (struct hippi_hdr *)skb->data; 101 - 102 - /* 103 - * Only IP is currently supported 104 - */ 105 - 106 - if(hip->snap.ethertype != htons(ETH_P_IP)) 107 - { 108 - printk(KERN_DEBUG "%s: unable to resolve type %X addresses.\n",skb->dev->name,ntohs(hip->snap.ethertype)); 109 - return 0; 110 - } 111 - 112 - /* 113 - * We don't support dynamic ARP on HIPPI, but we use the ARP 114 - * static ARP tables to hold the I-FIELDs. 115 - */ 116 - return arp_find(hip->le.daddr, skb); 117 - } 118 - 119 - 120 - /* 121 94 * Determine the packet's protocol ID. 122 95 */ 123 96 ··· 159 186 160 187 static const struct header_ops hippi_header_ops = { 161 188 .create = hippi_header, 162 - .rebuild = hippi_rebuild_header, 163 189 }; 164 190 165 191
-35
net/8021q/vlan_dev.c
··· 37 37 #include <linux/netpoll.h> 38 38 39 39 /* 40 - * Rebuild the Ethernet MAC header. This is called after an ARP 41 - * (or in future other address resolution) has completed on this 42 - * sk_buff. We now let ARP fill in the other fields. 43 - * 44 - * This routine CANNOT use cached dst->neigh! 45 - * Really, it is used only when dst->neigh is wrong. 46 - * 47 - * TODO: This needs a checkup, I'm ignorant here. --BLG 48 - */ 49 - static int vlan_dev_rebuild_header(struct sk_buff *skb) 50 - { 51 - struct net_device *dev = skb->dev; 52 - struct vlan_ethhdr *veth = (struct vlan_ethhdr *)(skb->data); 53 - 54 - switch (veth->h_vlan_encapsulated_proto) { 55 - #ifdef CONFIG_INET 56 - case htons(ETH_P_IP): 57 - 58 - /* TODO: Confirm this will work with VLAN headers... */ 59 - return arp_find(veth->h_dest, skb); 60 - #endif 61 - default: 62 - pr_debug("%s: unable to resolve type %X addresses\n", 63 - dev->name, ntohs(veth->h_vlan_encapsulated_proto)); 64 - 65 - ether_addr_copy(veth->h_source, dev->dev_addr); 66 - break; 67 - } 68 - 69 - return 0; 70 - } 71 - 72 - /* 73 40 * Create the VLAN header for an arbitrary protocol layer 74 41 * 75 42 * saddr=NULL means use device source address ··· 501 534 502 535 static const struct header_ops vlan_header_ops = { 503 536 .create = vlan_dev_hard_header, 504 - .rebuild = vlan_dev_rebuild_header, 505 537 .parse = eth_header_parse, 506 538 }; 507 539 ··· 520 554 521 555 static const struct header_ops vlan_passthru_header_ops = { 522 556 .create = vlan_passthru_hard_header, 523 - .rebuild = dev_rebuild_header, 524 557 .parse = eth_header_parse, 525 558 }; 526 559
-34
net/ethernet/eth.c
··· 113 113 EXPORT_SYMBOL(eth_header); 114 114 115 115 /** 116 - * eth_rebuild_header- rebuild the Ethernet MAC header. 117 - * @skb: socket buffer to update 118 - * 119 - * This is called after an ARP or IPV6 ndisc it's resolution on this 120 - * sk_buff. We now let protocol (ARP) fill in the other fields. 121 - * 122 - * This routine CANNOT use cached dst->neigh! 123 - * Really, it is used only when dst->neigh is wrong. 124 - */ 125 - int eth_rebuild_header(struct sk_buff *skb) 126 - { 127 - struct ethhdr *eth = (struct ethhdr *)skb->data; 128 - struct net_device *dev = skb->dev; 129 - 130 - switch (eth->h_proto) { 131 - #ifdef CONFIG_INET 132 - case htons(ETH_P_IP): 133 - return arp_find(eth->h_dest, skb); 134 - #endif 135 - default: 136 - netdev_dbg(dev, 137 - "%s: unable to resolve type %X addresses.\n", 138 - dev->name, ntohs(eth->h_proto)); 139 - 140 - memcpy(eth->h_source, dev->dev_addr, ETH_ALEN); 141 - break; 142 - } 143 - 144 - return 0; 145 - } 146 - EXPORT_SYMBOL(eth_rebuild_header); 147 - 148 - /** 149 116 * eth_get_headlen - determine the the length of header for an ethernet frame 150 117 * @data: pointer to start of frame 151 118 * @len: total length of frame ··· 336 369 const struct header_ops eth_header_ops ____cacheline_aligned = { 337 370 .create = eth_header, 338 371 .parse = eth_header_parse, 339 - .rebuild = eth_rebuild_header, 340 372 .cache = eth_header_cache, 341 373 .cache_update = eth_header_cache_update, 342 374 };
-31
net/netrom/nr_dev.c
··· 65 65 return 1; 66 66 } 67 67 68 - #ifdef CONFIG_INET 69 - 70 - static int nr_rebuild_header(struct sk_buff *skb) 71 - { 72 - unsigned char *bp = skb->data; 73 - 74 - if (arp_find(bp + 7, skb)) 75 - return 1; 76 - 77 - bp[6] &= ~AX25_CBIT; 78 - bp[6] &= ~AX25_EBIT; 79 - bp[6] |= AX25_SSSID_SPARE; 80 - bp += AX25_ADDR_LEN; 81 - 82 - bp[6] &= ~AX25_CBIT; 83 - bp[6] |= AX25_EBIT; 84 - bp[6] |= AX25_SSSID_SPARE; 85 - 86 - return 0; 87 - } 88 - 89 - #else 90 - 91 - static int nr_rebuild_header(struct sk_buff *skb) 92 - { 93 - return 1; 94 - } 95 - 96 - #endif 97 - 98 68 static int nr_header(struct sk_buff *skb, struct net_device *dev, 99 69 unsigned short type, 100 70 const void *daddr, const void *saddr, unsigned int len) ··· 158 188 159 189 static const struct header_ops nr_header_ops = { 160 190 .create = nr_header, 161 - .rebuild= nr_rebuild_header, 162 191 }; 163 192 164 193 static const struct net_device_ops nr_netdev_ops = {
-14
net/rose/rose_dev.c
··· 56 56 return -37; 57 57 } 58 58 59 - static int rose_rebuild_header(struct sk_buff *skb) 60 - { 61 - #ifdef CONFIG_INET 62 - unsigned char *bp = (unsigned char *)skb->data; 63 - 64 - if (arp_find(bp + 7, skb)) { 65 - return 1; 66 - } 67 - 68 - #endif 69 - return 0; 70 - } 71 - 72 59 static int rose_set_mac_address(struct net_device *dev, void *addr) 73 60 { 74 61 struct sockaddr *sa = addr; ··· 120 133 121 134 static const struct header_ops rose_header_ops = { 122 135 .create = rose_header, 123 - .rebuild = rose_rebuild_header, 124 136 }; 125 137 126 138 static const struct net_device_ops rose_netdev_ops = {