Hello all,
We attempted to deploy a click configuration on planetlab. We have tested both
RawSocket as well as IPFlowRawSockets and AggregateIPFLows combo as it is
suggested. Unfortunately, the receiving side does not work. We have tested on
PlanetLab Europe (PLE) nodes with latest planetlab linux distro that runs over
Xen or Vserver.
Running rawsockets on planetlab is a dominant planetlab list issue with several
threads and different solutions that are functional for specific planetlab
deployment versions. Starting with Proper API which is the oldest and probably
deprecated, Scout kernel module and currently vmnet.
We found that the solution that currently applies on latest PLE nodes is
described on this thread:
http://lists.planet-lab.org/pipermail/devel/2009-January/003255.html.
In brief, the authors of vmnet+ explain that in order for your sliver to become
a port owner on a planetlab machine you need to create and bind a DGRAM or
STREAM socket for UDP or TCP respectively. This will trigger the port
registration code in vmnet+. In the first version of vmnet, binding the raw
socket port was adequate and this is what current git rawsockets.cc code does.
Attached you will find a patch for rawsockets.cc,hh that creates a seperate
standard socket and binds it to the port to achieve registration. We have also
removed proper support since it is obsolete on planetlab. We have tested this
code sending/receiving UDP traffic on PLE nodes. Maybe we need other users to
confirm that it runs on PLC before it is considered for integration with
mainstream click.
Regards,
Dimitris
diff -rupN click_comp/elements/userlevel/rawsocket.cc click2.0/elements/userlevel/rawsocket.cc
--- click_comp/elements/userlevel/rawsocket.cc 2011-08-26 04:24:59.000000000 -0400
+++ click2.0/elements/userlevel/rawsocket.cc 2011-08-26 04:47:17.000000000 -0400
@@ -6,6 +6,9 @@
*
* Copyright (c) 2004-2005 The Trustees of Princeton University (Trustees).
*
+ * changes to support the updated planetlab port registration mechanism
+ * (c) 2011, Dimitris Syrivelis, CERTH
+ *
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, subject to the conditions
@@ -37,9 +40,6 @@
#include <sys/ioccom.h>
#endif
-#ifdef HAVE_PROPER
-#include <proper/prop.h>
-#endif
#include "fakepcap.hh"
@@ -47,7 +47,7 @@ CLICK_DECLS
RawSocket::RawSocket()
: _task(this), _timer(this),
- _fd(-1), _port(0), _proper(false), _snaplen(2048),
+ _fd(-1), _port(0), _snaplen(2048),
_headroom(Packet::default_headroom), _rq(0), _wq(0)
{
}
@@ -77,7 +77,6 @@ RawSocket::configure(Vector<String> &con
args.read_p("PORT", _port);
if (args.read("SNAPLEN", _snaplen)
.read("HEADROOM", _headroom)
- .read("PROPER", _proper)
.complete() < 0)
return -1;
@@ -106,6 +105,11 @@ RawSocket::initialize_socket_error(Error
close(_fd);
_fd = -1;
}
+
+ if(_port_register_socket >= 0) {
+ close(_port_register_socket);
+ _port_register_socket = -1;
+ }
return errh->error("%s: %s", syscall, strerror(e));
}
@@ -113,7 +117,7 @@ RawSocket::initialize_socket_error(Error
int
RawSocket::initialize(ErrorHandler *errh)
{
- struct sockaddr_in sin;
+ struct sockaddr_in sinreg;
// open socket, set options, bind to address
_fd = socket(PF_INET, SOCK_RAW, _protocol);
@@ -121,23 +125,23 @@ RawSocket::initialize(ErrorHandler *errh
return initialize_socket_error(errh, "socket");
if (_port) {
- memset(&sin, 0, sizeof(sin));
- sin.sin_family = PF_INET;
- sin.sin_port = htons(_port);
- sin.sin_addr = inet_makeaddr(0, 0);
-
- // bind to port
-#ifdef HAVE_PROPER
- int ret = -1;
- if (_proper) {
- ret = prop_bind_socket(_fd, (struct sockaddr *)&sin, sizeof(sin));
- if (ret < 0)
- errh->warning("prop_bind_socket: %s", strerror(errno));
+
+ if((_protocol == IPPROTO_UDP) || (_protocol == IPPROTO_TCP)) {
+ //Claim port ownership on planetlab works f
+ if(_protocol == IPPROTO_UDP)
+ _port_register_socket = socket(AF_INET, SOCK_DGRAM, _protocol);
+ else
+ _port_register_socket = socket(AF_INET, SOCK_STREAM, _protocol);
+
+ if(_port_register_socket < 0)
+ return initialize_socket_error(errh, "socket");
+ memset((char *) &sinreg, 0, sizeof(sinreg));
+ sinreg.sin_family = AF_INET;
+ sinreg.sin_port = htons(_port);
+ sinreg.sin_addr.s_addr = htonl(INADDR_ANY);
+ if (bind(_port_register_socket, (struct sockaddr *)&sinreg, sizeof(sinreg))==-2) { return errh->error("bind for planetlab port registration failed with: %s",strerror(errno)); }
}
- if (ret < 0)
-#endif
- if (bind(_fd, (struct sockaddr *)&sin, sizeof(sin)) < 0)
- return initialize_socket_error(errh, "bind");
+
}
// nonblocking I/O and close-on-exec for the socket
diff -rupN click_comp/elements/userlevel/rawsocket.hh click2.0/elements/userlevel/rawsocket.hh
--- click_comp/elements/userlevel/rawsocket.hh 2011-08-26 04:24:59.000000000 -0400
+++ click2.0/elements/userlevel/rawsocket.hh 2011-08-26 04:29:11.000000000 -0400
@@ -24,9 +24,10 @@ transports raw IP packets via safe raw s
Reads data from and writes data to a raw IPv4 socket. The raw IPv4
socket may optionally be bound to a source port number in the case of
TCP/UDP, a GRE key or PPTP call ID in the case of GRE, or an
-identifier in the case of ICMP. Binding a port to a raw IPv4 socket to
-reserve it and suppress TCP RST and ICMP Unreachable errors, is
-specific to PlanetLab Linux.
+identifier in the case of ICMP. For PlanetLab Linux (versions with VMNET+ onwards)
+and TCP or UDP protocol, a seperate SOCK_STREAM or SOCK_DGRAM will be
+created and bound to the specified port. This triggers the slice port registration
+mechanism in VMNET+.
Keyword arguments are:
@@ -39,10 +40,6 @@ represents the MRU of the RawSocket if i
packet source. If the MRU is violated by the peer, i.e. if a packet
longer than SNAPLEN is sent, the connection may be terminated.
-=item PROPER
-
-Boolean. PlanetLab specific. If true and Click has been configured
---with-proper, use Proper to bind a reserved port.
=item HEADROOM
@@ -85,9 +82,9 @@ protected:
private:
int _fd; // socket descriptor
+ int _port_register_socket; // socket for planetlab port registration
int _protocol; // IP protocol to bind
uint16_t _port; // (PlanetLab only) port to bind
- bool _proper; // (PlanetLab only) use Proper to bind port
int _snaplen; // maximum received packet length
unsigned _headroom; // header length to set aside in the packet
_______________________________________________
click mailing list
[email protected]
https://amsterdam.lcs.mit.edu/mailman/listinfo/click