undefined reference to `Tins::Dot11ManagementFrame::ssid() const

66 views
Skip to first unread message

Rich Henry

unread,
Jul 12, 2016, 4:21:09 PM7/12/16
to libtins
Built and linked tins at v3.4 (tried master as well) from github (with C++ 11 support enabled), had all the dependencies and it built/installed cleanly.

When trying to link my program, all the calls to tins work, except for the call to get the ssid from my beacon frames:

src/packet_sniffer.cpp:(.text+0x916): undefined reference to `Tins::Dot11ManagementFrame::ssid() const'

The body of my callback is almost exactly like the AP sniffer in the examples:

      const Dot11Beacon &beacon = pdu->rfind_pdu<Dot11Beacon>();
     
if (!beacon.from_ds() && beacon.to_ds())
     
{
        address_type addr
= beacon.addr2();
       
set<address_type>::iterator it = ssids.find(addr);
       
if (it == ssids.end())
       
{
         
try
         
{
            string ssid = beacon.ssid();
            ssids
.insert(addr);
            sink
.consume(ssid);
            BOOST_LOG_TRIVIAL
(info) << "Encountered new SSID -> " << ssid;
         
}
         
catch (runtime_error&)
         
{
           
// ignore non-corforming beacons
         
}
       
}
     
}

My library appears to define the symbol for that method:


root@39632e5a69ef
:/# objdump -t /usr/local/lib/libtins.so | grep ssid  
00000000000907f0 g     F .text    000000000000000e              _ZN4Tins20Dot11ManagementFrame4ssidERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
0000000000048db0 g     F .text    0000000000000005              _ZNK4Tins6Crypto4WPA214SupplicantData4ssidB5cxx11Ev
0000000000047900 g     F .text    00000000000000eb              _ZN4Tins6Crypto9get_bssidERKNS_9Dot11DataE
0000000000091aa0 g     F .text    00000000000000ac              _ZNK4Tins20Dot11ManagementFrame4ssidB5cxx11Ev

No problems compiling, and I'm specifying the library linking (clang version 3.8.0-2ubuntu3):

clang++ -o sniffer_app src/main.o src/packet_sniffer.o -ltins <other libs elided>

Any ideas as to what i may be doing wrong?

It's really confusing, as beacon.addr2() is a method on the management frame as well, and it resolves fine. Otherwise, id be looking for configuration errors.

Thanks in advance,
Rich

Rich Henry

unread,
Jul 12, 2016, 4:28:30 PM7/12/16
to libtins
root@39632e5a69ef:/# clang++ -std=c++11 -o beacon-display beacon-display.cpp -ltins
/
tmp/beacon-display-5634e8.o: In function `BeaconSniffer::callback(Tins::PDU&)':
beacon-display.cpp:(.text+0x2be): undefined reference to `
Tins::Dot11ManagementFrame::ssid() const'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
root@39632e5a69ef:/# g++ -std=c++11 -o beacon-display beacon-display.cpp -ltins

It actually links different with g++, i can just use g++ -- but bizarre. I hate C++.

Matias Fontanini

unread,
Jul 12, 2016, 4:29:40 PM7/12/16
to libtins
Cool that it works. I tried it with both clang and gcc and it works fine for me. Maybe there's some weird config breaking something.

Rich Henry

unread,
Jul 12, 2016, 4:42:58 PM7/12/16
to libtins
Yeah, im pretty sure it's a clang problem. The libtins, etc are all built with g++, and i just prefer clang for my code -- but perhaps not anymore.
Reply all
Reply to author
Forward
0 new messages