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:
parent
99ab28563b
commit
5696d56d33
7 changed files with 92 additions and 20 deletions
|
@ -153,11 +153,11 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath,
|
|||
char *comma_char = 0;
|
||||
char *equal_char = 0;
|
||||
grub_size_t field_counter = 0;
|
||||
|
||||
grub_net_network_level_address_t client_addr, gateway_addr, subnet_mask;
|
||||
grub_net_link_level_address_t hw_addr;
|
||||
grub_net_interface_flags_t flags = 0;
|
||||
struct grub_net_network_level_interface *inter = NULL;
|
||||
grub_uint16_t vlantag = 0;
|
||||
|
||||
hw_addr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
|
||||
|
||||
|
@ -175,6 +175,11 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath,
|
|||
*equal_char = 0;
|
||||
grub_env_set_net_property ((*card)->name, args, equal_char + 1,
|
||||
grub_strlen(equal_char + 1));
|
||||
|
||||
if ((grub_strcmp (args, "vtag") == 0) &&
|
||||
(grub_strlen (equal_char + 1) == 8))
|
||||
vlantag = grub_strtoul (equal_char + 1 + 4, 0, 16);
|
||||
|
||||
*equal_char = '=';
|
||||
}
|
||||
else
|
||||
|
@ -213,8 +218,10 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath,
|
|||
hw_addr.mac, sizeof(hw_addr.mac), 0);
|
||||
inter = grub_net_add_addr ((*card)->name, *card, &client_addr, &hw_addr,
|
||||
flags);
|
||||
inter->vlantag = vlantag;
|
||||
grub_net_add_ipv4_local (inter,
|
||||
__builtin_ctz (~grub_le_to_cpu32 (subnet_mask.ipv4)));
|
||||
|
||||
}
|
||||
|
||||
if (gateway_addr.ipv4 != 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue