3 * Ethernet-type device handling.
5 * Authors: Ben Greear <greearb@candelatech.com>
6 * Please send support related email to: vlan@scry.wanfear.com
7 * VLAN Home Page: http://www.candelatech.com/~greear/vlan.html
9 * Fixes: Mar 22 2001: Martin Bokaemper <mbokaemper@unispherenetworks.com>
10 * - reset skb->pkt_type on incoming packets when MAC was changed
11 * - see that changed MAC is saddr for outgoing packets
12 * Oct 20, 2001: Ard van Breeman:
13 * - Fix MC-list, finally.
14 * - Flush MC-list on VLAN destroy.
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License
19 * as published by the Free Software Foundation; either version
20 * 2 of the License, or (at your option) any later version.
23 #include <linux/module.h>
26 #include <linux/init.h>
27 #include <asm/uaccess.h> /* for copy_from_user */
28 #include <linux/skbuff.h>
29 #include <linux/netdevice.h>
30 #include <linux/etherdevice.h>
31 #include <net/datalink.h>
32 #include <net/p8022.h>
37 #include <linux/if_vlan.h>
41 * Rebuild the Ethernet MAC header. This is called after an ARP
42 * (or in future other address resolution) has completed on this
43 * sk_buff. We now let ARP fill in the other fields.
45 * This routine CANNOT use cached dst->neigh!
46 * Really, it is used only when dst->neigh is wrong.
48 * TODO: This needs a checkup, I'm ignorant here. --BLG
50 int vlan_dev_rebuild_header(struct sk_buff *skb)
52 struct net_device *dev = skb->dev;
53 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)(skb->data);
55 switch (veth->h_vlan_encapsulated_proto) {
57 case __constant_htons(ETH_P_IP):
59 /* TODO: Confirm this will work with VLAN headers... */
60 return arp_find(veth->h_dest, skb);
64 "%s: unable to resolve type %X addresses.\n",
65 dev->name, ntohs(veth->h_vlan_encapsulated_proto));
67 memcpy(veth->h_source, dev->dev_addr, ETH_ALEN);
74 static inline struct sk_buff *vlan_check_reorder_header(struct sk_buff *skb)
76 if (VLAN_DEV_INFO(skb->dev)->flags & 1) {
77 if (skb_shared(skb) || skb_cloned(skb)) {
78 struct sk_buff *nskb = skb_copy(skb, GFP_ATOMIC);
83 /* Lifted from Gleb's VLAN code... */
84 memmove(skb->data - ETH_HLEN,
85 skb->data - VLAN_ETH_HLEN, 12);
86 skb->mac_header += VLAN_HLEN;
94 * Determine the packet's protocol ID. The rule here is that we
95 * assume 802.3 if the type field is short enough to be a length.
96 * This is normal practice and works for any 'now in use' protocol.
98 * Also, at this point we assume that we ARE dealing exclusively with
99 * VLAN packets, or packets that should be made into VLAN packets based
100 * on a default VLAN ID.
102 * NOTE: Should be similar to ethernet/eth.c.
104 * SANITY NOTE: This method is called when a packet is moving up the stack
105 * towards userland. To get here, it would have already passed
106 * through the ethernet/eth.c eth_type_trans() method.
107 * SANITY NOTE 2: We are referencing to the VLAN_HDR frields, which MAY be
108 * stored UNALIGNED in the memory. RISC systems don't like
109 * such cases very much...
110 * SANITY NOTE 2a: According to Dave Miller & Alexey, it will always be aligned,
111 * so there doesn't need to be any of the unaligned stuff. It has
112 * been commented out now... --Ben
115 int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
116 struct packet_type* ptype, struct net_device *orig_dev)
118 unsigned char *rawp = NULL;
119 struct vlan_hdr *vhdr = (struct vlan_hdr *)(skb->data);
121 struct net_device_stats *stats;
122 unsigned short vlan_TCI;
125 /* vlan_TCI = ntohs(get_unaligned(&vhdr->h_vlan_TCI)); */
126 vlan_TCI = ntohs(vhdr->h_vlan_TCI);
128 vid = (vlan_TCI & VLAN_VID_MASK);
131 printk(VLAN_DBG "%s: skb: %p vlan_id: %hx\n",
132 __FUNCTION__, skb, vid);
135 /* Ok, we will find the correct VLAN device, strip the header,
136 * and then go on as usual.
139 /* We have 12 bits of vlan ID.
141 * We must not drop allow preempt until we hold a
142 * reference to the device (netif_rx does that) or we
147 skb->dev = __find_vlan_dev(dev, vid);
152 printk(VLAN_DBG "%s: ERROR: No net_device for VID: %i on dev: %s [%i]\n",
153 __FUNCTION__, (unsigned int)(vid), dev->name, dev->ifindex);
159 skb->dev->last_rx = jiffies;
161 /* Bump the rx counters for the VLAN device. */
162 stats = vlan_dev_get_stats(skb->dev);
164 stats->rx_bytes += skb->len;
166 /* Take off the VLAN header (4 bytes currently) */
167 skb_pull_rcsum(skb, VLAN_HLEN);
169 /* Ok, lets check to make sure the device (dev) we
170 * came in on is what this VLAN is attached to.
173 if (dev != VLAN_DEV_INFO(skb->dev)->real_dev) {
177 printk(VLAN_DBG "%s: dropping skb: %p because came in on wrong device, dev: %s real_dev: %s, skb_dev: %s\n",
178 __FUNCTION__, skb, dev->name,
179 VLAN_DEV_INFO(skb->dev)->real_dev->name,
188 * Deal with ingress priority mapping.
190 skb->priority = vlan_get_ingress_priority(skb->dev, ntohs(vhdr->h_vlan_TCI));
193 printk(VLAN_DBG "%s: priority: %lu for TCI: %hu (hbo)\n",
194 __FUNCTION__, (unsigned long)(skb->priority),
195 ntohs(vhdr->h_vlan_TCI));
198 /* The ethernet driver already did the pkt_type calculations
201 switch (skb->pkt_type) {
202 case PACKET_BROADCAST: /* Yeah, stats collect these together.. */
203 // stats->broadcast ++; // no such counter :-(
206 case PACKET_MULTICAST:
210 case PACKET_OTHERHOST:
211 /* Our lower layer thinks this is not local, let's make sure.
212 * This allows the VLAN to have a different MAC than the underlying
213 * device, and still route correctly.
215 if (!compare_ether_addr(eth_hdr(skb)->h_dest, skb->dev->dev_addr)) {
216 /* It is for our (changed) MAC-address! */
217 skb->pkt_type = PACKET_HOST;
224 /* Was a VLAN packet, grab the encapsulated protocol, which the layer
225 * three protocols care about.
227 /* proto = get_unaligned(&vhdr->h_vlan_encapsulated_proto); */
228 proto = vhdr->h_vlan_encapsulated_proto;
230 skb->protocol = proto;
231 if (ntohs(proto) >= 1536) {
232 /* place it back on the queue to be handled by
233 * true layer 3 protocols.
236 /* See if we are configured to re-write the VLAN header
237 * to make it look like ethernet...
239 skb = vlan_check_reorder_header(skb);
241 /* Can be null if skb-clone fails when re-ordering */
245 /* TODO: Add a more specific counter here. */
255 * This is a magic hack to spot IPX packets. Older Novell breaks
256 * the protocol design and runs IPX over 802.3 without an 802.2 LLC
257 * layer. We look for FFFF which isn't a used 802.2 SSAP/DSAP. This
258 * won't work for fault tolerant netware but does for the rest.
260 if (*(unsigned short *)rawp == 0xFFFF) {
261 skb->protocol = htons(ETH_P_802_3);
262 /* place it back on the queue to be handled by true layer 3 protocols.
265 /* See if we are configured to re-write the VLAN header
266 * to make it look like ethernet...
268 skb = vlan_check_reorder_header(skb);
270 /* Can be null if skb-clone fails when re-ordering */
274 /* TODO: Add a more specific counter here. */
284 skb->protocol = htons(ETH_P_802_2);
285 /* place it back on the queue to be handled by upper layer protocols.
288 /* See if we are configured to re-write the VLAN header
289 * to make it look like ethernet...
291 skb = vlan_check_reorder_header(skb);
293 /* Can be null if skb-clone fails when re-ordering */
297 /* TODO: Add a more specific counter here. */
304 static inline unsigned short vlan_dev_get_egress_qos_mask(struct net_device* dev,
307 struct vlan_priority_tci_mapping *mp =
308 VLAN_DEV_INFO(dev)->egress_priority_map[(skb->priority & 0xF)];
311 if (mp->priority == skb->priority) {
312 return mp->vlan_qos; /* This should already be shifted to mask
313 * correctly with the VLAN's TCI
322 * Create the VLAN header for an arbitrary protocol layer
324 * saddr=NULL means use device source address
325 * daddr=NULL means leave destination address (eg unresolved arp)
327 * This is called when the SKB is moving down the stack towards the
330 int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
331 unsigned short type, void *daddr, void *saddr,
334 struct vlan_hdr *vhdr;
335 unsigned short veth_TCI = 0;
337 int build_vlan_header = 0;
338 struct net_device *vdev = dev; /* save this for the bottom of the method */
341 printk(VLAN_DBG "%s: skb: %p type: %hx len: %x vlan_id: %hx, daddr: %p\n",
342 __FUNCTION__, skb, type, len, VLAN_DEV_INFO(dev)->vlan_id, daddr);
345 /* build vlan header only if re_order_header flag is NOT set. This
346 * fixes some programs that get confused when they see a VLAN device
347 * sending a frame that is VLAN encoded (the consensus is that the VLAN
348 * device should look completely like an Ethernet device when the
349 * REORDER_HEADER flag is set) The drawback to this is some extra
350 * header shuffling in the hard_start_xmit. Users can turn off this
351 * REORDER behaviour with the vconfig tool.
353 build_vlan_header = ((VLAN_DEV_INFO(dev)->flags & 1) == 0);
355 if (build_vlan_header) {
356 vhdr = (struct vlan_hdr *) skb_push(skb, VLAN_HLEN);
358 /* build the four bytes that make this a VLAN header. */
360 /* Now, construct the second two bytes. This field looks something
362 * usr_priority: 3 bits (high bits)
364 * VLAN ID 12 bits (low bits)
367 veth_TCI = VLAN_DEV_INFO(dev)->vlan_id;
368 veth_TCI |= vlan_dev_get_egress_qos_mask(dev, skb);
370 vhdr->h_vlan_TCI = htons(veth_TCI);
373 * Set the protocol type.
374 * For a packet of type ETH_P_802_3 we put the length in here instead.
375 * It is up to the 802.2 layer to carry protocol information.
378 if (type != ETH_P_802_3) {
379 vhdr->h_vlan_encapsulated_proto = htons(type);
381 vhdr->h_vlan_encapsulated_proto = htons(len);
384 skb->protocol = htons(ETH_P_8021Q);
385 skb_reset_network_header(skb);
388 /* Before delegating work to the lower layer, enter our MAC-address */
390 saddr = dev->dev_addr;
392 dev = VLAN_DEV_INFO(dev)->real_dev;
394 /* MPLS can send us skbuffs w/out enough space. This check will grow the
395 * skb if it doesn't have enough headroom. Not a beautiful solution, so
396 * I'll tick a counter so that users can know it's happening... If they
400 /* NOTE: This may still break if the underlying device is not the final
401 * device (and thus there are more headers to add...) It should work for
402 * good-ole-ethernet though.
404 if (skb_headroom(skb) < dev->hard_header_len) {
405 struct sk_buff *sk_tmp = skb;
406 skb = skb_realloc_headroom(sk_tmp, dev->hard_header_len);
409 struct net_device_stats *stats = vlan_dev_get_stats(vdev);
413 VLAN_DEV_INFO(vdev)->cnt_inc_headroom_on_tx++;
415 printk(VLAN_DBG "%s: %s: had to grow skb.\n", __FUNCTION__, vdev->name);
419 if (build_vlan_header) {
420 /* Now make the underlying real hard header */
421 rc = dev->hard_header(skb, dev, ETH_P_8021Q, daddr, saddr, len + VLAN_HLEN);
429 /* If here, then we'll just make a normal looking ethernet frame,
430 * but, the hard_start_xmit method will insert the tag (it has to
431 * be able to do this for bridged and other skbs that don't come
432 * down the protocol stack in an orderly manner.
434 rc = dev->hard_header(skb, dev, type, daddr, saddr, len);
440 int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
442 struct net_device_stats *stats = vlan_dev_get_stats(dev);
443 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)(skb->data);
445 /* Handle non-VLAN frames if they are sent to us, for example by DHCP.
447 * NOTE: THIS ASSUMES DIX ETHERNET, SPECIFICALLY NOT SUPPORTING
448 * OTHER THINGS LIKE FDDI/TokenRing/802.3 SNAPs...
451 if (veth->h_vlan_proto != htons(ETH_P_8021Q)) {
452 int orig_headroom = skb_headroom(skb);
453 unsigned short veth_TCI;
455 /* This is not a VLAN frame...but we can fix that! */
456 VLAN_DEV_INFO(dev)->cnt_encap_on_xmit++;
459 printk(VLAN_DBG "%s: proto to encap: 0x%hx (hbo)\n",
460 __FUNCTION__, htons(veth->h_vlan_proto));
462 /* Construct the second two bytes. This field looks something
464 * usr_priority: 3 bits (high bits)
466 * VLAN ID 12 bits (low bits)
468 veth_TCI = VLAN_DEV_INFO(dev)->vlan_id;
469 veth_TCI |= vlan_dev_get_egress_qos_mask(dev, skb);
471 skb = __vlan_put_tag(skb, veth_TCI);
477 if (orig_headroom < VLAN_HLEN) {
478 VLAN_DEV_INFO(dev)->cnt_inc_headroom_on_tx++;
483 printk(VLAN_DBG "%s: about to send skb: %p to dev: %s\n",
484 __FUNCTION__, skb, skb->dev->name);
485 printk(VLAN_DBG " %2hx.%2hx.%2hx.%2xh.%2hx.%2hx %2hx.%2hx.%2hx.%2hx.%2hx.%2hx %4hx %4hx %4hx\n",
486 veth->h_dest[0], veth->h_dest[1], veth->h_dest[2], veth->h_dest[3], veth->h_dest[4], veth->h_dest[5],
487 veth->h_source[0], veth->h_source[1], veth->h_source[2], veth->h_source[3], veth->h_source[4], veth->h_source[5],
488 veth->h_vlan_proto, veth->h_vlan_TCI, veth->h_vlan_encapsulated_proto);
491 stats->tx_packets++; /* for statics only */
492 stats->tx_bytes += skb->len;
494 skb->dev = VLAN_DEV_INFO(dev)->real_dev;
500 int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
502 struct net_device_stats *stats = vlan_dev_get_stats(dev);
503 unsigned short veth_TCI;
505 /* Construct the second two bytes. This field looks something
507 * usr_priority: 3 bits (high bits)
509 * VLAN ID 12 bits (low bits)
511 veth_TCI = VLAN_DEV_INFO(dev)->vlan_id;
512 veth_TCI |= vlan_dev_get_egress_qos_mask(dev, skb);
513 skb = __vlan_hwaccel_put_tag(skb, veth_TCI);
516 stats->tx_bytes += skb->len;
518 skb->dev = VLAN_DEV_INFO(dev)->real_dev;
524 int vlan_dev_change_mtu(struct net_device *dev, int new_mtu)
526 /* TODO: gotta make sure the underlying layer can handle it,
527 * maybe an IFF_VLAN_CAPABLE flag for devices?
529 if (VLAN_DEV_INFO(dev)->real_dev->mtu < new_mtu)
537 int vlan_dev_set_ingress_priority(char *dev_name, __u32 skb_prio, short vlan_prio)
539 struct net_device *dev = dev_get_by_name(dev_name);
542 if (dev->priv_flags & IFF_802_1Q_VLAN) {
543 /* see if a priority mapping exists.. */
544 VLAN_DEV_INFO(dev)->ingress_priority_map[vlan_prio & 0x7] = skb_prio;
554 int vlan_dev_set_egress_priority(char *dev_name, __u32 skb_prio, short vlan_prio)
556 struct net_device *dev = dev_get_by_name(dev_name);
557 struct vlan_priority_tci_mapping *mp = NULL;
558 struct vlan_priority_tci_mapping *np;
561 if (dev->priv_flags & IFF_802_1Q_VLAN) {
562 /* See if a priority mapping exists.. */
563 mp = VLAN_DEV_INFO(dev)->egress_priority_map[skb_prio & 0xF];
565 if (mp->priority == skb_prio) {
566 mp->vlan_qos = ((vlan_prio << 13) & 0xE000);
573 /* Create a new mapping then. */
574 mp = VLAN_DEV_INFO(dev)->egress_priority_map[skb_prio & 0xF];
575 np = kmalloc(sizeof(struct vlan_priority_tci_mapping), GFP_KERNEL);
578 np->priority = skb_prio;
579 np->vlan_qos = ((vlan_prio << 13) & 0xE000);
580 VLAN_DEV_INFO(dev)->egress_priority_map[skb_prio & 0xF] = np;
593 /* Flags are defined in the vlan_dev_info class in include/linux/if_vlan.h file. */
594 int vlan_dev_set_vlan_flag(char *dev_name, __u32 flag, short flag_val)
596 struct net_device *dev = dev_get_by_name(dev_name);
599 if (dev->priv_flags & IFF_802_1Q_VLAN) {
600 /* verify flag is supported */
603 VLAN_DEV_INFO(dev)->flags |= 1;
605 VLAN_DEV_INFO(dev)->flags &= ~1;
610 printk(KERN_ERR "%s: flag %i is not valid.\n",
611 __FUNCTION__, (int)(flag));
617 "%s: %s is not a vlan device, priv_flags: %hX.\n",
618 __FUNCTION__, dev->name, dev->priv_flags);
622 printk(KERN_ERR "%s: Could not find device: %s\n",
623 __FUNCTION__, dev_name);
630 int vlan_dev_get_realdev_name(const char *dev_name, char* result)
632 struct net_device *dev = dev_get_by_name(dev_name);
635 if (dev->priv_flags & IFF_802_1Q_VLAN) {
636 strncpy(result, VLAN_DEV_INFO(dev)->real_dev->name, 23);
648 int vlan_dev_get_vid(const char *dev_name, unsigned short* result)
650 struct net_device *dev = dev_get_by_name(dev_name);
653 if (dev->priv_flags & IFF_802_1Q_VLAN) {
654 *result = VLAN_DEV_INFO(dev)->vlan_id;
667 int vlan_dev_set_mac_address(struct net_device *dev, void *addr_struct_p)
669 struct sockaddr *addr = (struct sockaddr *)(addr_struct_p);
672 if (netif_running(dev))
675 memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
677 printk("%s: Setting MAC address to ", dev->name);
678 for (i = 0; i < 6; i++)
679 printk(" %2.2x", dev->dev_addr[i]);
682 if (memcmp(VLAN_DEV_INFO(dev)->real_dev->dev_addr,
684 dev->addr_len) != 0) {
685 if (!(VLAN_DEV_INFO(dev)->real_dev->flags & IFF_PROMISC)) {
686 int flgs = VLAN_DEV_INFO(dev)->real_dev->flags;
688 /* Increment our in-use promiscuity counter */
689 dev_set_promiscuity(VLAN_DEV_INFO(dev)->real_dev, 1);
691 /* Make PROMISC visible to the user. */
693 printk("VLAN (%s): Setting underlying device (%s) to promiscious mode.\n",
694 dev->name, VLAN_DEV_INFO(dev)->real_dev->name);
695 dev_change_flags(VLAN_DEV_INFO(dev)->real_dev, flgs);
698 printk("VLAN (%s): Underlying device (%s) has same MAC, not checking promiscious mode.\n",
699 dev->name, VLAN_DEV_INFO(dev)->real_dev->name);
705 static inline int vlan_dmi_equals(struct dev_mc_list *dmi1,
706 struct dev_mc_list *dmi2)
708 return ((dmi1->dmi_addrlen == dmi2->dmi_addrlen) &&
709 (memcmp(dmi1->dmi_addr, dmi2->dmi_addr, dmi1->dmi_addrlen) == 0));
712 /** dmi is a single entry into a dev_mc_list, a single node. mc_list is
713 * an entire list, and we'll iterate through it.
715 static int vlan_should_add_mc(struct dev_mc_list *dmi, struct dev_mc_list *mc_list)
717 struct dev_mc_list *idmi;
719 for (idmi = mc_list; idmi != NULL; ) {
720 if (vlan_dmi_equals(dmi, idmi)) {
721 if (dmi->dmi_users > idmi->dmi_users)
733 static inline void vlan_destroy_mc_list(struct dev_mc_list *mc_list)
735 struct dev_mc_list *dmi = mc_list;
736 struct dev_mc_list *next;
745 static void vlan_copy_mc_list(struct dev_mc_list *mc_list, struct vlan_dev_info *vlan_info)
747 struct dev_mc_list *dmi, *new_dmi;
749 vlan_destroy_mc_list(vlan_info->old_mc_list);
750 vlan_info->old_mc_list = NULL;
752 for (dmi = mc_list; dmi != NULL; dmi = dmi->next) {
753 new_dmi = kmalloc(sizeof(*new_dmi), GFP_ATOMIC);
754 if (new_dmi == NULL) {
755 printk(KERN_ERR "vlan: cannot allocate memory. "
756 "Multicast may not work properly from now.\n");
760 /* Copy whole structure, then make new 'next' pointer */
762 new_dmi->next = vlan_info->old_mc_list;
763 vlan_info->old_mc_list = new_dmi;
767 static void vlan_flush_mc_list(struct net_device *dev)
769 struct dev_mc_list *dmi = dev->mc_list;
772 printk(KERN_DEBUG "%s: del %.2x:%.2x:%.2x:%.2x:%.2x:%.2x mcast address from vlan interface\n",
780 dev_mc_delete(dev, dmi->dmi_addr, dmi->dmi_addrlen, 0);
784 /* dev->mc_list is NULL by the time we get here. */
785 vlan_destroy_mc_list(VLAN_DEV_INFO(dev)->old_mc_list);
786 VLAN_DEV_INFO(dev)->old_mc_list = NULL;
789 int vlan_dev_open(struct net_device *dev)
791 if (!(VLAN_DEV_INFO(dev)->real_dev->flags & IFF_UP))
797 int vlan_dev_stop(struct net_device *dev)
799 vlan_flush_mc_list(dev);
803 int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
805 struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev;
807 int err = -EOPNOTSUPP;
809 strncpy(ifrr.ifr_name, real_dev->name, IFNAMSIZ);
810 ifrr.ifr_ifru = ifr->ifr_ifru;
816 if (real_dev->do_ioctl && netif_device_present(real_dev))
817 err = real_dev->do_ioctl(real_dev, &ifrr, cmd);
821 err = dev_ethtool(&ifrr);
825 ifr->ifr_ifru = ifrr.ifr_ifru;
830 /** Taken from Gleb + Lennert's VLAN code, and modified... */
831 void vlan_dev_set_multicast_list(struct net_device *vlan_dev)
833 struct dev_mc_list *dmi;
834 struct net_device *real_dev;
837 if (vlan_dev && (vlan_dev->priv_flags & IFF_802_1Q_VLAN)) {
838 /* Then it's a real vlan device, as far as we can tell.. */
839 real_dev = VLAN_DEV_INFO(vlan_dev)->real_dev;
841 /* compare the current promiscuity to the last promisc we had.. */
842 inc = vlan_dev->promiscuity - VLAN_DEV_INFO(vlan_dev)->old_promiscuity;
844 printk(KERN_INFO "%s: dev_set_promiscuity(master, %d)\n",
845 vlan_dev->name, inc);
846 dev_set_promiscuity(real_dev, inc); /* found in dev.c */
847 VLAN_DEV_INFO(vlan_dev)->old_promiscuity = vlan_dev->promiscuity;
850 inc = vlan_dev->allmulti - VLAN_DEV_INFO(vlan_dev)->old_allmulti;
852 printk(KERN_INFO "%s: dev_set_allmulti(master, %d)\n",
853 vlan_dev->name, inc);
854 dev_set_allmulti(real_dev, inc); /* dev.c */
855 VLAN_DEV_INFO(vlan_dev)->old_allmulti = vlan_dev->allmulti;
858 /* looking for addresses to add to master's list */
859 for (dmi = vlan_dev->mc_list; dmi != NULL; dmi = dmi->next) {
860 if (vlan_should_add_mc(dmi, VLAN_DEV_INFO(vlan_dev)->old_mc_list)) {
861 dev_mc_add(real_dev, dmi->dmi_addr, dmi->dmi_addrlen, 0);
862 printk(KERN_DEBUG "%s: add %.2x:%.2x:%.2x:%.2x:%.2x:%.2x mcast address to master interface\n",
873 /* looking for addresses to delete from master's list */
874 for (dmi = VLAN_DEV_INFO(vlan_dev)->old_mc_list; dmi != NULL; dmi = dmi->next) {
875 if (vlan_should_add_mc(dmi, vlan_dev->mc_list)) {
876 /* if we think we should add it to the new list, then we should really
877 * delete it from the real list on the underlying device.
879 dev_mc_delete(real_dev, dmi->dmi_addr, dmi->dmi_addrlen, 0);
880 printk(KERN_DEBUG "%s: del %.2x:%.2x:%.2x:%.2x:%.2x:%.2x mcast address from master interface\n",
891 /* save multicast list */
892 vlan_copy_mc_list(vlan_dev->mc_list, VLAN_DEV_INFO(vlan_dev));