diff options
author | /C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org> | 2007-05-24 11:32:53 +0000 |
---|---|---|
committer | /C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org> | 2007-05-24 11:32:53 +0000 |
commit | bc91f60fc288fe1fd0729f7bafe0596837c3e675 (patch) | |
tree | 5e36e8e4c64295ab5d9a30e8625358f2c6a876d7 /src/network.c | |
parent | eaae45fa65fdb559b5442dfe2da05a808c5c57ba (diff) | |
download | conntrack-tools-bc91f60fc288fe1fd0729f7bafe0596837c3e675.tar.gz conntrack-tools-bc91f60fc288fe1fd0729f7bafe0596837c3e675.zip |
simplify checksum code: use UDP/multicast checksum facilities
Diffstat (limited to 'src/network.c')
-rw-r--r-- | src/network.c | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/src/network.c b/src/network.c index 51e89c7..d073428 100644 --- a/src/network.c +++ b/src/network.c @@ -60,9 +60,6 @@ int mcast_send_netmsg(struct mcast_sock *m, void *data) if (nlh_host2network(nlh) == -1) return -1; - net->checksum = 0; - net->checksum = ntohs(do_csum(data, len)); - return send_netmsg(m, data, len); } @@ -87,8 +84,6 @@ int mcast_resend_netmsg(struct mcast_sock *m, void *data) net->flags = htons(net->flags); net->seq = htonl(cur_seq++); - net->checksum = 0; - net->checksum = ntohs(do_csum(data, len)); return send_netmsg(m, data, len); } @@ -113,29 +108,10 @@ int mcast_send_error(struct mcast_sock *m, void *data) net->flags = htons(net->flags); net->seq = htonl(cur_seq++); - net->checksum = 0; - net->checksum = ntohs(do_csum(data, len)); return send_netmsg(m, data, len); } -static int valid_checksum(void *data, unsigned int len) -{ - struct nlnetwork *net = data; - unsigned short checksum, tmp; - - checksum = ntohs(net->checksum); - - /* no checksum, skip */ - if (!checksum) - return 1; - - net->checksum = 0; - tmp = do_csum(data, len); - - return tmp == checksum; -} - int mcast_recv_netmsg(struct mcast_sock *m, void *data, int len) { int ret; @@ -161,9 +137,6 @@ int mcast_recv_netmsg(struct mcast_sock *m, void *data, int len) if (ret < sizeof(struct nlnetwork_ack)) return -1; - if (!valid_checksum(data, ret)) - return -1; - /* host byte order conversion */ net->flags = ntohs(net->flags); net->seq = ntohl(net->seq); @@ -176,9 +149,6 @@ int mcast_recv_netmsg(struct mcast_sock *m, void *data, int len) } if (ntohs(net->flags) & NET_RESYNC) { - if (!valid_checksum(data, ret)) - return -1; - /* host byte order conversion */ net->flags = ntohs(net->flags); net->seq = ntohl(net->seq); @@ -209,9 +179,6 @@ int mcast_recv_netmsg(struct mcast_sock *m, void *data, int len) if (nfhdr->version != NFNETLINK_V0) return -1; - if (!valid_checksum(data, ret)) - return -1; - /* host byte order conversion */ net->flags = ntohs(net->flags); net->seq = ntohl(net->seq); |