LOG(0, 0, 0, "Error setting tun queue length: %s\n", strerror(errno));
exit(1);
}
LOG(0, 0, 0, "Error setting tun queue length: %s\n", strerror(errno));
exit(1);
}
+ /* set MTU to modem MRU + 4 (tun header) */
+ ifr.ifr_mtu = MRU + 4;
+ if (ioctl(ifrfd, SIOCSIFMTU, (void *) &ifr) < 0)
+ {
+ LOG(0, 0, 0, "Error setting tun MTU: %s\n", strerror(errno));
+ exit(1);
+ }
{
tunnel[t].last = time_now; // control message sent
tunnel[t].retry = backoff(tunnel[t].try); // when to resend
{
tunnel[t].last = time_now; // control message sent
tunnel[t].retry = backoff(tunnel[t].try); // when to resend
{
STAT(tunnel_retries);
LOG(3, 0, t, "Control message resend try %d\n", tunnel[t].try);
{
STAT(tunnel_retries);
LOG(3, 0, t, "Control message resend try %d\n", tunnel[t].try);
sum = orig + (~MSS & 0xffff);
sum += ntohs(*(uint16_t *) (tcp + 16));
sum = (sum & 0xffff) + (sum >> 16);
sum = orig + (~MSS & 0xffff);
sum += ntohs(*(uint16_t *) (tcp + 16));
sum = (sum & 0xffff) + (sum >> 16);
{
// We are walled-gardening this
master_garden_packet(s, data, size);
{
// We are walled-gardening this
master_garden_packet(s, data, size);
my_address; // send my IP
tunnelsend(buf, 10 + (q - buf), t); // send it
my_address; // send my IP
tunnelsend(buf, 10 + (q - buf), t); // send it
if (*p == 5 && p[1] == 6) // Magic-Number
amagic = ntohl(*(uint32_t *) (p + 2));
else if (*p == 7) // Protocol-Field-Compression
if (*p == 5 && p[1] == 6) // Magic-Number
amagic = ntohl(*(uint32_t *) (p + 2));
else if (*p == 7) // Protocol-Field-Compression
case 14: // CDN
controlnull(t); // ack
sessionshutdown(s, "Closed (Received CDN).", 0, 0);
case 14: // CDN
controlnull(t); // ack
sessionshutdown(s, "Closed (Received CDN).", 0, 0);
{
controlt *c = controlnew(6); // sending HELLO
controladd(c, 0, t); // send the message
{
controlt *c = controlnew(6); // sending HELLO
controladd(c, 0, t); // send the message
if (sess_local[s].lcp.conf_sent < config->ppp_max_configure)
{
LOG(3, s, session[s].tunnel, "No ACK for LCP ConfigReq... resending\n");
if (sess_local[s].lcp.conf_sent < config->ppp_max_configure)
{
LOG(3, s, session[s].tunnel, "No ACK for LCP ConfigReq... resending\n");
sendlcp(s, session[s].tunnel);
change_state(s, lcp, next_state);
}
sendlcp(s, session[s].tunnel);
change_state(s, lcp, next_state);
}
if (sess_local[s].ipcp.conf_sent < config->ppp_max_configure)
{
LOG(3, s, session[s].tunnel, "No ACK for IPCP ConfigReq... resending\n");
if (sess_local[s].ipcp.conf_sent < config->ppp_max_configure)
{
LOG(3, s, session[s].tunnel, "No ACK for IPCP ConfigReq... resending\n");
sendipcp(s, session[s].tunnel);
change_state(s, ipcp, next_state);
}
sendipcp(s, session[s].tunnel);
change_state(s, ipcp, next_state);
}
if (sess_local[s].ipv6cp.conf_sent < config->ppp_max_configure)
{
LOG(3, s, session[s].tunnel, "No ACK for IPV6CP ConfigReq... resending\n");
if (sess_local[s].ipv6cp.conf_sent < config->ppp_max_configure)
{
LOG(3, s, session[s].tunnel, "No ACK for IPV6CP ConfigReq... resending\n");
sendipv6cp(s, session[s].tunnel);
change_state(s, ipv6cp, next_state);
}
sendipv6cp(s, session[s].tunnel);
change_state(s, ipv6cp, next_state);
}
if (sess_local[s].ccp.conf_sent < config->ppp_max_configure)
{
LOG(3, s, session[s].tunnel, "No ACK for CCP ConfigReq... resending\n");
if (sess_local[s].ccp.conf_sent < config->ppp_max_configure)
{
LOG(3, s, session[s].tunnel, "No ACK for CCP ConfigReq... resending\n");
sendccp(s, session[s].tunnel);
change_state(s, ccp, next_state);
}
sendccp(s, session[s].tunnel);
change_state(s, ccp, next_state);
}
LOG(4, s, session[s].tunnel, "No data in %d seconds, sending LCP ECHO\n",
(int)(time_now - session[s].last_packet));
tunnelsend(b, 24, session[s].tunnel); // send it
LOG(4, s, session[s].tunnel, "No data in %d seconds, sending LCP ECHO\n",
(int)(time_now - session[s].last_packet));
tunnelsend(b, 24, session[s].tunnel); // send it
// Log current traffic stats
snprintf(config->bandwidth, sizeof(config->bandwidth),
"UDP-ETH:%1.0f/%1.0f ETH-UDP:%1.0f/%1.0f TOTAL:%0.1f IN:%u OUT:%u",
(udp_rx / Mbps), (eth_tx / Mbps), (eth_rx / Mbps), (udp_tx / Mbps),
// Log current traffic stats
snprintf(config->bandwidth, sizeof(config->bandwidth),
"UDP-ETH:%1.0f/%1.0f ETH-UDP:%1.0f/%1.0f TOTAL:%0.1f IN:%u OUT:%u",
(udp_rx / Mbps), (eth_tx / Mbps), (eth_rx / Mbps), (udp_tx / Mbps),
- ((udp_tx + udp_rx + eth_tx + eth_rx) / Mbps), udp_rx_pkt, eth_rx_pkt);
+ ((udp_tx + udp_rx + eth_tx + eth_rx) / Mbps),
+ udp_rx_pkt / time_changed, eth_rx_pkt / time_changed);
- if (!rule->frag || rule->action == FILTER_ACTION_DENY)
+ // layer 4 deny rules are skipped
+ if (rule->action == FILTER_ACTION_DENY &&
+ (rule->src_ports.op || rule->dst_ports.op || rule->tcp_flag_op))