-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b486626
Showing
113 changed files
with
23,928 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# do not check for standard stuff, like AM_PROG_CC_C_O | ||
AUTOMAKE_OPTIONS = foreign | ||
|
||
bin_PROGRAMS = ofss | ||
|
||
ofss_SOURCES = \ | ||
src/config/conf.c \ | ||
src/config/conf_args.c \ | ||
src/control/ctrl.c \ | ||
src/control/ctrl_conn.c \ | ||
src/control/ctrl_conn_tcp.c \ | ||
src/datapath/action.c \ | ||
src/datapath/action_list.c \ | ||
src/datapath/action_set.c \ | ||
src/datapath/dp.c \ | ||
src/datapath/dp_bufs.c \ | ||
src/datapath/dp_ctrl.c \ | ||
src/datapath/dp_mgr.c \ | ||
src/datapath/flow_entry.c \ | ||
src/datapath/flow_table.c \ | ||
src/datapath/group_entry.c \ | ||
src/datapath/group_table.c \ | ||
src/datapath/match_standard.c \ | ||
src/datapath/pipeline.c \ | ||
src/datapath/pipeline_packet.c \ | ||
src/datapath/protocol_stack.c \ | ||
src/lib/info.c \ | ||
src/lib/message_box.c \ | ||
src/lib/pkt_buf.c \ | ||
src/lib/thread_id.c \ | ||
src/logger/logger_args.c \ | ||
src/logger/logger_mgr.c \ | ||
src/logger/logger.c \ | ||
src/oflib/ofl_actions_pack.c \ | ||
src/oflib/ofl_actions_print.c \ | ||
src/oflib/ofl_actions_unpack.c \ | ||
src/oflib/ofl_actions.c \ | ||
src/oflib/ofl_messages_pack.c \ | ||
src/oflib/ofl_messages_print.c \ | ||
src/oflib/ofl_messages_unpack.c \ | ||
src/oflib/ofl_messages.c \ | ||
src/oflib/ofl_print.c \ | ||
src/oflib/ofl_structs_pack.c \ | ||
src/oflib/ofl_structs_print.c \ | ||
src/oflib/ofl_structs_unpack.c \ | ||
src/oflib/ofl_structs.c \ | ||
src/port/port_drv.c \ | ||
src/port/port_drv_mgr.c \ | ||
src/port/pcap/pcap_drv.c \ | ||
src/port/pcap/pcap_drv_linux.c \ | ||
src/port/pcap/pcap_port.c \ | ||
src/ofss.c | ||
|
||
#NOTE: autoconf adds "-g -O2" by default | ||
#O0: for debugging | ||
AM_CPPFLAGS = -I./src -I./vendor \ | ||
$(PCAP_CFLAGS) \ | ||
$(LIBEV_CFLAGS) \ | ||
-Wall -W -O0 | ||
|
||
AM_LDFLAGS = -pthread | ||
|
||
LDADD = $(PCAP_LIBS) \ | ||
$(LIBEV_LIBS) | ||
|
||
# additional files to be deleted by "make maintainer-clean" | ||
MAINTAINERCLEANFILES = \ | ||
Makefile.in \ | ||
configure \ | ||
aclocal.m4 \ | ||
build-aux/depcomp \ | ||
build-aux/install-sh \ | ||
build-aux/missing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
An OpenFlow software switch implementation from TrafficLab, Ericsson Research, Hungary. | ||
|
||
Check doc/README for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# require autoconf version >= 2.68 | ||
AC_PREREQ([2.68]) | ||
# initialize project | ||
AC_INIT([OFSS], [0.1], [[email protected]], | ||
[ofss], [https://github.com/TrafficLab/ofss/]) | ||
|
||
# check for source dir | ||
AC_CONFIG_SRCDIR([src/ofss.c]) | ||
|
||
|
||
# auxiliary build files go here | ||
AC_CONFIG_AUX_DIR([build-aux]) | ||
|
||
#find and probe C compiler | ||
AC_PROG_CC | ||
|
||
# use the C compiler for the following checks | ||
AC_LANG([C]) | ||
|
||
# Checks for header files. | ||
AC_CHECK_HEADERS([inttypes.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h unistd.h]) | ||
|
||
# Checks for typedefs, structures, and compiler characteristics. | ||
AC_HEADER_STDBOOL | ||
AC_C_INLINE | ||
AC_TYPE_SIZE_T | ||
AC_TYPE_SSIZE_T | ||
AC_TYPE_UINT16_T | ||
AC_TYPE_UINT32_T | ||
AC_TYPE_UINT64_T | ||
AC_TYPE_UINT8_T | ||
AC_CHECK_TYPES([ptrdiff_t]) | ||
|
||
# Checks for library functions. | ||
AC_FUNC_ERROR_AT_LINE | ||
AC_FUNC_MALLOC | ||
AC_FUNC_REALLOC | ||
AC_FUNC_STRERROR_R | ||
AC_CHECK_FUNCS([localtime_r memmove memset socket strchr strdup strspn]) | ||
|
||
#init automake | ||
#foreign: do not search/create NEWS, README, ChangeLog, ... | ||
#subdir-objects: put .o files to subdirs, not to project root | ||
AM_INIT_AUTOMAKE([1.11 foreign subdir-objects -Wall -Werror]) | ||
AC_CONFIG_FILES([Makefile]) | ||
|
||
# DEPENDENCIES | ||
|
||
# pcap dependency | ||
AC_ARG_WITH([pcap-include-path], | ||
[AS_HELP_STRING([--with-pcap-include-path], | ||
[location of the pcap headers, defaults to /usr/include])], | ||
[PCAP_CFLAGS="-I$withval"], | ||
[PCAP_CFLAGS='-I/usr/include']) | ||
AC_SUBST([PCAP_CFLAGS]) | ||
|
||
AC_ARG_WITH([pcap-lib-path], | ||
[AS_HELP_STRING([--with-pcap-lib-path], | ||
[location of the pcap libraries])], | ||
[PCAP_LIBS="-L$withval -lpcap"], | ||
[PCAP_LIBS='-lpcap']) | ||
AC_SUBST([PCAP_LIBS]) | ||
|
||
# libev dependency | ||
AC_ARG_WITH([libev-include-path], | ||
[AS_HELP_STRING([--with-libev-include-path], | ||
[location of the libev headers, defaults to /usr/include])], | ||
[LIBEV_CFLAGS="-I$withval"], | ||
[LIBEV_CFLAGS='-I/usr/include']) | ||
AC_SUBST([LIBEV_CFLAGS]) | ||
|
||
AC_ARG_WITH([libev-lib-path], | ||
[AS_HELP_STRING([--with-libev-lib-path], | ||
[location of the libev libraries])], | ||
[LIBEV_LIBS="-L$withval -lev"], | ||
[LIBEV_LIBS='-lev']) | ||
AC_SUBST([LIBEV_LIBS]) | ||
|
||
|
||
# finally generate Makefile, etc. | ||
AC_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Copyright (c) 2011-2012, TrafficLab, Ericsson Research, Hungary | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Dependencies | ||
============= | ||
libev (libev.schmorp.de/) | ||
------ | ||
# apt-get install libev-dev libev4 | ||
|
||
libpcap (http://www.tcpdump.org/) | ||
-------- | ||
# apt-get install libpcap-dev | ||
|
||
autoconf | ||
--------- | ||
# apt-get install autoconf | ||
|
||
|
||
|
||
Building | ||
========= | ||
> autoreconf -i | ||
> ./configure | ||
> make | ||
|
||
|
||
|
||
Running | ||
======== | ||
To run ofss, it must be able to open raw sockets. | ||
Either run it as superuser: | ||
# ./ofss ... | ||
Or grant raw socket capabilities to it: | ||
# setcap cap_net_raw+ep ./ofss | ||
> ./ofss ... | ||
|
||
Use the following to check the command line arguments: | ||
> ./ofss --help | ||
|
||
The suggested command line for local oftest: | ||
> ./ofss -i -ddpid:00000000000000a1 -pveth0,vh2,veth4,veth6 -clocalhost -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* Copyright (c) 2011-2012, TrafficLab, Ericsson Research, Hungary | ||
* All rights reserved. | ||
* | ||
* The contents of this file are subject to the license defined in | ||
* file 'doc/LICENSE', which is part of this source code package. | ||
* | ||
* | ||
* Author: Zoltán Lajos Kis <[email protected]> | ||
*/ | ||
|
||
/* | ||
* Configuration handler. | ||
* At the moment it only instantiates a single DP based on | ||
* the command line arguments. | ||
*/ | ||
|
||
#include <stdlib.h> | ||
#include <uthash/utlist.h> | ||
#include "datapath/dp_mgr.h" | ||
#include "logger/logger.h" | ||
#include "logger/logger_mgr.h" | ||
#include "conf.h" | ||
#include "conf_args.h" | ||
#include "conf_int.h" | ||
#include "lib/logger_names.h" | ||
#include "lib/util.h" | ||
|
||
|
||
static struct logger *logger; | ||
|
||
/* Static initializer for config manager. */ | ||
void | ||
conf_init() { | ||
logger = logger_mgr_get(LOGGER_NAME_CONFIG); | ||
} | ||
|
||
/* Processes command line arguments. */ | ||
void | ||
conf_args(void *args_) { | ||
assert(args_ != NULL); | ||
struct conf_args *args = (struct conf_args *)args_; | ||
|
||
// Create DP | ||
ssize_t dp_uid = dp_mgr_create_dp(args->dp->dpid); | ||
if (dp_uid == -1) { | ||
logger_log(logger, LOG_ERR, "Could not create requested DP."); | ||
conf_args_free(args); | ||
return; | ||
} | ||
|
||
// Add ports | ||
struct port_arg *port; | ||
LL_FOREACH(args->ports, port) { | ||
dp_mgr_dp_add_port(dp_uid, OF_NO_PORT, port->driver_name, port->port_name); | ||
} | ||
|
||
// Add controllers | ||
struct ctrl_arg *ctrl; | ||
LL_FOREACH(args->ctrls, ctrl) { | ||
dp_mgr_dp_add_ctrl(dp_uid, ctrl->transport, ctrl->host, ctrl->port); | ||
} | ||
|
||
logger_log(logger, LOG_INFO, "Created new DP (%u) from args.", dp_uid); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* Copyright (c) 2011-2012, TrafficLab, Ericsson Research, Hungary | ||
* All rights reserved. | ||
* | ||
* The contents of this file are subject to the license defined in | ||
* file 'doc/LICENSE', which is part of this source code package. | ||
* | ||
* | ||
* Author: Zoltán Lajos Kis <[email protected]> | ||
*/ | ||
|
||
#ifndef _CONF_H_ | ||
#define _CONF_H_ 1 | ||
|
||
void | ||
conf_init(); | ||
|
||
void | ||
conf_args(void *args_); | ||
|
||
#endif /* _CONF_H_ */ |
Oops, something went wrong.