Mobile Multimedia Lab



P2PWNC: Peer-to-peer Wireless Network Confederation RI - Documentation





This is the implementation of the Access Point module of the P2PWNC protocol. The main component (ap) is a multithreaded TCP server that waits for CONN messages from clients. There is also a separate program (cmd_handler) responsible for addind/removing IP tables rules, which communicates with ap via a message queue. Finally, there is a kernel-level traffic measurements module based on the netfilter (http://www.netfilter.org) framework.



This is free software, available under the GNU General Public Licence, with an exception for linking with the OpenSSL tooklit libraries. For more information see COPYING.



This is version 0.0.1 of the P2PWNC ap software.



  • ap: Main component. It includes the multithreaded TCP server (ap.c) and cmd_client.c

  • tlog: Traffic measurements module (tlog.c). It keeps track of the traffic the ap has forwarded for each client session
  • conf: Access point configuration file

  • keys: Some sample key and certificate files


This module runs on Linux. It has been tested under Linux 2.4. It depends on the P2PWNC libraries, and in particular libpwnc(protocol module, etc) and lib3p (threading, cryptography). Therefore, in order to build this software for your system, make sure the P2PWNC libraries are already installed. For the firewall operations, it makes use of iptables. If it is not available for your system, you may download it from the netfilter website. Also, you need to have support for System V IPC, since it is required for the communication between the ap and cmd_handler processes, which takes place via a sessage queue.



For generic configuration instructions see the INSTALL file or type ./configure --help. Next, there is a list of some configuration directives specific to the P2PWNC ap software:

  • --prefix=<some path>: Replace <some_path> with the installation path for the software. By default, this prefix is /usr/local. However, you are encouraged to change it to a directory of your preference, such as /usr/local/p2pwnc-ap.

  • --with-p2pwnc-libs=<path_to_p2pwnc_libraries>: Supply the path where the P2PWNC libraries are installed. By default, this path is /usr/local/p2pwnc-libs. Change it to the path where these libraries are installed on your system.

  • --enable-tlog: Build/install the traffic measurements module (tlog). This option has only been tested on Linux 2.4 kernel, so it may not work on your system.

  • --enable-firewall-off: This option has been retained for testing reasons only. Please, do *NOT* use it normally; it will *disable* firewall operations, so no access control will be taking place.




To build the software, you can follow the steps below:

  • Untar the archive (tar xvfz p2pwnc-ap-vXXX.tar.gz)

  • cd to the source directory

  • Configure the software typing ./configure and using the above instructions

  • Type make to compile the sources


After building the software, type 'make install'. This will install the software to the <prefix> directory (as specified when configuring the package). This will create the following directory structure:

+-prefix
|
+-bin
| |- ap
| |- cmd_handler
|
+-conf
| |-p2pwnc_ap.conf
|
+ keys
| |-TEAM0_pub.key
| |-TEAM0_priv.key
| |-member00_pub.key
| |-....
|
+ tlog
  |-tlog.o

To uninstall it, type 'make uninstall'.


Normally, in a 2.4 Linux system, the module will be build using the --enable-tlog option when configuring the software. If it works, it will build and install the module (tlog.o) in the <prefix>/tlog/ directory. Remember that you need to manually insmod the module typing 'insmod -f <prefix>/tlog/tlog.o' (or place it in a file such as /etc/modules.conf so that it can be automatically loaded on startup). If it *fails*, you need to manually build the module. In 2.4 kernels, usually what one needs to do is issue a command like the following:

gcc -O2 -isystem /lib/modules/`uname -r`/build/include -c -o tlog.o tlog.c


The module has not been tested on 2.6 systems yet. If you have a 2.6 kernel, do not use the --enable-tlog configure option and build the module separately.



The P2PWNC software has been ported on the Linksys WRT54GS wireless router. You can find instructions on porting it on that platform here.



The ap server reads information from a configuration file (optionally, these information can be provided as command line options). The default location for the configuration file of the ap server is <prefix>/conf/p2pwnc_ap.conf. However, you can override this setting using the -c flag when starting up the server (that is, ./ap -c myconf.conf). A sample configuration file is shown below:

#Access point module configuration file
public-key-path ../keys/TEAM0_PUB.key
server-port 9999
mq-key 111
tca-addr 127.0.0.1
iptables-path /sbin/iptables
subnet 192.168.1.0
mask 24
rreq-interval 30
max-threads 40
patient

Lines starting with a "#" are ignored. The first column represents configuration variables and the second is their value. These options are explained below:
  • public-key-path: Location of the file where the public key of the ap's team is stored

  • server-port:The TCP port that the server is listening for client connections

  • mq-key: The key of the message queue used for the communication between ap and cmd_handler

  • tca-addr: IP address of the receipt repository

  • iptables-path: Path of the iptables executable

  • subnet: Local network subnet

  • mask: Subnet mask

  • rreq-interval: Time interval (seconds) between two successive RREQ messages on a session

  • max-threads: Size of thread pool

  • patient: If this option appears in the configuration file, the ap operates in patience mode, that is it provides access to all visitors (although still requiring receipts)



To execute the ap software:
  • insmod the traffic measuring module (tlog)

  • start the cmd_handler program. This program takes as an argument the message queue key

  • start the ap program. You can specify the configuration file using the -c option. For a list of available options, type ./ap --help or ./ap -h (the available command line options are the same as the configuration options described above).

When executing the ./ap command, you may get the following error:

./ap: error while loading shared libraries: libssl.so.0.9.8: cannot open shared object file: No such file or directory


The solution is to set the LD_LIBRARY_PATH environment variable appropriately, since the system cannot locate the libraries against which the P2PWNC ap software has been linked. To set this variable issue the following command:

export LD_LIBRARY_PATH=/usr/local/p2pwnc/lib/:/usr/local/openssl/lib/


(these are sample paths, use the paths specific to your installation)