+/**
+ * Get the route next hop ip address and port number for IPv4
+ * @param dst_ip_addr
+ * Destination IPv4 address
+ * @param dst_port
+ * A pointer to destination port
+ * @param nhip
+ * A pointer to next hop ip address
+ */
+
+static inline int gw_get_route_nh_port_ipv4(uint32_t dst_ip_addr,
+ uint32_t *dst_port, uint32_t *nhip, uint32_t nport)
+{
+ int i = 0;
+ uint32_t j = nport;
+
+ while(likely(i < p_route_data[j]->route_ent_cnt)) {
+ if (likely((p_route_data[j]->route_table[i].nh_mask) ==
+ (dst_ip_addr &
+ p_route_data[j]->route_table[i].mask))) {
+
+ *dst_port = p_route_data[j]->route_table[i].port;
+ *nhip = p_route_data[j]->route_table[i].nh;
+
+#ifdef ARPICMP_DEBUG
+ lib_arp_nh_found++;
+#endif
+ return 1;
+ }
+ i++;
+ }
+
+ *nhip = 0;
+ *dst_port = 0xff;
+ return 0;
+}
+
+