Example #1
0
/*------------------------------------------------------------------------------*/
u8_t
uip_fw_output(void)
{
  struct uip_fw_netif *netif;
#if UIP_BROADCAST
  const struct uip_udpip_hdr *udp = (void *)BUF;
#endif /* UIP_BROADCAST */

  if(uip_len == 0) {
    return UIP_FW_ZEROLEN;
  }

  fwcache_register();

#if UIP_BROADCAST
  /* Link local broadcasts go out on all interfaces. */
  if(uip_ipaddr_cmp(&udp->destipaddr, &uip_broadcast_addr)) {
    if(defaultnetif != NULL) {
      defaultnetif->output();
    }
    for(netif = netifs; netif != NULL; netif = netif->next) {
      netif->output();
    }
    return UIP_FW_OK;
  }
#endif /* UIP_BROADCAST */

  netif = find_netif();
  /*  printf("uip_fw_output: netif %p ->output %p len %d\n", netif,
	 netif->output,
	 uip_len);*/

  if(netif == NULL) {
    return UIP_FW_NOROUTE;
  }
  /* If we now have found a suitable network interface, we call its
     output function to send out the packet. */
  return netif->output();
}
Example #2
0
/*------------------------------------------------------------------------------*/
u8_t
uip_fw_output(void)
{
  struct uip_fw_netif *netif;

  if(uip_len == 0) {
    return UIP_FW_ZEROLEN;
  }

  fwcache_register();

#if UIP_BROADCAST
  /* Link local broadcasts go out on all interfaces. */
  if(/*BUF->proto == UIP_PROTO_UDP &&*/
     BUF->destipaddr[0] == 0xffff &&
     BUF->destipaddr[1] == 0xffff) {
    if(defaultnetif != NULL) {
      defaultnetif->output();
    }
    for(netif = netifs; netif != NULL; netif = netif->next) {
      netif->output();
    }
    return UIP_FW_OK;
  }
#endif /* UIP_BROADCAST */
  
  netif = find_netif();
  /*  printf("uip_fw_output: netif %p ->output %p len %d\n", netif,
	 netif->output,
	 uip_len);*/

  if(netif == NULL) {
    return UIP_FW_NOROUTE;
  }
  /* If we now have found a suitable network interface, we call its
     output function to send out the packet. */
  return netif->output();
}