+ if (is_ip4)
+ {
+ ip4_header_t *ip4;
+
+ /* TODO: must fix once udp_local does ip options correctly */
+ ip4 = (ip4_header_t *) (((u8 *) udp) - sizeof (*ip4));
+ ip_set (&hdr->lcl_ip, &ip4->dst_address, 1);
+ ip_set (&hdr->rmt_ip, &ip4->src_address, 1);
+ hdr->data_length = clib_net_to_host_u16 (ip4->length);
+ hdr->data_length -= sizeof (ip4_header_t) + sizeof (udp_header_t);
+ s = session_lookup_safe4 (fib_index, &ip4->dst_address,
+ &ip4->src_address, udp->dst_port,
+ udp->src_port, TRANSPORT_PROTO_UDP);
+ }
+ else
+ {
+ ip6_header_t *ip60;
+
+ ip60 = (ip6_header_t *) (((u8 *) udp) - sizeof (*ip60));
+ ip_set (&hdr->lcl_ip, &ip60->dst_address, 0);
+ ip_set (&hdr->rmt_ip, &ip60->src_address, 0);
+ hdr->data_length = clib_net_to_host_u16 (ip60->payload_length);
+ hdr->data_length -= sizeof (udp_header_t);
+ s = session_lookup_safe6 (fib_index, &ip60->dst_address,
+ &ip60->src_address, udp->dst_port,
+ udp->src_port, TRANSPORT_PROTO_UDP);