static void BootpVendorFieldProcess(u8 * ext){ int size = *(ext + 1); NetBootFileSize = 0; switch(*ext){ /* Fixed length fields */ case 1: /* Subnet mask */ if (NetOurSubnetMask == 0){ NetCopyIP(&NetOurSubnetMask, (IPaddr_t *)(ext + 2)); } break; case 2: /* Time offset - Not yet supported */ break; /* Variable length fields */ case 3: /* Gateways list */ if(NetOurGatewayIP == 0){ NetCopyIP(&NetOurGatewayIP, (IPaddr_t *)(ext + 2)); } break; case 4: /* Time server - Not yet supported */ break; case 5: /* IEN-116 name server - Not yet supported */ break; case 6: if(NetOurDNSIP == 0){ NetCopyIP(&NetOurDNSIP, (IPaddr_t *)(ext + 2)); } #if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2) if((NetOurDNS2IP == 0) && (size > 4)){ NetCopyIP(&NetOurDNS2IP, (IPaddr_t *)(ext + 2 + 4)); } #endif break; case 7: /* Log server - Not yet supported */ break; case 8: /* Cookie/Quote server - Not yet supported */ break; case 9: /* LPR server - Not yet supported */ break; case 10: /* Impress server - Not yet supported */ break; case 11: /* RPL server - Not yet supported */ break; case 12: /* Host name */ if(NetOurHostName[0] == 0){ size = truncate_sz("Host Name", sizeof(NetOurHostName), size); memcpy(&NetOurHostName, ext + 2, size); NetOurHostName[size] = 0; } break; case 13: /* Boot file size */ if(size == 2){ NetBootFileSize = ntohs(*(ushort *)(ext + 2)); } else if(size == 4){ NetBootFileSize = ntohl(*(ulong *)(ext + 2)); } break; case 14: /* Merit dump file - Not yet supported */ break; case 15: /* Domain name - Not yet supported */ break; case 16: /* Swap server - Not yet supported */ break; case 17: /* Root path */ if(NetOurRootPath[0] == 0){ size = truncate_sz("Root Path", sizeof(NetOurRootPath), size); memcpy(&NetOurRootPath, ext + 2, size); NetOurRootPath[size] = 0; } break; case 18: /* Extension path - Not yet supported */ /* * This can be used to send the information of the * vendor area in another file that the client can * access via TFTP. */ break; /* IP host layer fields */ case 40: /* NIS Domain name */ if(NetOurNISDomain[0] == 0){ size = truncate_sz("NIS Domain Name", sizeof(NetOurNISDomain), size); memcpy(&NetOurNISDomain, ext + 2, size); NetOurNISDomain[size] = 0; } break; /* Application layer fields */ case 43: /* Vendor specific info - Not yet supported */ /* * Binary information to exchange specific * product information. */ break; /* Reserved (custom) fields (128..254) */ } }
static void bootp_process_vendor_field(u8 *ext) { int size = *(ext + 1); debug("[BOOTP] Processing extension %d... (%d bytes)\n", *ext, *(ext + 1)); net_boot_file_expected_size_in_blocks = 0; switch (*ext) { /* Fixed length fields */ case 1: /* Subnet mask */ if (net_netmask.s_addr == 0) net_copy_ip(&net_netmask, (struct in_addr *)(ext + 2)); break; case 2: /* Time offset - Not yet supported */ break; /* Variable length fields */ case 3: /* Gateways list */ if (net_gateway.s_addr == 0) net_copy_ip(&net_gateway, (struct in_addr *)(ext + 2)); break; case 4: /* Time server - Not yet supported */ break; case 5: /* IEN-116 name server - Not yet supported */ break; case 6: if (net_dns_server.s_addr == 0) net_copy_ip(&net_dns_server, (struct in_addr *)(ext + 2)); #if defined(CONFIG_BOOTP_DNS2) if ((net_dns_server2.s_addr == 0) && (size > 4)) net_copy_ip(&net_dns_server2, (struct in_addr *)(ext + 2 + 4)); #endif break; case 7: /* Log server - Not yet supported */ break; case 8: /* Cookie/Quote server - Not yet supported */ break; case 9: /* LPR server - Not yet supported */ break; case 10: /* Impress server - Not yet supported */ break; case 11: /* RPL server - Not yet supported */ break; case 12: /* Host name */ if (net_hostname[0] == 0) { size = truncate_sz("Host Name", sizeof(net_hostname), size); memcpy(&net_hostname, ext + 2, size); net_hostname[size] = 0; } break; case 13: /* Boot file size */ if (size == 2) net_boot_file_expected_size_in_blocks = ntohs(*(ushort *)(ext + 2)); else if (size == 4) net_boot_file_expected_size_in_blocks = ntohl(*(ulong *)(ext + 2)); break; case 14: /* Merit dump file - Not yet supported */ break; case 15: /* Domain name - Not yet supported */ break; case 16: /* Swap server - Not yet supported */ break; case 17: /* Root path */ if (net_root_path[0] == 0) { size = truncate_sz("Root Path", sizeof(net_root_path), size); memcpy(&net_root_path, ext + 2, size); net_root_path[size] = 0; } break; case 18: /* Extension path - Not yet supported */ /* * This can be used to send the information of the * vendor area in another file that the client can * access via TFTP. */ break; /* IP host layer fields */ case 40: /* NIS Domain name */ if (net_nis_domain[0] == 0) { size = truncate_sz("NIS Domain Name", sizeof(net_nis_domain), size); memcpy(&net_nis_domain, ext + 2, size); net_nis_domain[size] = 0; } break; #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER) case 42: /* NTP server IP */ net_copy_ip(&net_ntp_server, (struct in_addr *)(ext + 2)); break; #endif /* Application layer fields */ case 43: /* Vendor specific info - Not yet supported */ /* * Binary information to exchange specific * product information. */ break; /* Reserved (custom) fields (128..254) */ } }