summaryrefslogtreecommitdiff
path: root/src/network.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2009-03-12 21:09:27 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2009-03-12 21:09:27 +0100
commit656d5ad7c69a5a7d356c6251743890f1eec0bb71 (patch)
tree46c7fe13a32382c556a51d258fab5b7bebe9cd77 /src/network.c
parent56b484e3acc7205f0ebd71eec6905253eeace132 (diff)
downloadconntrack-tools-656d5ad7c69a5a7d356c6251743890f1eec0bb71.tar.gz
conntrack-tools-656d5ad7c69a5a7d356c6251743890f1eec0bb71.zip
sync-mode: add abstract layer to make daemon independent of multicast
This patch reworks conntrackd to make it independent of the protocol used to propagate state-changes. This patch adds the channel layer abstraction, this layer allows you to add support for different protocols like unicast UDP or TIPC. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/network.c')
-rw-r--r--src/network.c61
1 files changed, 0 insertions, 61 deletions
diff --git a/src/network.c b/src/network.c
index 690b28e..bdfa10c 100644
--- a/src/network.c
+++ b/src/network.c
@@ -65,67 +65,6 @@ void nethdr_set_ctl(struct nethdr *net)
__nethdr_set(net, NETHDR_SIZ);
}
-static size_t tx_buflenmax;
-static size_t tx_buflen = 0;
-static char *tx_buf;
-
-#define HEADERSIZ 28 /* IP header (20 bytes) + UDP header 8 (bytes) */
-
-int mcast_buffered_init(int if_mtu)
-{
- int mtu = if_mtu - HEADERSIZ;
-
- /* default to Ethernet MTU 1500 bytes */
- if (if_mtu == 0)
- mtu = 1500 - HEADERSIZ;
-
- tx_buf = malloc(mtu);
- if (tx_buf == NULL)
- return -1;
-
- tx_buflenmax = mtu;
-
- return 0;
-}
-
-void mcast_buffered_destroy(void)
-{
- free(tx_buf);
-}
-
-/* return 0 if it is not sent, otherwise return 1 */
-int
-mcast_buffered_send_netmsg(struct mcast_sock_multi *m, const struct nethdr *net)
-{
- int ret = 0, len = ntohs(net->len);
-
-retry:
- if (tx_buflen + len < tx_buflenmax) {
- memcpy(tx_buf + tx_buflen, net, len);
- tx_buflen += len;
- } else {
- mcast_send(mcast_get_current_link(m), tx_buf, tx_buflen);
- ret = 1;
- tx_buflen = 0;
- goto retry;
- }
-
- return ret;
-}
-
-ssize_t mcast_buffered_pending_netmsg(struct mcast_sock_multi *m)
-{
- ssize_t ret;
-
- if (tx_buflen == 0)
- return 0;
-
- ret = mcast_send(mcast_get_current_link(m), tx_buf, tx_buflen);
- tx_buflen = 0;
-
- return ret;
-}
-
static int local_seq_set = 0;
/* this function only tracks, it does not update the last sequence received */