Hello Eddie,
This patch will add the ability to use HEADROOM parameter in
FromUserDevice element. This is quite useful if you write IPv4 packets
into /dev/toclick0 device, and you want to encapsulate them in IPv6 in
Click.
Roman
diff --git a/elements/linuxmodule/fromuserdevice.cc b/elements/linuxmodule/fromuserdevice.cc
index 2dc5436..0c9f256 100644
--- a/elements/linuxmodule/fromuserdevice.cc
+++ b/elements/linuxmodule/fromuserdevice.cc
@@ -79,6 +79,7 @@ FromUserDevice::FromUserDevice()
_failed_count = 0;
_exit = false;
_max = 0;
+ _headroom = 0;
}
FromUserDevice::~FromUserDevice()
@@ -163,7 +164,7 @@ ssize_t FromUserDevice::dev_write (struct file *filp, const char *buf,
}
// we should make a copy_from_user here and not while we hold the spinlock
- p = WritablePacket::make(count);
+ p = WritablePacket::make(elem->_headroom, 0, count, 0);
err = copy_from_user((char*)p->data(), buf, count);
if (err != 0)
{
@@ -230,6 +231,7 @@ int FromUserDevice::configure(Vector<String> &conf, ErrorHandler *errh)
if (cp_va_kparse(conf, this, errh,
"DEV_MINOR", cpkP+cpkM, cpUnsigned, &_dev_minor,
"CAPACITY", 0, cpUnsigned, &_capacity,
+ "HEADROOM", 0, cpUnsigned, &_headroom,
cpEnd) < 0)
return -1;
diff --git a/elements/linuxmodule/fromuserdevice.hh b/elements/linuxmodule/fromuserdevice.hh
index c1fcf74..2dffc72 100644
--- a/elements/linuxmodule/fromuserdevice.hh
+++ b/elements/linuxmodule/fromuserdevice.hh
@@ -84,6 +84,7 @@ private:
ulong _r_slot; // where we read from
ulong _w_slot; // where we write to
ulong _capacity;
+ ulong _headroom;
spinlock_t _lock;
ulong _write_count;
ulong _drop_count;
_______________________________________________
click mailing list
[email protected]
https://amsterdam.lcs.mit.edu/mailman/listinfo/click