Commit 62666e52 authored by benjie's avatar benjie

revert back to old udpipencap

parent 1ebfb6bb
......@@ -54,7 +54,6 @@ UDPIPEncap::configure(const Vector<String> &conf, ErrorHandler *errh)
{
bool do_cksum = true;
unsigned sp, dp;
_interval = 0;
if (cp_va_parse(conf, this, errh,
cpIPAddress, "source address", &_saddr,
cpUnsigned, "source port", &sp,
......@@ -62,7 +61,6 @@ UDPIPEncap::configure(const Vector<String> &conf, ErrorHandler *errh)
cpUnsigned, "destination port", &dp,
cpOptional,
cpBool, "do UDP checksum?", &do_cksum,
cpUnsigned, "change interval", &_interval,
0) < 0)
return -1;
if (sp >= 0x10000 || dp >= 0x10000)
......@@ -72,7 +70,6 @@ UDPIPEncap::configure(const Vector<String> &conf, ErrorHandler *errh)
_dport = dp;
_id = 0;
_cksum = do_cksum;
_count = 0;
#ifdef __KERNEL__
// check alignment
......@@ -101,7 +98,7 @@ UDPIPEncap::simple_action(Packet *p_in)
ip->ip_v = 4;
ip->ip_hl = sizeof(click_ip) >> 2;
ip->ip_len = htons(p->length());
ip->ip_id = htons(_id++);
ip->ip_id = htons(click_atomic_add_short(1, &_id));
ip->ip_p = IP_PROTO_UDP;
ip->ip_src = _saddr;
ip->ip_dst = _daddr;
......@@ -148,12 +145,6 @@ UDPIPEncap::simple_action(Packet *p_in)
} else
udp->uh_sum = 0;
_count++;
if (_count==_interval && _interval > 0) {
_sport ++;
_dport ++;
_count = 0;
}
return p;
}
......
......@@ -3,15 +3,14 @@
/*
* =c
* UDPIPEncap(SADDR, SPORT, DADDR, DPORT [, CHECKSUM? [, INTERVAL]])
* UDPIPEncap(SADDR, SPORT, DADDR, DPORT [, CHECKSUM?])
* =s encapsulation, UDP
* encapsulates packets in static UDP/IP headers
* =d
* Encapsulates each incoming packet in a UDP/IP packet with source address
* SADDR, source port SPORT, destination address DADDR, and destination port
* DPORT. The UDP checksum is calculated if CHECKSUM? is true; it is true by
* default. SPORT and DPORT are incremented by 1 every INTERVAL number of
* packets. By default, INTERVAL is 0, which means do not increment.
* default.
*
* The UDPIPEncap element adds both a UDP header and an IP header.
*
......@@ -35,8 +34,6 @@ class UDPIPEncap : public Element {
bool _cksum : 1;
bool _aligned : 1;
unsigned short _id;
unsigned _count;
unsigned _interval;
public:
......
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