Add Virtual LAN support.

This patch adds support for virtual LAN (VLAN) tagging. VLAN tagging allows
multiple VLANs in a bridged network to share the same physical network link
but maintain isolation:

http://en.wikipedia.org/wiki/IEEE_802.1Q

* grub-core/net/ethernet.c: Add check, get, and set vlan tag id.
* grub-core/net/drivers/ieee1275/ofnet.c: Get vlan tag id from bootargs.
* grub-core/net/arp.c: Add check.
* grub-core/net/ip.c: Likewise.
* include/grub/net/arp.h: Add vlantag attribute.
* include/grub/net/ip.h: Likewise.
This commit is contained in:
Paulo Flabiano Smorigo committed 2013-12-23 12:32:47 -02:00
1 parent 8ff3c31f6d
commit af768f8d41
8 files changed
+109 -20

No files matched your search

+10 -2
View File
@@ -121,8 +121,8 @@ grub_net_arp_send_request (struct grub_net_network_level_interface *inf,
}
grub_err_t
grub_net_arp_receive (struct grub_net_buff *nb,
struct grub_net_card *card)
grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card,
grub_uint16_t *vlantag)
{
struct arphdr *arp_header = (struct arphdr *) nb->data;
grub_uint8_t *sender_hardware_address;
@@ -157,6 +157,14 @@ grub_net_arp_receive (struct grub_net_buff *nb,
FOR_NET_NETWORK_LEVEL_INTERFACES (inf)
{
/* Verify vlantag id */
if (inf->card == card && inf->vlantag != *vlantag)
{
grub_dprintf ("net", "invalid vlantag! %x != %x\n",
inf->vlantag, *vlantag);
break;
}
/* Am I the protocol address target? */
if (grub_net_addr_cmp (&inf->address, &target_addr) == 0
&& grub_be_to_cpu16 (arp_header->op) == ARP_REQUEST)