Incorporated and modified netlink, due to missing functionality

This commit is contained in:
mame82 2018-05-09 15:22:07 +00:00
parent eef028f24d
commit 103b22a060
11 changed files with 2324 additions and 174 deletions

31
netlink/netlink.go Normal file
View File

@ -0,0 +1,31 @@
// Packet netlink provide access to low level Netlink sockets and messages.
//
// Actual implementations are in:
// netlink_linux.go
// netlink_darwin.go
package netlink
import (
"errors"
"net"
)
var (
ErrWrongSockType = errors.New("Wrong socket type")
ErrShortResponse = errors.New("Got short response from netlink")
ErrInterfaceExists = errors.New("Network interface already exists")
)
// A Route is a subnet associated with the interface to reach it.
type Route struct {
*net.IPNet
Iface *net.Interface
Default bool
}
// An IfAddr defines IP network settings for a given network interface
type IfAddr struct {
Iface *net.Interface
IP net.IP
IPNet *net.IPNet
}

1655
netlink/netlink_linux.go Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
// +build arm ppc64 ppc64le
package netlink
func ifrDataByte(b byte) uint8 {
return uint8(b)
}

View File

@ -0,0 +1,7 @@
// +build !arm,!ppc64,!ppc64le
package netlink
func ifrDataByte(b byte) int8 {
return int8(b)
}

View File

@ -0,0 +1,408 @@
package netlink
import (
"net"
"strings"
"syscall"
"testing"
)
type testLink struct {
name string
linkType string
}
func addLink(t *testing.T, name string, linkType string) {
if err := NetworkLinkAdd(name, linkType); err != nil {
t.Fatalf("Unable to create %s link: %s", name, err)
}
}
func readLink(t *testing.T, name string) *net.Interface {
iface, err := net.InterfaceByName(name)
if err != nil {
t.Fatalf("Could not find %s interface: %s", name, err)
}
return iface
}
func deleteLink(t *testing.T, name string) {
if err := NetworkLinkDel(name); err != nil {
t.Fatalf("Unable to delete %s link: %s", name, err)
}
}
func upLink(t *testing.T, name string) {
iface := readLink(t, name)
if err := NetworkLinkUp(iface); err != nil {
t.Fatalf("Could not bring UP %#v interface: %s", iface, err)
}
}
func downLink(t *testing.T, name string) {
iface := readLink(t, name)
if err := NetworkLinkDown(iface); err != nil {
t.Fatalf("Could not bring DOWN %#v interface: %s", iface, err)
}
}
func ipAssigned(iface *net.Interface, ip net.IP) bool {
addrs, _ := iface.Addrs()
for _, addr := range addrs {
args := strings.SplitN(addr.String(), "/", 2)
if args[0] == ip.String() {
return true
}
}
return false
}
func TestNetworkLinkAddDel(t *testing.T) {
if testing.Short() {
return
}
testLinks := []testLink{
{"tstEth", "dummy"},
{"tstBr", "bridge"},
}
for _, tl := range testLinks {
addLink(t, tl.name, tl.linkType)
defer deleteLink(t, tl.name)
readLink(t, tl.name)
}
}
func TestNetworkLinkUpDown(t *testing.T) {
if testing.Short() {
return
}
tl := testLink{name: "tstEth", linkType: "dummy"}
addLink(t, tl.name, tl.linkType)
defer deleteLink(t, tl.name)
upLink(t, tl.name)
ifcAfterUp := readLink(t, tl.name)
if (ifcAfterUp.Flags & syscall.IFF_UP) != syscall.IFF_UP {
t.Fatalf("Could not bring UP %#v initerface", tl)
}
downLink(t, tl.name)
ifcAfterDown := readLink(t, tl.name)
if (ifcAfterDown.Flags & syscall.IFF_UP) == syscall.IFF_UP {
t.Fatalf("Could not bring DOWN %#v initerface", tl)
}
}
func TestNetworkSetMacAddress(t *testing.T) {
if testing.Short() {
return
}
tl := testLink{name: "tstEth", linkType: "dummy"}
macaddr := "22:ce:e0:99:63:6f"
addLink(t, tl.name, tl.linkType)
defer deleteLink(t, tl.name)
ifcBeforeSet := readLink(t, tl.name)
if err := NetworkSetMacAddress(ifcBeforeSet, macaddr); err != nil {
t.Fatalf("Could not set %s MAC address on %#v interface: %s", macaddr, tl, err)
}
ifcAfterSet := readLink(t, tl.name)
if ifcAfterSet.HardwareAddr.String() != macaddr {
t.Fatalf("Could not set %s MAC address on %#v interface", macaddr, tl)
}
}
func TestNetworkSetMTU(t *testing.T) {
if testing.Short() {
return
}
tl := testLink{name: "tstEth", linkType: "dummy"}
mtu := 1400
addLink(t, tl.name, tl.linkType)
defer deleteLink(t, tl.name)
ifcBeforeSet := readLink(t, tl.name)
if err := NetworkSetMTU(ifcBeforeSet, mtu); err != nil {
t.Fatalf("Could not set %d MTU on %#v interface: %s", mtu, tl, err)
}
ifcAfterSet := readLink(t, tl.name)
if ifcAfterSet.MTU != mtu {
t.Fatalf("Could not set %d MTU on %#v interface", mtu, tl)
}
}
func TestNetworkSetMasterNoMaster(t *testing.T) {
if testing.Short() {
return
}
master := testLink{"tstBr", "bridge"}
slave := testLink{"tstEth", "dummy"}
testLinks := []testLink{master, slave}
for _, tl := range testLinks {
addLink(t, tl.name, tl.linkType)
defer deleteLink(t, tl.name)
upLink(t, tl.name)
}
masterIfc := readLink(t, master.name)
slaveIfc := readLink(t, slave.name)
if err := NetworkSetMaster(slaveIfc, masterIfc); err != nil {
t.Fatalf("Could not set %#v to be the master of %#v: %s", master, slave, err)
}
// Trying to figure out a way to test which will not break on RHEL6.
// We could check for existence of /sys/class/net/tstEth/upper_tstBr
// which should point to the ../tstBr which is the UPPER device i.e. network bridge
if err := NetworkSetNoMaster(slaveIfc); err != nil {
t.Fatalf("Could not UNset %#v master of %#v: %s", master, slave, err)
}
}
func TestNetworkChangeName(t *testing.T) {
if testing.Short() {
return
}
tl := testLink{"tstEth", "dummy"}
newName := "newTst"
addLink(t, tl.name, tl.linkType)
linkIfc := readLink(t, tl.name)
if err := NetworkChangeName(linkIfc, newName); err != nil {
deleteLink(t, tl.name)
t.Fatalf("Could not change %#v interface name to %s: %s", tl, newName, err)
}
readLink(t, newName)
deleteLink(t, newName)
}
func TestNetworkLinkAddVlan(t *testing.T) {
if testing.Short() {
return
}
tl := struct {
name string
id uint16
}{
name: "tstVlan",
id: 32,
}
masterLink := testLink{"tstEth", "dummy"}
addLink(t, masterLink.name, masterLink.linkType)
defer deleteLink(t, masterLink.name)
if err := NetworkLinkAddVlan(masterLink.name, tl.name, tl.id); err != nil {
t.Fatalf("Unable to create %#v VLAN interface: %s", tl, err)
}
readLink(t, tl.name)
}
func TestNetworkLinkAddMacVlan(t *testing.T) {
if testing.Short() {
return
}
tl := struct {
name string
mode string
}{
name: "tstVlan",
mode: "private",
}
masterLink := testLink{"tstEth", "dummy"}
addLink(t, masterLink.name, masterLink.linkType)
defer deleteLink(t, masterLink.name)
if err := NetworkLinkAddMacVlan(masterLink.name, tl.name, tl.mode); err != nil {
t.Fatalf("Unable to create %#v MAC VLAN interface: %s", tl, err)
}
readLink(t, tl.name)
}
func TestNetworkLinkAddMacVtap(t *testing.T) {
if testing.Short() {
return
}
tl := struct {
name string
mode string
}{
name: "tstVtap",
mode: "private",
}
masterLink := testLink{"tstEth", "dummy"}
addLink(t, masterLink.name, masterLink.linkType)
defer deleteLink(t, masterLink.name)
if err := NetworkLinkAddMacVtap(masterLink.name, tl.name, tl.mode); err != nil {
t.Fatalf("Unable to create %#v MAC VTAP interface: %s", tl, err)
}
readLink(t, tl.name)
}
func TestAddDelNetworkIp(t *testing.T) {
if testing.Short() {
return
}
ifaceName := "lo"
ip := net.ParseIP("127.0.1.1")
mask := net.IPv4Mask(255, 255, 255, 255)
ipNet := &net.IPNet{IP: ip, Mask: mask}
iface, err := net.InterfaceByName(ifaceName)
if err != nil {
t.Skip("No 'lo' interface; skipping tests")
}
if err := NetworkLinkAddIp(iface, ip, ipNet); err != nil {
t.Fatalf("Could not add IP address %s to interface %#v: %s", ip.String(), iface, err)
}
if !ipAssigned(iface, ip) {
t.Fatalf("Could not locate address '%s' in lo address list.", ip.String())
}
if err := NetworkLinkDelIp(iface, ip, ipNet); err != nil {
t.Fatalf("Could not delete IP address %s from interface %#v: %s", ip.String(), iface, err)
}
if ipAssigned(iface, ip) {
t.Fatalf("Located address '%s' in lo address list after removal.", ip.String())
}
}
func TestAddRouteSourceSelection(t *testing.T) {
tstIp := "127.1.1.1"
tl := testLink{name: "tstEth", linkType: "dummy"}
addLink(t, tl.name, tl.linkType)
defer deleteLink(t, tl.name)
ip := net.ParseIP(tstIp)
mask := net.IPv4Mask(255, 255, 255, 255)
ipNet := &net.IPNet{IP: ip, Mask: mask}
iface, err := net.InterfaceByName(tl.name)
if err != nil {
t.Fatalf("Lost created link %#v", tl)
}
if err := NetworkLinkAddIp(iface, ip, ipNet); err != nil {
t.Fatalf("Could not add IP address %s to interface %#v: %s", ip.String(), iface, err)
}
upLink(t, tl.name)
defer downLink(t, tl.name)
if err := AddRoute("127.0.0.0/8", tstIp, "", tl.name); err != nil {
t.Fatalf("Failed to add route with source address")
}
}
func TestCreateVethPair(t *testing.T) {
if testing.Short() {
return
}
var (
name1 = "veth1"
name2 = "veth2"
)
if err := NetworkCreateVethPair(name1, name2, 0); err != nil {
t.Fatalf("Could not create veth pair %s %s: %s", name1, name2, err)
}
defer NetworkLinkDel(name1)
readLink(t, name1)
readLink(t, name2)
}
//
// netlink package tests which do not use RTNETLINK
//
func TestCreateBridgeWithMac(t *testing.T) {
if testing.Short() {
return
}
name := "testbridge"
if err := CreateBridge(name, true); err != nil {
t.Fatal(err)
}
if _, err := net.InterfaceByName(name); err != nil {
t.Fatal(err)
}
// cleanup and tests
if err := DeleteBridge(name); err != nil {
t.Fatal(err)
}
if _, err := net.InterfaceByName(name); err == nil {
t.Fatalf("expected error getting interface because %s bridge was deleted", name)
}
}
func TestSetMacAddress(t *testing.T) {
if testing.Short() {
return
}
name := "testmac"
mac := randMacAddr()
if err := NetworkLinkAdd(name, "bridge"); err != nil {
t.Fatal(err)
}
defer NetworkLinkDel(name)
if err := SetMacAddress(name, mac); err != nil {
t.Fatal(err)
}
iface, err := net.InterfaceByName(name)
if err != nil {
t.Fatal(err)
}
if iface.HardwareAddr.String() != mac {
t.Fatalf("mac address %q does not match %q", iface.HardwareAddr, mac)
}
}

