Is this code in the right place?  It is possibly operating on the Route header that signifies the IBCF node, not the next hop Route header (if it is present).  I think it should be after the call to proxy_process_routing (which is the point that removes the Route header of the IBCF).