[hipl-dev] [Bug 701828] Re: hipconf add hi default fails

  • From: Henrik Ziegeldorf <701828@xxxxxxxxxxxxxxxxxx>
  • To: hipl-dev@xxxxxxxxxxxxx
  • Date: Wed, 12 Jan 2011 19:02:36 -0000

Ok, I know what the bug is, but I haven't fixed it yet.

The problem is, that for DSA keys, someone forgot to set the algorithm
field (its 0). With the changes inspired by my ecc branch (that's the
reason why it fails there too), such a case gets caught in the switch's
default case and makes the precreate_r1 function fail (before it was
just assumed "if its not RSA its DSA). Now the failing during
precreation of the r1 lets hipd's init procedure fail. This then leads
to deinitialization, and amongst others, to the deinitialization of the
hidb. Now, what happens is nothing new: We deinit something that hasn't
been properly initialized (see other recent bugs) and the deinit
function is not robust enough and fails gloriously.

A quick and dirty fix is on the way, but it is obvious that a proper solution 
needs to 
a) set the algorithm field properly
b) make the deinit functions more robust

-- 
You received this bug notification because you are a member of HIPL core
team, which is subscribed to HIPL.
https://bugs.launchpad.net/bugs/701828

Title:
  hipconf add hi default fails

Status in Host Identity Protocol for Linux:
  Confirmed

Bug description:
  Hipconf add hi default fails complaining about unsupported algorithms
  (DSA?).  After this error the hip_close will result in backtrace due
  to invalid pointer caused by the unknown algorithm.

  Tested with trunk and ecc branches (up-to-date/clean install).

  Output from hipconf:
  $ sudo tools/hipconf add hi default
  Using hostname: wel-36
  Using format dsa and file (null) 
  hit: 2001:0017:14b4:3f28:25a5:eedb:e25c:e015
  hi is private rsa/dsa
  DSA HIT: 7877:b1bf:ff7f:0000:0700:0000:0000:0000
  Sending user message 65 to HIPD on socket 3
  Sent 2440 bytes
  Waiting to receive daemon info.
  2440 bytes received from HIP daemon
  HIP message contained an error.
  Sending msg failed.
  Failed to send a message to the HIP daemon.
  (Check syntax for hipconf. Is hipd running or root privilege needed?)
  Error: Cannot configure the HIP daemon.

  hipd output:
  debug(lib/core/message.c:494@hip_read_user_control_msg): Receiving user 
message.
  debug(lib/core/message.c:514@hip_read_user_control_msg): received user 
message from local port 1001
  debug(hipd/user.c:194@hip_user_run_handles): User message (type: 65) not 
dynamically handled -> trigger static handling.
  debug(hipd/user.c:258@hip_handle_user_msg): User message from port 1001
  debug(hipd/user.c:286@hip_handle_user_msg): HIP user message type is: 65
  debug(hipd/hidb.c:611@hip_handle_add_local_hi): /* --------- */ 
  debug(hipd/hidb.c:612@hip_handle_add_local_hi): input->hits = : 
0000:0000:0000:0000:0000:0000:0000:0000
  debug(hipd/hidb.c:613@hip_handle_add_local_hi): input->hitr = : 
0000:0000:0000:0000:0000:0000:0000:0000
  debug(hipd/hidb.c:626@hip_handle_add_local_hi): host id found in the msg
  debug(hipd/hidb.c:373@hip_get_hostid_entry_by_lhi_and_algo): Failed to find a 
host ID entry, Returning NULL.
  debug(hipd/hidb.c:544@hip_add_host_id): Generating a new R1 set.
  error(hipd/hidb.c:558@hip_add_host_id): Unsupported algorithms
  error(hipd/hidb.c:655@hip_handle_add_local_hi): adding of local host identity 
failed
  debug(hipd/hip_socket.c:145@hip_handle_user_sock): Send response
  debug(hipd/hip_socket.c:151@hip_handle_user_sock): Sending message (type=65) 
response to port 1001 
  debug(hipd/hip_socket.c:152@hip_handle_user_sock): To address: 
0000:0000:0000:0000:0000:0000:0000:0001
  debug(hipd/user.c:233@hip_sendto_user): Sending msg type 65
  debug(hipd/hip_socket.c:157@hip_handle_user_sock): Response sent ok
  debug(hipd/hip_socket.c:285@hip_run_socket_handles): result: 0

  Closing output of hipd:
  debug(hipd/init.c:1052@hip_close): Starting to close HIP daemon...
  error(hipd/hipd.c:410@hipd_main): select() error: Interrupted system call.
  debug(hipd/hadb.c:1207@hip_delete_all_sp): 
  debug(hipd/hadb.c:1209@hip_delete_all_sp): DEBUG: DUMP SPI LISTS
  debug(hipd/hadb.c:1211@hip_delete_all_sp): DELETING HA HT
  debug(hipd/netdev.c:549@hip_delete_all_addresses): address to be deleted
  : 2001:0708:0140:0200:0222:19ff:fe18:8ce2
  debug(hipd/netdev.c:549@hip_delete_all_addresses): address to be deleted
  : 128.214.114.246
  info(hipd/init.c:960@hip_exit): Uninitializing RVS / HIP relay database and 
whitelist.
  info(hipd/init.c:965@hip_exit): hip_raw_sock_input_v6
  info(hipd/init.c:970@hip_exit): hip_raw_sock_output_v6
  info(hipd/init.c:975@hip_exit): hip_raw_sock_input_v4
  info(hipd/init.c:980@hip_exit): hip_raw_sock_output_v4
  info(hipd/init.c:985@hip_exit): hip_nat_sock_input_udp
  info(hipd/init.c:990@hip_exit): hip_nat_sock_output_udp
  error(hipd/hidb.c:301@hip_del_host_id): Cannot free key, because key type is 
unkown.
  *** glibc detected *** hipd/hipd: free(): invalid pointer: 0x00000000018aa500 
***
  ======= Backtrace: =========
  /lib/libc.so.6(+0x775b6)[0x7f3b38f185b6]
  /lib/libc.so.6(cfree+0x73)[0x7f3b38f1ee83]
  hipd/hipd[0x411f22]
  hipd/hipd[0x412162]
  hipd/hipd[0x4165c7]
  hipd/hipd[0x413dce]
  /lib/libc.so.6(__libc_start_main+0xfd)[0x7f3b38ebfc4d]
  hipd/hipd[0x405c69]



Other related posts: