Exemple #1
0
int
tun_rtr_process_input_packet(struct sock *sl)
{
    packet_tuple_t tpl;
    lbuf_use_stack(&pkt_buf, &pkt_recv_buf, MAX_IP_PKT_LEN);
    /* Reserve space in case the received packet was IPv6. In this case the IPv6 header is
     * not provided */
    lbuf_reserve(&pkt_buf,LBUF_STACK_OFFSET);

    if (tun_read_and_decap_pkt(sl->fd, &pkt_buf, &(tpl.iid)) != GOOD) {
        return (BAD);
    }

    OOR_LOG(LDBG_3, "Forwarding packet to OUPUT for re-encapsulation");

    lbuf_point_to_l3(&pkt_buf);
    lbuf_reset_ip(&pkt_buf);

    if (pkt_parse_5_tuple(&pkt_buf, &tpl) != GOOD) {
        return (BAD);
    }
    tun_output(&pkt_buf, &tpl);

    return(GOOD);
}
Exemple #2
0
/*---------------------------------------------------------------------------*/
static int
output(void)
{
  PRINTF("SUT: %u\n", uip_len);
  if(uip_len > 0) {
    return tun_output(&uip_buf[UIP_LLH_LEN], uip_len);
  }
  return 0;
}