static void BootpVendorProcess (u8 * ext, int size) { u8 *end = ext + size; debug_ext ("[BOOTP] Checking extension (%d bytes)...\n", size); while ((ext < end) && (*ext != 0xff)) { if (*ext == 0) { ext++; } else { u8 *opt = ext; ext += ext[1] + 2; if (ext <= end) BootpVendorFieldProcess (opt); } } #ifdef DEBUG_BOOTP_EXT puts ("[BOOTP] Received fields: \n"); if (NetOurSubnetMask) { puts ("NetOurSubnetMask : "); print_IPaddr (NetOurSubnetMask); putc ('\n'); } if (NetOurGatewayIP) { puts ("NetOurGatewayIP : "); print_IPaddr (NetOurGatewayIP); putc ('\n'); } if (NetBootFileSize) { printf ("NetBootFileSize : %d\n", NetBootFileSize); } if (NetOurHostName[0]) { printf ("NetOurHostName : %s\n", NetOurHostName); } if (NetOurRootPath[0]) { printf ("NetOurRootPath : %s\n", NetOurRootPath); } if (NetOurNISDomain[0]) { printf ("NetOurNISDomain : %s\n", NetOurNISDomain); } if (NetBootFileSize) { printf ("NetBootFileSize: %d\n", NetBootFileSize); } #endif /* DEBUG_BOOTP_EXT */ }
static void BootpVendorFieldProcess (u8 * ext) { int size = *(ext + 1); debug_ext ("[BOOTP] Processing extension %d... (%d bytes)\n", *ext, *(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 ekg_gnutls_log(gint level, const char *msg) { debug_ext(DEBUG_GGMISC, "[gnutls:%d] %s", level, msg); }