diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c index f84d4ff66..ea8943a32 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -68,18 +68,18 @@ parse_dhcp_vendor (const char *name, void *vend, int limit) tagtype = *ptr++; /* Pad tag. */ - if (tagtype == 0) + if (tagtype == GRUB_NET_BOOTP_PAD) continue; /* End tag. */ - if (tagtype == 0xff) + if (tagtype == GRUB_NET_BOOTP_END) return; taglength = *ptr++; switch (tagtype) { - case 3: + case GRUB_NET_BOOTP_ROUTER: if (taglength == 4) { grub_net_network_level_netaddress_t target; @@ -95,19 +95,32 @@ parse_dhcp_vendor (const char *name, void *vend, int limit) grub_net_add_route_gw (rname, target, gw); } break; - case 12: + case GRUB_NET_BOOTP_DNS: + { + int i; + for (i = 0; i < taglength / 4; i++) + { + struct grub_net_network_level_address s; + s.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4; + s.ipv4 = grub_get_unaligned32 (ptr); + grub_net_add_dns_server (&s); + ptr += 4; + } + } + break; + case GRUB_NET_BOOTP_HOSTNAME: set_env_limn_ro (name, "hostname", (char *) ptr, taglength); break; - case 15: + case GRUB_NET_BOOTP_DOMAIN: set_env_limn_ro (name, "domain", (char *) ptr, taglength); break; - case 17: + case GRUB_NET_BOOTP_ROOT_PATH: set_env_limn_ro (name, "rootpath", (char *) ptr, taglength); break; - case 18: + case GRUB_NET_BOOTP_EXTENSIONS_PATH: set_env_limn_ro (name, "extensionspath", (char *) ptr, taglength); break; diff --git a/grub-core/net/dns.c b/grub-core/net/dns.c index 696b3ccca..bad2745a7 100644 --- a/grub-core/net/dns.c +++ b/grub-core/net/dns.c @@ -674,15 +674,15 @@ grub_dns_init (void) { cmd = grub_register_command ("net_nslookup", grub_cmd_nslookup, "ADDRESS DNSSERVER", - N_("perform a DNS lookup")); + N_("Perform a DNS lookup")); cmd_add = grub_register_command ("net_add_dns", grub_cmd_add_dns, "DNSSERVER", - N_("add a DNS server")); + N_("Add a DNS server")); cmd_del = grub_register_command ("net_del_dns", grub_cmd_del_dns, "DNSSERVER", - N_("remove a DNS server")); - cmd_list = grub_register_command ("net_del_dns", grub_cmd_list_dns, - NULL, N_("remove a DNS server")); + N_("Remove a DNS server")); + cmd_list = grub_register_command ("net_ls_dns", grub_cmd_list_dns, + NULL, N_("List DNS servers")); } void diff --git a/include/grub/net.h b/include/grub/net.h index dd566354d..3913272eb 100644 --- a/include/grub/net.h +++ b/include/grub/net.h @@ -396,6 +396,18 @@ struct grub_net_bootp_packet #define GRUB_NET_BOOTP_RFC1048_MAGIC_2 0x53 #define GRUB_NET_BOOTP_RFC1048_MAGIC_3 0x63 +enum + { + GRUB_NET_BOOTP_PAD = 0x00, + GRUB_NET_BOOTP_ROUTER = 0x03, + GRUB_NET_BOOTP_DNS = 0x06, + GRUB_NET_BOOTP_HOSTNAME = 0x0c, + GRUB_NET_BOOTP_DOMAIN = 0x0f, + GRUB_NET_BOOTP_ROOT_PATH = 0x11, + GRUB_NET_BOOTP_EXTENSIONS_PATH = 0x12, + GRUB_NET_BOOTP_END = 0xff + }; + struct grub_net_network_level_interface * grub_net_configure_by_dhcp_ack (const char *name, struct grub_net_card *card,