[Click] Parsing String through cp_va_kparse

Yogesh Mundada yhm at cc.gatech.edu
Sat Jun 20 01:52:43 EDT 2009


Hi,

I am trying to parse a string variable using cp_va_kparse(). However,
click crashes at install time.
To debug further, I created another dummy element from samplepackage
called sqdummy. I first tried to parse only int type that worked fine.
Then I added String as follows:

int
Sqdummy::configure(Vector<String> &conf, ErrorHandler *errh)
{
    int new_capacity = 1000;
    String data;
    if (cp_va_kparse(conf, this, errh,
                     "CAPACITY", cpkP, cpUnsigned, &new_capacity,
                     "DATA", cpkP, cpString, &data,
                     cpEnd) < 0)
        return -1;
    errh->error("XXX: %s capacity %d, data %s",
__FUNCTION__,new_capacity, data);
    return 0;
}

I got following compiler warnings:

gmake[1]: Entering directory `/data/click/userlevel'
  CXX ../elements/sqdummy/sqdummy.cc
../elements/sqdummy/sqdummy.cc: In member function ‘virtual int
Sqdummy::configure(Vector<String>&, ErrorHandler*)’:
../elements/sqdummy/sqdummy.cc:30: warning: cannot pass objects of
non-POD type ‘class String’ through ‘...’; call will abort at runtime
../elements/sqdummy/sqdummy.cc: At global scope:
../elements/sqdummy/sqdummy.cc:35: warning: unused parameter ‘errh’
  CXX elements.cc

(Not sure why String becomes non-POD)

If I install click using click-install, then click router crashes
(with a backtrace in dmesg). However, clickfs remains mounted. Any
further calls to click-uninstall, click-install or "ls /click" hangs.
To do any further click operations, I have to reboot the machine.

I checked the documentation for confparse.hh and I dont seem to be
doing anything wrong. There are other classes like todevice,
fromdevice that also try to parse "String _devname" (defined in
anydevice.hh) and I guess those work just fine. But I am not sure what
I am missing here.

Any help will be greatly appreciated.

-Yogesh



More information about the click mailing list