Пример #1
0
int main(int argc, char *argv[])
{
    int k = 0;
    union U {
        int p;
        short q;
        char r;
    } *u;

    u = (union U *) &k;

    printf("sizeof (*u) = %lu\n", sizeof (*u));
    show_hex(&k, sizeof (k));

    u->p = 0xFEDCBA98;
    show_hex(&k, sizeof (k));

    u->q = 0x7654;
    show_hex(&k, sizeof (k));

    u->r = 0x32;
    show_hex(&k, sizeof (k));

    return 0;
}
Пример #2
0
int main( int argc, char *argv[ ] )
{   
  rsa_key privkey;
  unsigned char *buffer;
  int buffer_length;

  if ( argc < 3 )
  {
    fprintf( stderr, "Usage: %s [-pem|-der] <rsa private key file> [password]\n", argv[ 0 ] );
    exit( 0 );
  }

  if ( !( buffer = load_file_into_memory( argv[ 2 ], &buffer_length ) ) )
  {
    perror( "Unable to load file" );
    exit( 1 );
  }

  if ( !strcmp( argv[ 1 ], "-pem" ) )
  {
    // XXX this overallocates a bit, since it sets aside space for markers, etc.
    unsigned char *pem_buffer = buffer;
    buffer = (unsigned char * ) malloc( buffer_length );
    buffer_length = pem_decode( pem_buffer, buffer ); 
    free( pem_buffer );
  } 
  
  if ( argc == 3 )
  {
    parse_private_key( &privkey, buffer, buffer_length );
  }
  else
  {
    parse_pkcs8_private_key( &privkey, buffer, buffer_length, argv[ 3] );
  }
  
  printf( "Modulus:" );
  show_hex( privkey.modulus->rep, privkey.modulus->size );
  printf( "Private Exponent:" );
  show_hex( privkey.exponent->rep, privkey.exponent->size );
  
  free( buffer );
  
  return 0;
} 
Пример #3
0
event tdc::getEvent(){
    event e;
    int nWords = getNumberOfWords();
    if (nWords == 0) return (e);
    
    unsigned int DATA=0;
    bool inPayload = false;
    int lastWord = 0;
    for (int i=0; i<nWords; i++){
        lastWord = i;
        TestError(readData(this->add,&DATA,A32_U_DATA,D32),"TDC: read buffer");
        if (vLevel(DEBUG))
            std::cout<<"WORD "<<i<<(i<10?"  ":" ")<<": "<<show_hex(DATA,8)<<std::endl;
        short int wordType = DATA>>27;
        if (!inPayload){ //We are not in the payload yet (expecting header)
            if (wordType == 8){// Global header
                inPayload = true;
                e.eventNumber = (DATA>>5)%4194304;
            }
            else{
                e.errorCode = -2; // Sync loss error
            }
        }
Пример #4
0
Файл: main.c Проект: d5h/gah
static void
main_loop(void)
{
  int ch = 0;
  int quit = 0;
  int rehex = 1;
  int remsg = 1;

  while (! quit)
    {
      set_cursan();

      if (rehex)
	show_hex();
      if (remsg)
	show_msg();

      rehex = remsg = 0;
      ch = wgetch(whex);
      switch (ch)
	{
	case 'a':
	  annotate_cursan();
	  rehex = remsg = 1;
	  break;
	case 'q':
	  quit = 1;
	  break;
	case KEY_DOWN:
	  if (cursor + columns < columns * rows)
	    cursor += columns;
	  else if (offset + columns < data_size)
	    offset += columns;
	  rehex = remsg = 1;
	  break;
	case KEY_UP:
	  if (columns <= cursor)
	    cursor -= columns;
	  else if (columns <= offset)
	    offset -= columns;
	  rehex = remsg = 1;
	  break;
	case KEY_NPAGE:
	  if (offset + columns * rows < data_size)
	    offset += columns * rows;
	  rehex = remsg = 1;
	  break;
	case KEY_PPAGE:
	  if (columns * rows <= offset)
	    offset -= columns * rows;
	  else
	    offset = 0;
	  rehex = remsg = 1;
	  break; 
	case KEY_RIGHT:
	  if (cursor + 1 < columns * rows)
	    ++cursor;
	  rehex = remsg = 1;
	  break;
	case KEY_LEFT:
	  if (1 <= cursor)
	    --cursor;
	  rehex = remsg = 1;
	  break;
	}
    }
}
Пример #5
0
/**
 * Simple command-line HTTP client.
 */
int main( int argc, char *argv[ ] )
{
  int client_connection;
  char *host, *path;
  char *proxy_host, *proxy_user, *proxy_password;
  int proxy_port;
  struct hostent *host_name;
  struct sockaddr_in host_address;
  int port = HTTPS_PORT;
  int ind;
  int master_secret_length;
  unsigned char *master_secret;
  int session_id_length;
  unsigned char *session_id;
#ifdef WIN32
  WSADATA wsaData;
#endif

  TLSParameters tls_context;

  if ( argc < 2 )
  {
    fprintf( stderr, 
      "Usage: %s: [-p http://[username:password@]proxy-host:proxy-port] <URL>\n", 
      argv[ 0 ] );
    return 1;
  }

  proxy_host = proxy_user = proxy_password = host = path = session_id = master_secret = NULL;
  session_id_length = master_secret_length = 0;

  for ( ind = 1; ind < ( argc - 1 ); ind++ )
  {
    if ( !strcmp( "-p", argv[ ind ] ) )
    {
      if ( !parse_proxy_param( argv[ ++ind ], &proxy_host, &proxy_port,
                               &proxy_user, &proxy_password ) )
      {
        fprintf( stderr, "Error - malformed proxy parameter '%s'.\n", argv[ 2 ] );
        return 2;
      }
    }
    else if ( !strcmp( "-s", argv[ ind ] ) )
    {
      session_id_length = hex_decode( argv[ ++ind ], &session_id );
    }
    else if ( !strcmp( "-m", argv[ ind ] ) )
    {
      master_secret_length = hex_decode( argv[ ++ind ], &master_secret );
    }
  }

  if ( ( ( master_secret_length > 0 ) && ( session_id_length == 0 ) ) ||
       ( ( master_secret_length == 0 ) && ( session_id_length > 0 ) ) )
  {
    fprintf( stderr, "session id and master secret must both be provided.\n" );
    return 3;
  }

  if ( parse_url( argv[ ind ], &host, &path ) == -1 )
  {
    fprintf( stderr, "Error - malformed URL '%s'.\n", argv[ 1 ] );
    return 1;
  }

  printf( "Connecting to host '%s'\n", host );
  // Step 1: open a socket connection on http port with the destination host.
#ifdef WIN32
  if ( WSAStartup( MAKEWORD( 2, 2 ), &wsaData ) != NO_ERROR )
  {
    fprintf( stderr, "Error, unable to initialize winsock.\n" );
    return 2;
  }
#endif

  client_connection = socket( PF_INET, SOCK_STREAM, 0 );

  if ( !client_connection )
  {
    perror( "Unable to create local socket" );
    return 2;
  }

  if ( proxy_host )
  {
    printf( "Connecting to host '%s'\n", proxy_host );
    host_name = gethostbyname( proxy_host );
  } 
  else
  {
    host_name = gethostbyname( host );
  }

  if ( !host_name )
  {
    perror( "Error in name resolution" );
    return 3;
  }

  host_address.sin_family = AF_INET;
  host_address.sin_port = htons( proxy_host ? proxy_port : HTTPS_PORT  );
  memcpy( &host_address.sin_addr, host_name->h_addr_list[ 0 ], 
          sizeof( struct in_addr ) );

  if ( connect( client_connection, ( struct sockaddr * ) &host_address, 
       sizeof( host_address ) ) == -1 )
  {
    perror( "Unable to connect to host" );
    return 4;
  }

  printf( "Connection complete; negotiating TLS parameters\n" );

  if ( proxy_host )
  {
    if ( !http_connect( client_connection, host, port, proxy_user, 
                        proxy_password ) )
    {
      perror( "Unable to establish proxy tunnel" );
      if ( close( client_connection ) == -1 )
      {
        perror( "Error closing client connection" );
        return 2;
      }
      return 3;
    }
  }

  if ( session_id != NULL )
  {
    if ( tls_resume( client_connection, session_id_length,
         session_id, master_secret, &tls_context ) )
    {
      fprintf( stderr, "Error: unable to negotiate SSL connection.\n" );
      if ( close( client_connection ) == -1 )
      {
        perror( "Error closing client connection" );
        return 2;
      }
      return 3;
    }
  }
  else
  {
    if ( tls_connect( client_connection, &tls_context, 0 ) )
    {
      fprintf( stderr, "Error: unable to negotiate TLS connection.\n" );
      return 3;
    }
  }

  printf( "Retrieving document: '%s'\n", path );
  http_get( client_connection, path, host, &tls_context );

  display_result( client_connection, &tls_context );

  tls_shutdown( client_connection, &tls_context );

  printf( "Session ID was: " );
  show_hex( tls_context.session_id, tls_context.session_id_length );
  printf( "Master secret was: " );
  show_hex( tls_context.master_secret, MASTER_SECRET_LENGTH );

  printf( "Shutting down.\n" );

#ifdef WIN32
  if ( closesocket( client_connection ) == -1 )
#else
  if ( close( client_connection ) == -1 )
#endif
  {
    perror( "Error closing client connection" );
    return 5;
  }

  if ( session_id != NULL )
  {
    free( session_id );
  } 
  
  if ( master_secret != NULL )
  {
    free( master_secret );
  } 

#ifdef WIN32
  WSACleanup();
#endif

  return 0;
}
Пример #6
0
static void
show_options(const uint8_t *data, int len)
{
	dhcpv6_option_t d6o;
	uint_t olen, retlen;
	uint16_t val16;
	uint16_t type;
	uint32_t val32;
	const uint8_t *ostart;
	char *str, *sp;
	char *oldnest;

	/*
	 * Be very careful with negative numbers; ANSI signed/unsigned
	 * comparison doesn't work as expected.
	 */
	while (len >= (signed)sizeof (d6o)) {
		(void) memcpy(&d6o, data, sizeof (d6o));
		d6o.d6o_code = ntohs(d6o.d6o_code);
		d6o.d6o_len = olen = ntohs(d6o.d6o_len);
		(void) snprintf(get_line(0, 0), get_line_remain(),
		    "Option Code = %u (%s)", d6o.d6o_code,
		    option_to_str(d6o.d6o_code));
		ostart = data += sizeof (d6o);
		len -= sizeof (d6o);
		if (olen > len) {
			(void) strlcpy(get_line(0, 0), "Option truncated",
			    get_line_remain());
			olen = len;
		}
		switch (d6o.d6o_code) {
		case DHCPV6_OPT_CLIENTID:
		case DHCPV6_OPT_SERVERID:
			if (olen < sizeof (val16))
				break;
			(void) memcpy(&val16, data, sizeof (val16));
			data += sizeof (val16);
			olen -= sizeof (val16);
			type = ntohs(val16);
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    "  DUID Type = %u (%s)", type,
			    duidtype_to_str(type));
			if (type == DHCPV6_DUID_LLT || type == DHCPV6_DUID_LL) {
				if (olen < sizeof (val16))
					break;
				(void) memcpy(&val16, data, sizeof (val16));
				data += sizeof (val16);
				olen -= sizeof (val16);
				val16 = ntohs(val16);
				(void) snprintf(get_line(0, 0),
				    get_line_remain(),
				    "  Hardware Type = %u (%s)", val16,
				    arp_htype(val16));
			}
			if (type == DHCPV6_DUID_LLT) {
				time_t timevalue;

				if (olen < sizeof (val32))
					break;
				(void) memcpy(&val32, data, sizeof (val32));
				data += sizeof (val32);
				olen -= sizeof (val32);
				timevalue = ntohl(val32) + DUID_TIME_BASE;
				(void) snprintf(get_line(0, 0),
				    get_line_remain(),
				    "  Time = %lu (%.24s)", ntohl(val32),
				    ctime(&timevalue));
			}
			if (type == DHCPV6_DUID_EN) {
				if (olen < sizeof (val32))
					break;
				(void) memcpy(&val32, data, sizeof (val32));
				data += sizeof (val32);
				olen -= sizeof (val32);
				val32 = ntohl(val32);
				(void) snprintf(get_line(0, 0),
				    get_line_remain(),
				    "  Enterprise Number = %lu (%s)", val32,
				    entr_to_str(val32));
			}
			if (olen == 0)
				break;
			if ((str = malloc(olen * 3)) == NULL)
				pr_err("interpret_dhcpv6: no mem");
			sp = str + snprintf(str, 3, "%02x", *data++);
			while (--olen > 0) {
				*sp++ = (type == DHCPV6_DUID_LLT ||
				    type == DHCPV6_DUID_LL) ? ':' : ' ';
				sp = sp + snprintf(sp, 3, "%02x", *data++);
			}
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    (type == DHCPV6_DUID_LLT ||
			    type == DHCPV6_DUID_LL) ?
			    "  Link Layer Address = %s" :
			    "  Identifier = %s", str);
			free(str);
			break;
		case DHCPV6_OPT_IA_NA:
		case DHCPV6_OPT_IA_PD: {
			dhcpv6_ia_na_t d6in;

			if (olen < sizeof (d6in) - sizeof (d6o))
				break;
			(void) memcpy(&d6in, data - sizeof (d6o),
			    sizeof (d6in));
			data += sizeof (d6in) - sizeof (d6o);
			olen -= sizeof (d6in) - sizeof (d6o);
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    "  IAID = %u", ntohl(d6in.d6in_iaid));
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    "  T1 (renew) = %u seconds", ntohl(d6in.d6in_t1));
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    "  T2 (rebind) = %u seconds", ntohl(d6in.d6in_t2));
			nest_options(data, olen, "IA: ",
			    "Identity Association");
			break;
		}
		case DHCPV6_OPT_IA_TA: {
			dhcpv6_ia_ta_t d6it;

			if (olen < sizeof (d6it) - sizeof (d6o))
				break;
			(void) memcpy(&d6it, data - sizeof (d6o),
			    sizeof (d6it));
			data += sizeof (d6it) - sizeof (d6o);
			olen -= sizeof (d6it) - sizeof (d6o);
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    "  IAID = %u", ntohl(d6it.d6it_iaid));
			nest_options(data, olen, "IA: ",
			    "Identity Association");
			break;
		}
		case DHCPV6_OPT_IAADDR: {
			dhcpv6_iaaddr_t d6ia;

			if (olen < sizeof (d6ia) - sizeof (d6o))
				break;
			(void) memcpy(&d6ia, data - sizeof (d6o),
			    sizeof (d6ia));
			data += sizeof (d6ia) - sizeof (d6o);
			olen -= sizeof (d6ia) - sizeof (d6o);
			show_address("  Address", &d6ia.d6ia_addr);
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    "  Preferred lifetime = %u seconds",
			    ntohl(d6ia.d6ia_preflife));
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    "  Valid lifetime = %u seconds",
			    ntohl(d6ia.d6ia_vallife));
			nest_options(data, olen, "ADDR: ", "Address");
			break;
		}
		case DHCPV6_OPT_ORO:
			while (olen >= sizeof (val16)) {
				(void) memcpy(&val16, data, sizeof (val16));
				val16 = ntohs(val16);
				(void) snprintf(get_line(0, 0),
				    get_line_remain(),
				    "  Requested Option Code = %u (%s)", val16,
				    option_to_str(val16));
				data += sizeof (val16);
				olen -= sizeof (val16);
			}
			break;
		case DHCPV6_OPT_PREFERENCE:
			if (olen > 0) {
				(void) snprintf(get_line(0, 0),
				    get_line_remain(),
				    *data == 255 ?
				    "  Preference = %u (immediate)" :
				    "  Preference = %u", *data);
			}
			break;
		case DHCPV6_OPT_ELAPSED_TIME:
			if (olen == sizeof (val16)) {
				(void) memcpy(&val16, data, sizeof (val16));
				val16 = ntohs(val16);
				(void) snprintf(get_line(0, 0),
				    get_line_remain(),
				    "  Elapsed Time = %u.%02u seconds",
				    val16 / 100, val16 % 100);
			}
			break;
		case DHCPV6_OPT_RELAY_MSG:
			if (olen > 0) {
				oldnest = prot_nest_prefix;
				prot_nest_prefix = prot_prefix;
				retlen = interpret_dhcpv6(F_DTAIL, data, olen);
				prot_prefix = prot_nest_prefix;
				prot_nest_prefix = oldnest;
			}
			break;
		case DHCPV6_OPT_AUTH: {
			dhcpv6_auth_t d6a;

			if (olen < DHCPV6_AUTH_SIZE - sizeof (d6o))
				break;
			(void) memcpy(&d6a, data - sizeof (d6o),
			    DHCPV6_AUTH_SIZE);
			data += DHCPV6_AUTH_SIZE - sizeof (d6o);
			olen += DHCPV6_AUTH_SIZE - sizeof (d6o);
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    "  Protocol = %u (%s)", d6a.d6a_proto,
			    authproto_to_str(d6a.d6a_proto));
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    "  Algorithm = %u (%s)", d6a.d6a_alg,
			    authalg_to_str(d6a.d6a_proto, d6a.d6a_alg));
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    "  Replay Detection Method = %u (%s)", d6a.d6a_rdm,
			    authrdm_to_str(d6a.d6a_rdm));
			show_hex(d6a.d6a_replay, sizeof (d6a.d6a_replay),
			    "  RDM Data");
			if (olen > 0)
				show_hex(data, olen, "  Auth Info");
			break;
		}
		case DHCPV6_OPT_UNICAST:
			if (olen >= sizeof (in6_addr_t))
				show_address("  Server Address", data);
			break;
		case DHCPV6_OPT_STATUS_CODE:
			if (olen < sizeof (val16))
				break;
			(void) memcpy(&val16, data, sizeof (val16));
			val16 = ntohs(val16);
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    "  Status Code = %u (%s)", val16,
			    status_to_str(val16));
			data += sizeof (val16);
			olen -= sizeof (val16);
			if (olen > 0)
				(void) snprintf(get_line(0, 0),
				    get_line_remain(), "  Text = \"%.*s\"",
				    olen, data);
			break;
		case DHCPV6_OPT_VENDOR_CLASS:
			if (olen < sizeof (val32))
				break;
			(void) memcpy(&val32, data, sizeof (val32));
			data += sizeof (val32);
			olen -= sizeof (val32);
			val32 = ntohl(val32);
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    "  Enterprise Number = %lu (%s)", val32,
			    entr_to_str(val32));
			/* FALLTHROUGH */
		case DHCPV6_OPT_USER_CLASS:
			while (olen >= sizeof (val16)) {
				(void) memcpy(&val16, data, sizeof (val16));
				data += sizeof (val16);
				olen -= sizeof (val16);
				val16 = ntohs(val16);
				if (val16 > olen) {
					(void) strlcpy(get_line(0, 0),
					    "  Truncated class",
					    get_line_remain());
					val16 = olen;
				}
				show_hex(data, olen, "  Class");
				data += val16;
				olen -= val16;
			}
			break;
		case DHCPV6_OPT_VENDOR_OPT: {
			dhcpv6_option_t sd6o;

			if (olen < sizeof (val32))
				break;
			(void) memcpy(&val32, data, sizeof (val32));
			data += sizeof (val32);
			olen -= sizeof (val32);
			val32 = ntohl(val32);
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    "  Enterprise Number = %lu (%s)", val32,
			    entr_to_str(val32));
			while (olen >= sizeof (sd6o)) {
				(void) memcpy(&sd6o, data, sizeof (sd6o));
				sd6o.d6o_code = ntohs(sd6o.d6o_code);
				sd6o.d6o_len = ntohs(sd6o.d6o_len);
				(void) snprintf(get_line(0, 0),
				    get_line_remain(),
				    "  Vendor Option Code = %u", d6o.d6o_code);
				data += sizeof (d6o);
				olen -= sizeof (d6o);
				if (sd6o.d6o_len > olen) {
					(void) strlcpy(get_line(0, 0),
					    "  Vendor Option truncated",
					    get_line_remain());
					sd6o.d6o_len = olen;
				}
				if (sd6o.d6o_len > 0) {
					show_hex(data, sd6o.d6o_len,
					    "    Data");
					data += sd6o.d6o_len;
					olen -= sd6o.d6o_len;
				}
			}
			break;
		}
		case DHCPV6_OPT_REMOTE_ID:
			if (olen < sizeof (val32))
				break;
			(void) memcpy(&val32, data, sizeof (val32));
			data += sizeof (val32);
			olen -= sizeof (val32);
			val32 = ntohl(val32);
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    "  Enterprise Number = %lu (%s)", val32,
			    entr_to_str(val32));
			/* FALLTHROUGH */
		case DHCPV6_OPT_INTERFACE_ID:
		case DHCPV6_OPT_SUBSCRIBER:
			if (olen > 0)
				show_hex(data, olen, "  ID");
			break;
		case DHCPV6_OPT_RECONF_MSG:
			if (olen > 0) {
				(void) snprintf(get_line(0, 0),
				    get_line_remain(),
				    "  Message Type = %u (%s)", *data,
				    reconf_to_str(*data));
			}
			break;
		case DHCPV6_OPT_SIP_NAMES:
		case DHCPV6_OPT_DNS_SEARCH:
		case DHCPV6_OPT_NIS_DOMAIN:
		case DHCPV6_OPT_BCMCS_SRV_D: {
			dhcp_symbol_t *symp;
			char *sp2;

			symp = inittab_getbycode(
			    ITAB_CAT_STANDARD | ITAB_CAT_V6, ITAB_CONS_SNOOP,
			    d6o.d6o_code);
			if (symp != NULL) {
				str = inittab_decode(symp, data, olen, B_TRUE);
				if (str != NULL) {
					sp = str;
					do {
						sp2 = strchr(sp, ' ');
						if (sp2 != NULL)
							*sp2++ = '\0';
						(void) snprintf(get_line(0, 0),
						    get_line_remain(),
						    "  Name = %s", sp);
					} while ((sp = sp2) != NULL);
					free(str);
				}
				free(symp);
			}
			break;
		}
		case DHCPV6_OPT_SIP_ADDR:
		case DHCPV6_OPT_DNS_ADDR:
		case DHCPV6_OPT_NIS_SERVERS:
		case DHCPV6_OPT_SNTP_SERVERS:
		case DHCPV6_OPT_BCMCS_SRV_A:
			while (olen >= sizeof (in6_addr_t)) {
				show_address("  Address", data);
				data += sizeof (in6_addr_t);
				olen -= sizeof (in6_addr_t);
			}
			break;
		case DHCPV6_OPT_IAPREFIX: {
			dhcpv6_iaprefix_t d6ip;

			if (olen < DHCPV6_IAPREFIX_SIZE - sizeof (d6o))
				break;
			(void) memcpy(&d6ip, data - sizeof (d6o),
			    DHCPV6_IAPREFIX_SIZE);
			data += DHCPV6_IAPREFIX_SIZE - sizeof (d6o);
			olen -= DHCPV6_IAPREFIX_SIZE - sizeof (d6o);
			show_address("  Prefix", d6ip.d6ip_addr);
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    "  Preferred lifetime = %u seconds",
			    ntohl(d6ip.d6ip_preflife));
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    "  Valid lifetime = %u seconds",
			    ntohl(d6ip.d6ip_vallife));
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    "  Prefix length = %u", d6ip.d6ip_preflen);
			nest_options(data, olen, "ADDR: ", "Address");
			break;
		}
		case DHCPV6_OPT_INFO_REFTIME:
			if (olen < sizeof (val32))
				break;
			(void) memcpy(&val32, data, sizeof (val32));
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    "  Refresh Time = %lu seconds", ntohl(val32));
			break;
		case DHCPV6_OPT_GEOCONF_CVC: {
			dhcpv6_civic_t d6c;
			int solen;

			if (olen < DHCPV6_CIVIC_SIZE - sizeof (d6o))
				break;
			(void) memcpy(&d6c, data - sizeof (d6o),
			    DHCPV6_CIVIC_SIZE);
			data += DHCPV6_CIVIC_SIZE - sizeof (d6o);
			olen -= DHCPV6_CIVIC_SIZE - sizeof (d6o);
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    "  What Location = %u (%s)", d6c.d6c_what,
			    cwhat_to_str(d6c.d6c_what));
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    "  Country Code = %.*s", sizeof (d6c.d6c_cc),
			    d6c.d6c_cc);
			while (olen >= 2) {
				(void) snprintf(get_line(0, 0),
				    get_line_remain(),
				    "  CA Element = %u (%s)", *data,
				    catype_to_str(*data));
				solen = data[1];
				data += 2;
				olen -= 2;
				if (solen > olen) {
					(void) strlcpy(get_line(0, 0),
					    "  CA Element truncated",
					    get_line_remain());
					solen = olen;
				}
				if (solen > 0) {
					show_ascii(data, solen, "  CA Data");
					data += solen;
					olen -= solen;
				}
			}
			break;
		}
		case DHCPV6_OPT_CLIENT_FQDN: {
			dhcp_symbol_t *symp;

			if (olen == 0)
				break;
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    "  Flags = %02x", *data);
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    "        %s", getflag(*data, DHCPV6_FQDNF_S,
			    "Perform AAAA RR updates", "No AAAA RR updates"));
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    "        %s", getflag(*data, DHCPV6_FQDNF_O,
			    "Server override updates",
			    "No server override updates"));
			(void) snprintf(get_line(0, 0), get_line_remain(),
			    "        %s", getflag(*data, DHCPV6_FQDNF_N,
			    "Server performs no updates",
			    "Server performs updates"));
			symp = inittab_getbycode(
			    ITAB_CAT_STANDARD | ITAB_CAT_V6, ITAB_CONS_SNOOP,
			    d6o.d6o_code);
			if (symp != NULL) {
				str = inittab_decode(symp, data, olen, B_TRUE);
				if (str != NULL) {
					(void) snprintf(get_line(0, 0),
					    get_line_remain(),
					    "  FQDN = %s", str);
					free(str);
				}
				free(symp);
			}
			break;
		}
		}
		data = ostart + d6o.d6o_len;
		len -= d6o.d6o_len;
	}
	if (len != 0) {
		(void) strlcpy(get_line(0, 0), "Option entry truncated",
		    get_line_remain());
	}
}