Commit a867f698 authored by Tom Barbette's avatar Tom Barbette

GTPLookup: Allow to disable checksum

parent ecc2c09e
Pipeline #1817 passed with stage
in 10 minutes and 38 seconds
......@@ -28,7 +28,7 @@
CLICK_DECLS
GTPLookup::GTPLookup()
GTPLookup::GTPLookup() : _checksum(true)
{
}
......@@ -42,6 +42,7 @@ GTPLookup::configure(Vector<String> &conf, ErrorHandler *errh)
Element* e;
if (Args(conf, this, errh)
.read_mp("TABLE",e)
.read("CHECKSUM", _checksum)
.complete() < 0)
return -1;
......@@ -127,8 +128,12 @@ GTPLookup::process(int port, Packet* p_in) {
uint16_t len = p->length() - sizeof(click_ip);
udp->uh_ulen = htons(len);
udp->uh_sum = 0;
unsigned csum = click_in_cksum((unsigned char *)udp, len);
udp->uh_sum = click_in_cksum_pseudohdr(csum, ip, len);
if (_checksum) {
unsigned csum = click_in_cksum((unsigned char *)udp, len);
udp->uh_sum = click_in_cksum_pseudohdr(csum, ip, len);
} else {
udp->uh_sum = 0;
}
return 0;
}
}
......
......@@ -42,6 +42,7 @@ class GTPLookup : public BatchElement { public:
#endif
private:
GTPTable *_table;
bool _checksum;
atomic_uint32_t _id;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment