Skip to content

Commit

Permalink
Clearly mark all Apache 2.0 licensed code as such
Browse files Browse the repository at this point in the history
This change adds one-line explicit license references for source files
that are Apache 2.0 licensed i.e. the vast majority of code in Snabb
Switch.

This change attempts to preserve all existing license and copyright
messages, with the exception of avoiding redundantly referencing
Apache 2.0 license more than once in the same file.

The motivation for this change is twofold:

- To make the source code license more obvious to users and contributors.
- To put into practice the agreement made in issue #729.

The change was initially made automatically with a 'sed' script and
then I reviewed each file individually.

Notes:
- avx2.c and sse2.c state that they are derived from MIT-licensed code.
- dynasm lua-mode is already clearly marked as public domain.
- checksum.c states that it is derived from BSD licensed code.
- utilities imported into the project are left as-is e.g. StackTracePlus.lua.
  • Loading branch information
lukego committed Feb 19, 2016
1 parent 0d6470d commit 70f207f
Show file tree
Hide file tree
Showing 122 changed files with 251 additions and 23 deletions.
2 changes: 2 additions & 0 deletions src/apps/basic/basic_apps.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

module(...,package.seeall)

local app = require("core.app")
Expand Down
2 changes: 2 additions & 0 deletions src/apps/bridge/base.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

-- Base class for an Ethernet bridge with split-horizon semantics.
--
-- A bridge conists of any number of ports, each of which is a member
Expand Down
2 changes: 2 additions & 0 deletions src/apps/bridge/flooding.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

-- This class derives from lib.bridge.base and implements the simplest
-- possible bridge, which floods a packet arriving on a port to all
-- destination ports within its scope according to the split-horizon
Expand Down
2 changes: 2 additions & 0 deletions src/apps/bridge/learning.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */

/* Type for port and split-horizon group handles */
typedef uint16_t handle_t;

Expand Down
2 changes: 2 additions & 0 deletions src/apps/bridge/learning.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

-- This class derives from lib.bridge.base and implements a "learning
-- bridge" using a MAC address table provided by apps.bridge.mac_table
-- to store the set of source addresses of packets arriving on all
Expand Down
2 changes: 2 additions & 0 deletions src/apps/bridge/mac_table.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */

#include <inttypes.h>
#include "learning.h"

Expand Down
1 change: 1 addition & 0 deletions src/apps/bridge/mac_table.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.
--
-- This module implements a MAC address table as part of the learning
-- bridge app (apps.bridge.learning). It associates a MAC address
Expand Down
2 changes: 2 additions & 0 deletions src/apps/csv.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

module(...,package.seeall)

local app = require("core.app")
Expand Down
2 changes: 2 additions & 0 deletions src/apps/intel/intel.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */

