mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2025-03-09 00:17:31 +00:00
community/docker: patch for ARM support on setBridgeMacAddress of pkg/netlink
This commit is contained in:
parent
f6d5381f0a
commit
629bff919c
2 changed files with 108 additions and 2 deletions
|
@ -21,10 +21,12 @@ options=('!strip')
|
|||
install=$pkgname.install
|
||||
source=("git+https://github.com/dotcloud/docker.git#tag=v$pkgver"
|
||||
'docker-arm.patch'
|
||||
'btrfs-arm.patch')
|
||||
'btrfs-arm.patch'
|
||||
'docker-setBridgeMacAddress-ARM.patch')
|
||||
md5sums=('SKIP'
|
||||
'47cc1cdf900af66660bfa3402012ea71'
|
||||
'4683e045fd3f3ac40211c5b845bb693a')
|
||||
'4683e045fd3f3ac40211c5b845bb693a'
|
||||
'06d254bec427fa3f6b8a5846b60da1e6')
|
||||
|
||||
prepare() {
|
||||
cd "docker"
|
||||
|
@ -33,6 +35,8 @@ prepare() {
|
|||
find . -name '*.go' | xargs sed --in-place= -e 's/\/\/ +build amd64/\/\/ +build arm/'
|
||||
find . -name '*.go' | xargs sed --in-place= -e 's/\/\/ +build !linux !amd64/\/\/ +build !linux !arm/'
|
||||
find . -name '*.go' | xargs sed --in-place= -e 's/\/\/ +build linux,amd64/\/\/ +build linux,arm/'
|
||||
# This patch is applicable after the seds.
|
||||
patch -p1 -i ../docker-setBridgeMacAddress-ARM.patch
|
||||
}
|
||||
|
||||
build() {
|
||||
|
|
102
community/docker/docker-setBridgeMacAddress-ARM.patch
Normal file
102
community/docker/docker-setBridgeMacAddress-ARM.patch
Normal file
|
@ -0,0 +1,102 @@
|
|||
diff --git a/pkg/netlink/netlink_linux.go b/pkg/netlink/netlink_linux.go
|
||||
index 6de293d..77a411b 100644
|
||||
--- a/pkg/netlink/netlink_linux.go
|
||||
+++ b/pkg/netlink/netlink_linux.go
|
||||
@@ -5,7 +5,6 @@ package netlink
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
- "math/rand"
|
||||
"net"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
@@ -871,21 +870,3 @@ func AddToBridge(iface, master *net.Interface) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
-
|
||||
-func setBridgeMacAddress(s int, name string) error {
|
||||
- ifr := ifreqHwaddr{}
|
||||
- ifr.IfruHwaddr.Family = syscall.ARPHRD_ETHER
|
||||
- copy(ifr.IfrnName[:], name)
|
||||
-
|
||||
- for i := 0; i < 6; i++ {
|
||||
- ifr.IfruHwaddr.Data[i] = int8(rand.Intn(255))
|
||||
- }
|
||||
-
|
||||
- ifr.IfruHwaddr.Data[0] &^= 0x1 // clear multicast bit
|
||||
- ifr.IfruHwaddr.Data[0] |= 0x2 // set local assignment bit (IEEE802)
|
||||
-
|
||||
- if _, _, err := syscall.Syscall(syscall.SYS_IOCTL, uintptr(s), syscall.SIOCSIFHWADDR, uintptr(unsafe.Pointer(&ifr))); err != 0 {
|
||||
- return err
|
||||
- }
|
||||
- return nil
|
||||
-}
|
||||
diff --git a/pkg/netlink/setbridgemacaddress_amd64.go b/pkg/netlink/setbridgemacaddress_amd64.go
|
||||
new file mode 100644
|
||||
index 0000000..f6e799e
|
||||
--- /dev/null
|
||||
+++ b/pkg/netlink/setbridgemacaddress_amd64.go
|
||||
@@ -0,0 +1,27 @@
|
||||
+// +build amd64
|
||||
+
|
||||
+package netlink
|
||||
+
|
||||
+import (
|
||||
+ "math/rand"
|
||||
+ "syscall"
|
||||
+ "unsafe"
|
||||
+)
|
||||
+
|
||||
+func setBridgeMacAddress(s int, name string) error {
|
||||
+ ifr := ifreqHwaddr{}
|
||||
+ ifr.IfruHwaddr.Family = syscall.ARPHRD_ETHER
|
||||
+ copy(ifr.IfrnName[:], name)
|
||||
+
|
||||
+ for i := 0; i < 6; i++ {
|
||||
+ ifr.IfruHwaddr.Data[i] = int8(rand.Intn(255))
|
||||
+ }
|
||||
+
|
||||
+ ifr.IfruHwaddr.Data[0] &^= 0x1 // clear multicast bit
|
||||
+ ifr.IfruHwaddr.Data[0] |= 0x2 // set local assignment bit (IEEE802)
|
||||
+
|
||||
+ if _, _, err := syscall.Syscall(syscall.SYS_IOCTL, uintptr(s), syscall.SIOCSIFHWADDR, uintptr(unsafe.Pointer(&ifr))); err != 0 {
|
||||
+ return err
|
||||
+ }
|
||||
+ return nil
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/pkg/netlink/setbridgemacaddress_arm.go b/pkg/netlink/setbridgemacaddress_arm.go
|
||||
new file mode 100644
|
||||
index 0000000..a5e59c5
|
||||
--- /dev/null
|
||||
+++ b/pkg/netlink/setbridgemacaddress_arm.go
|
||||
@@ -0,0 +1,27 @@
|
||||
+// +build arm
|
||||
+
|
||||
+package netlink
|
||||
+
|
||||
+import (
|
||||
+ "math/rand"
|
||||
+ "syscall"
|
||||
+ "unsafe"
|
||||
+)
|
||||
+
|
||||
+func setBridgeMacAddress(s int, name string) error {
|
||||
+ ifr := ifreqHwaddr{}
|
||||
+ ifr.IfruHwaddr.Family = syscall.ARPHRD_ETHER
|
||||
+ copy(ifr.IfrnName[:], name)
|
||||
+
|
||||
+ for i := 0; i < 6; i++ {
|
||||
+ ifr.IfruHwaddr.Data[i] = uint8(rand.Intn(128))
|
||||
+ }
|
||||
+
|
||||
+ ifr.IfruHwaddr.Data[0] &^= 0x1 // clear multicast bit
|
||||
+ ifr.IfruHwaddr.Data[0] |= 0x2 // set local assignment bit (IEEE802)
|
||||
+
|
||||
+ if _, _, err := syscall.Syscall(syscall.SYS_IOCTL, uintptr(s), syscall.SIOCSIFHWADDR, uintptr(unsafe.Pointer(&ifr))); err != 0 {
|
||||
+ return err
|
||||
+ }
|
||||
+ return nil
|
||||
+}
|
||||
\ No newline at end of file
|
Loading…
Reference in a new issue