View File

@ -131,22 +131,23 @@ func (m *LEDSettings) GetBlinkCount() uint32 {
// USB Gadget
type GadgetSettings struct {
Enabled bool `protobuf:"varint,1,opt,name=enabled" json:"enabled,omitempty"`
Vid string `protobuf:"bytes,2,opt,name=vid" json:"vid,omitempty"`
Pid string `protobuf:"bytes,3,opt,name=pid" json:"pid,omitempty"`
Manufacturer string `protobuf:"bytes,4,opt,name=manufacturer" json:"manufacturer,omitempty"`
Product string `protobuf:"bytes,5,opt,name=product" json:"product,omitempty"`
Serial string `protobuf:"bytes,6,opt,name=serial" json:"serial,omitempty"`
Use_CDC_ECM bool `protobuf:"varint,7,opt,name=use_CDC_ECM,json=useCDCECM" json:"use_CDC_ECM,omitempty"`
Use_RNDIS bool `protobuf:"varint,8,opt,name=use_RNDIS,json=useRNDIS" json:"use_RNDIS,omitempty"`
Use_HID_KEYBOARD bool `protobuf:"varint,9,opt,name=use_HID_KEYBOARD,json=useHIDKEYBOARD" json:"use_HID_KEYBOARD,omitempty"`
Use_HID_MOUSE bool `protobuf:"varint,10,opt,name=use_HID_MOUSE,json=useHIDMOUSE" json:"use_HID_MOUSE,omitempty"`
Use_HID_RAW bool `protobuf:"varint,11,opt,name=use_HID_RAW,json=useHIDRAW" json:"use_HID_RAW,omitempty"`
Use_UMS bool `protobuf:"varint,12,opt,name=use_UMS,json=useUMS" json:"use_UMS,omitempty"`
Use_SERIAL bool `protobuf:"varint,13,opt,name=use_SERIAL,json=useSERIAL" json:"use_SERIAL,omitempty"`
RndisSettings *GadgetSettingsEthernet `protobuf:"bytes,14,opt,name=rndis_settings,json=rndisSettings" json:"rndis_settings,omitempty"`
CdcEcmSettings *GadgetSettingsEthernet `protobuf:"bytes,15,opt,name=cdc_ecm_settings,json=cdcEcmSettings" json:"cdc_ecm_settings,omitempty"`
UmsSettings *GadgetSettingsUMS `protobuf:"bytes,16,opt,name=ums_settings,json=umsSettings" json:"ums_settings,omitempty"`
Enabled bool `protobuf:"varint,1,opt,name=enabled" json:"enabled,omitempty"`
Vid string `protobuf:"bytes,2,opt,name=vid" json:"vid,omitempty"`
Pid string `protobuf:"bytes,3,opt,name=pid" json:"pid,omitempty"`
Manufacturer string `protobuf:"bytes,4,opt,name=manufacturer" json:"manufacturer,omitempty"`
Product string `protobuf:"bytes,5,opt,name=product" json:"product,omitempty"`
Serial string `protobuf:"bytes,6,opt,name=serial" json:"serial,omitempty"`
Use_CDC_ECM bool `protobuf:"varint,7,opt,name=use_CDC_ECM,json=useCDCECM" json:"use_CDC_ECM,omitempty"`
Use_RNDIS bool `protobuf:"varint,8,opt,name=use_RNDIS,json=useRNDIS" json:"use_RNDIS,omitempty"`
Use_HID_KEYBOARD bool `protobuf:"varint,9,opt,name=use_HID_KEYBOARD,json=useHIDKEYBOARD" json:"use_HID_KEYBOARD,omitempty"`
Use_HID_MOUSE bool `protobuf:"varint,10,opt,name=use_HID_MOUSE,json=useHIDMOUSE" json:"use_HID_MOUSE,omitempty"`
Use_HID_RAW bool `protobuf:"varint,11,opt,name=use_HID_RAW,json=useHIDRAW" json:"use_HID_RAW,omitempty"`
Use_UMS bool `protobuf:"varint,12,opt,name=use_UMS,json=useUMS" json:"use_UMS,omitempty"`
Use_SERIAL bool `protobuf:"varint,13,opt,name=use_SERIAL,json=useSERIAL" json:"use_SERIAL,omitempty"`
RndisSettings *GadgetSettingsEthernet `protobuf:"bytes,14,opt,name=rndis_settings,json=rndisSettings" json:"rndis_settings,omitempty"`
CdcEcmSettings *GadgetSettingsEthernet `protobuf:"bytes,15,opt,name=cdc_ecm_settings,json=cdcEcmSettings" json:"cdc_ecm_settings,omitempty"`
UmsSettings *GadgetSettingsUMS `protobuf:"bytes,16,opt,name=ums_settings,json=umsSettings" json:"ums_settings,omitempty"`
EthernetSettings *EthernetInterfaceSettings `protobuf:"bytes,17,opt,name=ethernet_settings,json=ethernetSettings" json:"ethernet_settings,omitempty"`
}
func (m *GadgetSettings) Reset() { *m = GadgetSettings{} }
@ -266,6 +267,13 @@ func (m *GadgetSettings) GetUmsSettings() *GadgetSettingsUMS {
return nil
}
func (m *GadgetSettings) GetEthernetSettings() *EthernetInterfaceSettings {
if m != nil {
return m.EthernetSettings
}
return nil
}
type GadgetSettingsEthernet struct {
HostAddr string `protobuf:"bytes,1,opt,name=host_addr,json=hostAddr" json:"host_addr,omitempty"`
DevAddr string `protobuf:"bytes,2,opt,name=dev_addr,json=devAddr" json:"dev_addr,omitempty"`
@ -319,7 +327,8 @@ type EthernetInterfaceSettings struct {
Mode EthernetInterfaceSettings_Mode `protobuf:"varint,2,opt,name=mode,enum=P4wnP1_grpc.EthernetInterfaceSettings_Mode" json:"mode,omitempty"`
IpAddress4 string `protobuf:"bytes,3,opt,name=ipAddress4" json:"ipAddress4,omitempty"`
Netmask4 string `protobuf:"bytes,4,opt,name=netmask4" json:"netmask4,omitempty"`
DhcpServerSettings *DHCPServerSettings `protobuf:"bytes,5,opt,name=dhcpServerSettings" json:"dhcpServerSettings,omitempty"`
Enabled bool `protobuf:"varint,5,opt,name=enabled" json:"enabled,omitempty"`
DhcpServerSettings *DHCPServerSettings `protobuf:"bytes,6,opt,name=dhcpServerSettings" json:"dhcpServerSettings,omitempty"`
}
func (m *EthernetInterfaceSettings) Reset() { *m = EthernetInterfaceSettings{} }
@ -355,6 +364,13 @@ func (m *EthernetInterfaceSettings) GetNetmask4() string {
return ""
}
func (m *EthernetInterfaceSettings) GetEnabled() bool {
if m != nil {
return m.Enabled
}
return false
}
func (m *EthernetInterfaceSettings) GetDhcpServerSettings() *DHCPServerSettings {
if m != nil {
return m.DhcpServerSettings
@ -896,83 +912,84 @@ var _P4WNP1_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("grpc.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 1237 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x5d, 0x6f, 0xdb, 0x36,
0x17, 0x8e, 0x1d, 0xc7, 0x1f, 0xc7, 0x8e, 0xa3, 0xb2, 0x7d, 0x5b, 0x35, 0xfd, 0xca, 0xab, 0x75,
0x43, 0xb0, 0x15, 0x06, 0xea, 0xe5, 0xa2, 0x28, 0x30, 0x6c, 0xaa, 0xad, 0xc4, 0x5e, 0x63, 0x5b,
0x90, 0xe2, 0x06, 0xbb, 0x12, 0x18, 0x91, 0x8d, 0x89, 0x58, 0x1f, 0x10, 0xa9, 0x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0x7b, 0xee,
0x2d, 0x9d, 0xcf, 0xc5, 0x7c, 0x49, 0xf0, 0x27, 0x68, 0x1f, 0x51, 0xb1, 0xfc, 0x71, 0x5c, 0x97,
0x95, 0xbe, 0x82, 0x2d, 0xb1, 0x33, 0x05, 0x77, 0x55, 0xe1, 0x4e, 0xf6, 0xee, 0x1a, 0x6d, 0x63,
0x03, 0xf5, 0xa1, 0x35, 0x92, 0x5f, 0xd2, 0xe9, 0xc8, 0x55, 0x77, 0xfd, 0x17, 0xbe, 0x17, 0xeb,
0x55, 0xce, 0xaa, 0xea, 0x4f, 0xfc, 0xfd, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xb7, 0x27, 0x83,
0xd2, 0x21, 0x0b, 0x00, 0x00,
// 1261 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x6d, 0x6f, 0xdb, 0xb6,
0x13, 0x8f, 0x9d, 0xf8, 0xe9, 0xec, 0x38, 0x0a, 0xdb, 0x7f, 0xab, 0xa6, 0x4f, 0xf9, 0x6b, 0x5d,
0x11, 0x6c, 0x85, 0x81, 0x7a, 0x79, 0x51, 0x14, 0x18, 0x36, 0xd5, 0x56, 0x62, 0xaf, 0xb1, 0x2d,
0x48, 0x71, 0x83, 0xbd, 0x12, 0x18, 0x91, 0x8d, 0x89, 0xd8, 0x92, 0x20, 0x52, 0xe9, 0xf2, 0x7e,
0x9f, 0x6a, 0xdf, 0x61, 0x1f, 0x62, 0x9f, 0x64, 0x03, 0x29, 0xc9, 0x0f, 0x89, 0xd3, 0x16, 0xdb,
0x3b, 0xde, 0xef, 0xee, 0x7e, 0x3c, 0xf2, 0x78, 0x77, 0x04, 0xb8, 0x88, 0x23, 0xbf, 0x15, 0xc5,
0xa1, 0x08, 0x51, 0xdd, 0x3e, 0xfc, 0x14, 0xd8, 0xaf, 0x3d, 0x09, 0x19, 0x2d, 0xa8, 0x9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0x95, 0xe1, 0x4e, 0xeb, 0xbd, 0x35, 0xdc, 0xc6, 0x06, 0xea, 0x42, 0x63, 0x20, 0x7f, 0xc0, 0xe3,
0x81, 0xab, 0x7a, 0xfd, 0x17, 0x7e, 0x33, 0xeb, 0x59, 0xce, 0xcb, 0xea, 0x0b, 0xfe, 0xc3, 0x3f,
0x01, 0x00, 0x00, 0xff, 0xff, 0x6c, 0x92, 0x45, 0x40, 0x90, 0x0b, 0x00, 0x00,
}

View File

@ -33,9 +33,10 @@ message GadgetSettings {
bool use_HID_RAW = 11;
bool use_UMS = 12;
bool use_SERIAL = 13;
GadgetSettingsEthernet rndis_settings = 14;
GadgetSettingsEthernet cdc_ecm_settings = 15;
GadgetSettingsEthernet rndis_settings = 14; //Only applicable if RNDIS on
GadgetSettingsEthernet cdc_ecm_settings = 15; //Only applicable if CDC ECM on
GadgetSettingsUMS ums_settings = 16;
EthernetInterfaceSettings ethernet_settings = 17; //only applicable if RNDIS or CDC ECM on
}
message GadgetSettingsEthernet {
@ -59,7 +60,8 @@ message EthernetInterfaceSettings {
Mode mode = 2;
string ipAddress4 = 3;
string netmask4 = 4;
DHCPServerSettings dhcpServerSettings = 5;
bool enabled = 5;
DHCPServerSettings dhcpServerSettings = 6;
}
/* DHCP */

View File

@ -7,55 +7,11 @@ import (
"os"
)
const (
dnsmasq_conf_head = `port=0
listen-address=$IF_IP
dhcp-range=$IF_DHCP_RANGE,$IF_MASK,5m
dhcp-option=252,http://$IF_IP/wpad.dat
# router
dhcp-option=3,$IF_IP
# DNS
dhcp-option=6,$IF_IP
# NETBIOS NS
dhcp-option=44,$IF_IP
dhcp-option=45,$IF_IP
# routes static (route 0.0.0.1 to 127.255.255.254 through our device)
dhcp-option=121,0.0.0.0/1,$IF_IP,128.0.0.0/1,$IF_IP
# routes static (route 128.0.0.1 to 255.255.255.254 through our device)
dhcp-option=249,0.0.0.0/1,$IF_IP,128.0.0.0/1,$IF_IP
dhcp-leasefile=/tmp/dnsmasq.leases
dhcp-authoritative
log-dhcp`
)
/*
The DHCP server part relies on "dnsmasq" and thus depends on the binary
Note: dnsmasq default option have to be disabled explicitly if not needed, by setting an empty value (1, 3, 6, 12, 28)
*/
func DefaultDHCPConfigUSB() (settings *pb.DHCPServerSettings) {
settings = &pb.DHCPServerSettings{
CallbackScript: "/bin/evilscript",
DoNotBindInterface: false, //only bind to given interface
ListenInterface: USB_ETHERNET_BRIDGE_NAME,
LeaseFile: "/tmp/dnsmasq_" + USB_ETHERNET_BRIDGE_NAME + ".leases",
ListenPort: 0, //No DNS, DHCP only
NotAuthoritative: false, //be authoritative
Ranges: []*pb.DHCPServerRange {
&pb.DHCPServerRange{ RangeLower:"172.16.0.2", RangeUpper: "172.16.0.3", LeaseTime: "5m"},
&pb.DHCPServerRange{ RangeLower:"172.16.0.5", RangeUpper: "172.16.0.6", LeaseTime: "2m"},
},
Options: map[uint32]string {
3: "", //Disable option: Router
6: "", //Disable option: DNS
252: "http://172.16.0.1/wpad.dat",
//Options 1 (Netmask), 12 (Hostname) and 28 (Broadcast Address) are still enabled
},
}
return
}
func defaultLeaseFile(s *pb.DHCPServerSettings) (lf string) {
return fmt.Sprintf("/tmp/dnsmasq_%s.leases", s.ListenInterface) //default lease file
}

73
service/defaults.go Normal file
View File

@ -0,0 +1,73 @@
package service
import (
pb "../proto"
)
func GetDefaultNetworkSettingsUSB() (*pb.EthernetInterfaceSettings) {
//configure 172.24.0.1/255.255.255.252 for usbeth
ifSettings := &pb.EthernetInterfaceSettings {
Enabled: false,
Name: USB_ETHERNET_BRIDGE_NAME,
IpAddress4: "172.16.0.1",
Netmask4: "255.255.255.252",
Mode: pb.EthernetInterfaceSettings_MANUAL,
DhcpServerSettings: GetDefaultDHCPConfigUSB(),
}
return ifSettings
}
func GetDefaultDHCPConfigUSB() (settings *pb.DHCPServerSettings) {
settings = &pb.DHCPServerSettings{
CallbackScript: "/bin/evilscript",
DoNotBindInterface: false, //only bind to given interface
ListenInterface: USB_ETHERNET_BRIDGE_NAME,
LeaseFile: "/tmp/dnsmasq_" + USB_ETHERNET_BRIDGE_NAME + ".leases",
ListenPort: 0, //No DNS, DHCP only
NotAuthoritative: false, //be authoritative
Ranges: []*pb.DHCPServerRange{
&pb.DHCPServerRange{RangeLower: "172.16.0.2", RangeUpper: "172.16.0.2", LeaseTime: "5m"},
//&pb.DHCPServerRange{RangeLower: "172.16.0.5", RangeUpper: "172.16.0.6", LeaseTime: "2m"},
},
Options: map[uint32]string{
//Note: Options 1 (Netmask), 12 (Hostname) and 28 (Broadcast Address) are still enabled
3: "", //Disable option: Router
6: "", //Disable option: DNS
//252: "http://172.16.0.1/wpad.dat",
},
}
return
}
func GetDefaultGadgetSettings() (res pb.GadgetSettings) {
res = pb.GadgetSettings{
Enabled: false,
Vid: "0x1d6b",
Pid: "0x1337",
Manufacturer: "MaMe82",
Product: "P4wnP1 by MaMe82",
Serial: "deadbeef1337",
Use_CDC_ECM: false,
Use_RNDIS: false,
Use_HID_KEYBOARD: false,
Use_HID_MOUSE: false,
Use_HID_RAW: false,
Use_UMS: false,
Use_SERIAL: false,
RndisSettings: &pb.GadgetSettingsEthernet{
HostAddr: "42:63:65:12:34:56",
DevAddr: "42:63:65:56:34:12",
},
CdcEcmSettings: &pb.GadgetSettingsEthernet{
HostAddr: "42:63:66:12:34:56",
DevAddr: "42:63:66:56:34:12",
},
UmsSettings: &pb.GadgetSettingsUMS{
File:"", //we don't supply an image file, which is no problem as it could be applied later on (removable media)
Cdrom:false, //By default we don't emulate a CD drive, but a flashdrive
},
EthernetSettings: GetDefaultNetworkSettingsUSB(),
}
return res
}

View File

@ -1,7 +1,8 @@
package service
import (
"github.com/docker/libcontainer/netlink"
//"github.com/docker/libcontainer/netlink"
"../netlink"
"net"
"log"
"io/ioutil"
@ -32,6 +33,8 @@ func IpNetFromIPv4AndNetmask(ipv4 string, netmask string) (*net.IPNet, error) {
return &net.IPNet{IP: netw, Mask: mask}, nil
}
func CreateBridge(name string) (err error) {
return netlink.CreateBridge(name, false)
}
@ -104,8 +107,21 @@ func ConfigureInterface(settings *pb.EthernetInterfaceSettings) (err error) {
ipNet, err := IpNetFromIPv4AndNetmask(settings.IpAddress4, settings.Netmask4)
if err != nil { return err }
//Flush old IPs
netlink.NetworkLinkFlush(iface)
//set IP
log.Printf("Setting Interface %s to IP %s\n", iface.Name, settings.IpAddress4)
netlink.NetworkLinkAddIp(iface, net.ParseIP(settings.IpAddress4), ipNet)
//ToDo: Disabling doesn't work in gadget settings, but from test.go
if settings.Enabled {
log.Printf("Setting Interface %s to UP\n", iface.Name)
err = netlink.NetworkLinkUp(iface)
} else {
log.Printf("Setting Interface %s to DOWN\n", iface.Name)
err = netlink.NetworkLinkDown(iface)
}
if err != nil { return err }
}
return nil

View File

@ -172,37 +172,7 @@ func InitDefaultGadgetSettings() error {
return DeployGadgetSettings(defaultGadgetSettings)
}
func GetDefaultGadgetSettings() (res pb.GadgetSettings) {
res = pb.GadgetSettings{
Enabled: false,
Vid: "0x1d6b",
Pid: "0x1337",
Manufacturer: "MaMe82",
Product: "P4wnP1 by MaMe82",
Serial: "deadbeef1337",
Use_CDC_ECM: false,
Use_RNDIS: false,
Use_HID_KEYBOARD: false,
Use_HID_MOUSE: false,
Use_HID_RAW: false,
Use_UMS: false,
Use_SERIAL: false,
RndisSettings: &pb.GadgetSettingsEthernet{
HostAddr: "42:63:65:12:34:56",
DevAddr: "42:63:65:56:34:12",
},
CdcEcmSettings: &pb.GadgetSettingsEthernet{
HostAddr: "42:63:66:12:34:56",
DevAddr: "42:63:66:56:34:12",
},
UmsSettings: &pb.GadgetSettingsUMS{
File:"", //we don't supply an image file, which is no problem as it could be applied later on (removable media)
Cdrom:false, //By default we don't emulate a CD drive, but a flashdrive
},
}
return res
}
//depends on `lsmod` binary
func CheckLibComposite() error {
@ -622,6 +592,14 @@ func DeployGadgetSettings(settings pb.GadgetSettings) error {
return err
}
//Configure bridge interface
if settings.EthernetSettings == nil {
err = errors.New("Gadget has Ethernet enabled, but no Ethernet settings provided")
log.Println(err)
return err
}
ConfigureInterface(settings.EthernetSettings)
}
log.Printf("... done")