// RX descriptor written by software.
struct rx_desc {
uint64_t address; // 64-bit address of receive buffer
Expand Down
2 changes: 2 additions & 0 deletions src/apps/intel/intel10g.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

--- Device driver for the Intel 82599 10-Gigabit Ethernet controller.
--- This is one of the most popular production 10G Ethernet
--- controllers on the market and it is readily available in
Expand Down
2 changes: 2 additions & 0 deletions src/apps/intel/intel1g.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

-- intel1g: Device driver app for Intel 1G network cards
--
-- This is a device driver for Intel i210, i350 families of 1G network cards.
Expand Down
2 changes: 2 additions & 0 deletions src/apps/intel/intel_app.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

module(...,package.seeall)

local zone = require("jit.zone")
Expand Down
2 changes: 2 additions & 0 deletions src/apps/intel/loadgen.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

module(...,package.seeall)

local ffi = require("ffi")
Expand Down
2 changes: 2 additions & 0 deletions src/apps/ipv6/nd_light.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

-- This app implements a small subset of IPv6 neighbor discovery
-- (RFC4861). It has two ports, north and south. The south port
-- attaches to a port on which ND must be performed. The north port
Expand Down
2 changes: 2 additions & 0 deletions src/apps/ipv6/ns_responder.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

-- This app acts as a responder for neighbor solicitaions for a
-- specific target address and as a relay for all other packets. It
-- has two ports, north and south. The south port attaches to a port
Expand Down
2 changes: 2 additions & 0 deletions src/apps/keyed_ipv6_tunnel/tunnel.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

module(...,package.seeall)

-- http://tools.ietf.org/html/draft-mkonstan-keyed-ipv6-tunnel-01
Expand Down
2 changes: 2 additions & 0 deletions src/apps/packet_filter/conntrack.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

-- conntrack.lua -- Connection tracking for IPv4/IPv6 TCP/UDP sessions
--
-- This module exposes the following API:
Expand Down
2 changes: 2 additions & 0 deletions src/apps/packet_filter/pcap_filter.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

module(...,package.seeall)

local app = require("core.app")
Expand Down
2 changes: 2 additions & 0 deletions src/apps/pcap/pcap.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

module(...,package.seeall)

local ffi = require("ffi")
Expand Down
2 changes: 2 additions & 0 deletions src/apps/rate_limiter/rate_limiter.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

module(..., package.seeall)

local app = require("core.app")
Expand Down
2 changes: 2 additions & 0 deletions src/apps/socket/raw.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

module(..., package.seeall)

local S = require("syscall")
Expand Down
2 changes: 2 additions & 0 deletions src/apps/solarflare/ef_vi.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */

#include <time.h>

/* etherfabric/base.h */
Expand Down
2 changes: 2 additions & 0 deletions src/apps/solarflare/poll.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */

/* poll.c - Poll multiple ef_vi interfaces in one FFI call to save on FFI overhead */

#include <stdint.h>
Expand Down
2 changes: 2 additions & 0 deletions src/apps/solarflare/solarflare.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

module(...,package.seeall)

local lib = require("core.lib")
Expand Down
2 changes: 2 additions & 0 deletions src/apps/tap/tap.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

module(..., package.seeall)

local S = require("syscall")
Expand Down
2 changes: 2 additions & 0 deletions src/apps/test/synth.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

module(...,package.seeall)

local ffi = require("ffi")
Expand Down
2 changes: 2 additions & 0 deletions src/apps/vhost/vhost.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */

// vhost_memory structure is used to declare which memory address
// ranges we want to use for DMA. The kernel uses this to create a
// shared memory mapping.
Expand Down
2 changes: 2 additions & 0 deletions src/apps/vhost/vhost_user.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */

#include <assert.h>
#include <errno.h>
#include <fcntl.h>
Expand Down
2 changes: 2 additions & 0 deletions src/apps/vhost/vhost_user.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */

enum {
VHOST_USER_MEMORY_MAX_NREGIONS = 8
};
Expand Down
2 changes: 2 additions & 0 deletions src/apps/vhost/vhost_user.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

--
-- See http://www.virtualopensystems.com/en/solutions/guides/snabbswitch-qemu/

Expand Down
2 changes: 2 additions & 0 deletions src/apps/virtio_net/virtio_net.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

-- Application to connect to a virtio-net driver implementation
--
-- Licensed under the Apache 2.0 license
Expand Down
2 changes: 2 additions & 0 deletions src/apps/vpn/vpws.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

-- Virtual Private Wire Service (VPWS)
-- Provides a L2 VPN on top of IP (v4/v6) and GRE
--
Expand Down
8 changes: 4 additions & 4 deletions src/arch/avx2.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* IP checksum routine for AVX2.
*
/* Use of this source code is governed by the Apache 2.0 license; see COPYING.
* Based on original SSE2 code by Tony Rogvall that is
* copyright 2011 Teclo Networks AG. MIT licensed by Juho Snellman.
*/
* copyright 2011 Teclo Networks AG. MIT licensed by Juho Snellman. */

/* IP checksum routine for AVX2. */

#include <stdint.h>
#include <arpa/inet.h>
Expand Down
8 changes: 4 additions & 4 deletions src/arch/sse2.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* IP checksum routine for AVX2.
*
/* Use of this source code is governed by the Apache 2.0 license; see COPYING.
* Original code by Tony Rogvall that is
* copyright 2011 Teclo Networks AG. MIT licensed by Juho Snellman.
*/
* copyright 2011 Teclo Networks AG. MIT licensed by Juho Snellman. */

/* IP checksum routine for SSE2. */

#include <stdint.h>
#include <arpa/inet.h>
Expand Down
2 changes: 2 additions & 0 deletions src/core/app.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

module(...,package.seeall)

local packet = require("core.packet")
Expand Down
2 changes: 2 additions & 0 deletions src/core/clib.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */

// sleep(3) - suspend execution for second intervals
unsigned int sleep(unsigned int seconds);

Expand Down
2 changes: 2 additions & 0 deletions src/core/config.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

-- 'config' is a data structure that describes an app network.

module(..., package.seeall)
Expand Down
2 changes: 2 additions & 0 deletions src/core/counter.h
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */

struct counter { uint64_t c; };
2 changes: 2 additions & 0 deletions src/core/counter.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

-- counter.lua - Count discrete events for diagnostic purposes
--
-- This module provides a thin layer for representing 64-bit counters
Expand Down
2 changes: 2 additions & 0 deletions src/core/freelist.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

module(...,package.seeall)

local ffi = require("ffi")
Expand Down
2 changes: 2 additions & 0 deletions src/core/lib.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */

#include <stdint.h>
#include <time.h>
#include <sys/stat.h>
Expand Down
2 changes: 2 additions & 0 deletions src/core/lib.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */

uint64_t get_time_ns();
double get_monotonic_time();
double get_unix_time();
Expand Down
2 changes: 2 additions & 0 deletions src/core/lib.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

module(...,package.seeall)

local ffi = require("ffi")
Expand Down
2 changes: 2 additions & 0 deletions src/core/link.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */

enum { LINK_RING_SIZE = 256,
LINK_MAX_PACKETS = LINK_RING_SIZE - 1
};
Expand Down
2 changes: 2 additions & 0 deletions src/core/link.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

module(...,package.seeall)

local debug = _G.developer_debug
Expand Down
2 changes: 2 additions & 0 deletions src/core/main.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

module(...,package.seeall)

-- Default to not using any Lua code on the filesystem.
Expand Down
2 changes: 2 additions & 0 deletions src/core/memory.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */

// memory.c -- allocate dma-friendly memory
//
// Allocate HugeTLB memory pages for DMA. HugeTLB memory is always
Expand Down
2 changes: 2 additions & 0 deletions src/core/memory.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */

int lock_memory();
void *allocate_huge_page(int size);
uint64_t phys_page(uint64_t virt_page);
Expand Down
2 changes: 2 additions & 0 deletions src/core/memory.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

module(...,package.seeall)

-- For more information about huge pages checkout:
Expand Down
2 changes: 2 additions & 0 deletions src/core/packet.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */

// The maximum amount of payload in any given packet.
enum { PACKET_PAYLOAD_SIZE = 10*1024 };

Expand Down
2 changes: 2 additions & 0 deletions src/core/packet.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

module(...,package.seeall)

local debug = _G.developer_debug
Expand Down
2 changes: 2 additions & 0 deletions src/core/selftest.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

module(...,package.seeall)

require("core.memory").selftest()
Expand Down
2 changes: 2 additions & 0 deletions src/core/shm.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

-- shm.lua -- shared memory alternative to ffi.new()

-- API:
Expand Down
2 changes: 2 additions & 0 deletions src/core/snabbswitch.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */

#include <stdio.h>

#include "lua.h"
Expand Down
2 changes: 2 additions & 0 deletions src/core/startup.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

local ok, err = pcall(require, "core.main")
if not ok then
print("startup: unhandled exception")
Expand Down
2 changes: 2 additions & 0 deletions src/core/timer.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

module(...,package.seeall)

local ffi = require("ffi")
Expand Down
2 changes: 2 additions & 0 deletions src/lib/bloom_filter.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

-- This module implements a basic Bloom filter as described in
-- <http://en.wikipedia.org/wiki/Bloom_filter>.
--
Expand Down
10 changes: 5 additions & 5 deletions src/lib/checksum.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* Use of this source code is governed by the Apache 2.0 license; see COPYING.
* Generic checksm routine originally taken from DPDK:
* BSD license; (C) Intel 2010-2015, 6WIND 2014. */

/* IP checksum routines.
*
* See src/arch/ for architecture specific SIMD versions.
*
* Generic checksm routine taken from DPDK:
* BSD license; (C) Intel 2010-2015, 6WIND 2014.
*/
* See src/arch/ for architecture specific SIMD versions. */

#include <arpa/inet.h>
#include <stdio.h>
Expand Down
2 changes: 2 additions & 0 deletions src/lib/checksum.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */

// Calculate IP checksum using SSE2 instructions.
// (This will crash if you call it on a CPU that does not support SSE.)
uint16_t cksum_sse2(unsigned char *p, size_t n, uint16_t initial);
Expand Down
2 changes: 2 additions & 0 deletions src/lib/checksum.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.

module(...,package.seeall)

-- This module exposes the interface:
Expand Down
2 changes: 2 additions & 0 deletions src/lib/checksum_lib.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */

/*
* Checksum library routines that are inline functions.
* For inclusion by checksum implementations.
Expand Down
2 changes: 2 additions & 0 deletions src/lib/hardware/pci.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */

#include <assert.h>
#include <fcntl.h>
#include <stdbool.h>
Expand Down
2 changes: 2 additions & 0 deletions src/lib/hardware/pci.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */

int open_pci_resource(const char *path);
void close_pci_resource(int fd, uint32_t *addr);
uint32_t *map_pci_resource(int fd);
Expand Down
Loading

0 comments on commit 70f207f

Please sign in to comment.