#include "nufw.h"
#include <stdlib.h>
#include <time.h>
#include <linux/icmp.h>
#include <netinet/icmp6.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
#include <nubase.h>
Include dependency graph for common.c:

Go to the source code of this file.
Functions | |
| void | close_tls_session () |
| void | psuppress (packet_idl *previous, packet_idl *current) |
| unsigned long | padd (packet_idl *current) |
| int | psearch_and_destroy (uint32_t packet_id, uint32_t *nfmark) |
| void | clear_packet_list () |
| void | clean_old_packets () |
| __u16 | icmp_cksum (__u16 *buf, int nbytes) |
| int | send_icmp_ipv4_unreach (char *payload) |
| int | send_icmp_ipv6_unreach (char *payload) |
| int | send_icmp_unreach (char *payload) |
Function to add (padd()), suppress (psuppress() and psearch_and_destroy()) and clean up (clean_old_packets()) packets from packet list (packets_list).
Definition in file common.c.
| void clean_old_packets | ( | ) |
Walk in the packet list (packets_list) and remove old packets (using packet_timeout limit).
Definition at line 218 of file common.c.
References DEBUG_AREA_PACKET, DEBUG_LEVEL_DEBUG, debug_log_printf, Packet_Ids::id, IPQ_SET_VERDICT, packet_timeout, packets_list, psuppress(), packets_list_t::start, and Packet_Ids::timestamp.
Referenced by main().
Here is the call graph for this function:

| void clear_packet_list | ( | ) |
Clear packet list: delete all elements
Definition at line 202 of file common.c.
References packets_list_t::end, packets_list_t::length, Packet_Ids::next, packets_list, and packets_list_t::start.
Referenced by nufw_prepare_quit().
| void close_tls_session | ( | ) |
Close the TLS session
Definition at line 79 of file common.c.
References nuauth_conn::auth_server_mutex, nussl_session_destroy(), nuauth_conn::session, and tls.
Referenced by auth_request_send(), nufw_prepare_quit(), and shutdown_tls().
Here is the call graph for this function:

| __u16 icmp_cksum | ( | __u16 * | buf, | |
| int | nbytes | |||
| ) |
| unsigned long padd | ( | packet_idl * | current | ) |
Try to add a packet to the end of packets_list. If we exceed max length (track_size), just drop the packet.
Definition at line 114 of file common.c.
References DEBUG_AREA_PACKET, DEBUG_LEVEL_WARNING, packets_list_t::end, Packet_Ids::id, IPQ_SET_VERDICT, packets_list_t::length, log_area_printf(), Packet_Ids::next, packets_list, packets_list_t::start, Packet_Ids::timestamp, and track_size.
Referenced by packetsrv_ipq_process().
Here is the call graph for this function:

| int psearch_and_destroy | ( | uint32_t | packet_id, | |
| uint32_t * | nfmark | |||
| ) |
Search an entry in packet list (packets_list), and drop and suppress old packets (using packet_timeout). If the packet can be found, delete it and copy it's mark into nfmark.
Definition at line 148 of file common.c.
References DEBUG_AREA_PACKET, DEBUG_LEVEL_INFO, debug_log_printf, Packet_Ids::id, IPQ_SET_VERDICT, log_area_printf(), Packet_Ids::next, packet_timeout, packets_list, psuppress(), packets_list_t::start, and Packet_Ids::timestamp.
Referenced by auth_process_answer(), and packetsrv_ipq_process().
Here is the call graph for this function:

| void psuppress | ( | packet_idl * | previous, | |
| packet_idl * | current | |||
| ) |
Suppress the packet current from the packet list (packets_list).
| previous | Packet before current | |
| current | Packet to remove |
Definition at line 95 of file common.c.
References packets_list_t::end, packets_list_t::length, Packet_Ids::next, packets_list, and packets_list_t::start.
Referenced by clean_old_packets(), and psearch_and_destroy().
| int send_icmp_ipv4_unreach | ( | char * | payload | ) |
Definition at line 267 of file common.c.
References icmp_cksum(), and raw_sock4.
Referenced by send_icmp_unreach().
Here is the call graph for this function:

| int send_icmp_ipv6_unreach | ( | char * | payload | ) |
| int send_icmp_unreach | ( | char * | payload | ) |
Definition at line 333 of file common.c.
References send_icmp_ipv4_unreach(), and send_icmp_ipv6_unreach().
Referenced by auth_process_answer().
Here is the call graph for this function:

1.4.7