1 From 0102118524dffdc2917fafac5feeb2e410fd393e Mon Sep 17 00:00:00 2001 |
1 From 2dd56e50d4e22a931b6b26de35a19321ee0e36a4 Mon Sep 17 00:00:00 2001 |
2 From: Shreya Jain <[email protected]> |
2 From: "[email protected]" <[email protected]> |
3 Date: Tue, 15 Nov 2016 10:53:53 -0800 |
3 Date: Mon, 21 Nov 2016 12:10:24 -0800 |
4 Subject: [PATCH] Solaris-v1.10.3 |
4 Subject: [PATCH] Solaris-v1.10.3 |
5 |
5 |
6 --- |
6 --- |
7 Dockerfile.solaris | 26 + |
7 Dockerfile.solaris | 26 + |
8 Makefile | 35 +- |
8 Makefile | 35 +- |
148 .../docker/go-connections/sockets/unix_socket.go | 2 +- |
148 .../docker/go-connections/sockets/unix_socket.go | 2 +- |
149 .../docker/libnetwork/default_gateway_solaris.go | 7 + |
149 .../docker/libnetwork/default_gateway_solaris.go | 7 + |
150 .../libnetwork/drivers/solaris/bridge/bridge.go | 1084 ++++++++++++++++++++ |
150 .../libnetwork/drivers/solaris/bridge/bridge.go | 1084 ++++++++++++++++++++ |
151 .../drivers/solaris/bridge/bridge_store.go | 212 ++++ |
151 .../drivers/solaris/bridge/bridge_store.go | 212 ++++ |
152 .../libnetwork/drivers/solaris/bridge/errors.go | 341 ++++++ |
152 .../libnetwork/drivers/solaris/bridge/errors.go | 341 ++++++ |
153 .../drivers/solaris/bridge/port_mapping.go | 218 ++++ |
153 .../drivers/solaris/bridge/port_mapping.go | 247 +++++ |
154 .../docker/libnetwork/drivers_solaris.go | 13 + |
154 .../docker/libnetwork/drivers_solaris.go | 13 + |
155 .../docker/libnetwork/ipamutils/utils_solaris.go | 92 ++ |
155 .../docker/libnetwork/ipamutils/utils_solaris.go | 92 ++ |
156 vendor/src/github.com/docker/libnetwork/network.go | 2 - |
156 vendor/src/github.com/docker/libnetwork/network.go | 2 - |
157 .../docker/libnetwork/osl/interface_solaris.go | 6 + |
157 .../docker/libnetwork/osl/interface_solaris.go | 6 + |
158 .../docker/libnetwork/osl/namespace_solaris.go | 41 + |
158 .../docker/libnetwork/osl/namespace_solaris.go | 41 + |
195 vendor/src/gopkg.in/fsnotify.v1/fen.go | 188 ++++ |
195 vendor/src/gopkg.in/fsnotify.v1/fen.go | 188 ++++ |
196 vendor/src/gopkg.in/fsnotify.v1/fen_cgo.go | 82 ++ |
196 vendor/src/gopkg.in/fsnotify.v1/fen_cgo.go | 82 ++ |
197 vendor/src/gopkg.in/fsnotify.v1/fsnotify.go | 2 +- |
197 vendor/src/gopkg.in/fsnotify.v1/fsnotify.go | 2 +- |
198 volume/local/local_unix.go | 2 +- |
198 volume/local/local_unix.go | 2 +- |
199 volume/store/store_unix.go | 2 +- |
199 volume/store/store_unix.go | 2 +- |
200 193 files changed, 9208 insertions(+), 1241 deletions(-) |
200 193 files changed, 9237 insertions(+), 1241 deletions(-) |
201 create mode 100644 Dockerfile.solaris |
201 create mode 100644 Dockerfile.solaris |
202 create mode 100644 container/container_solaris.go |
202 create mode 100644 container/container_solaris.go |
203 create mode 100644 container/state_solaris.go |
203 create mode 100644 container/state_solaris.go |
204 create mode 100755 contrib/mkimage/solaris |
204 create mode 100755 contrib/mkimage/solaris |
205 create mode 100644 daemon/config_solaris.go |
205 create mode 100644 daemon/config_solaris.go |
9455 +func (c *controller) createGWNetwork() (Network, error) { |
9455 +func (c *controller) createGWNetwork() (Network, error) { |
9456 + return nil, types.NotImplementedErrorf("default gateway functionality is not implemented in solaris") |
9456 + return nil, types.NotImplementedErrorf("default gateway functionality is not implemented in solaris") |
9457 +} |
9457 +} |
9458 diff --git a/vendor/src/github.com/docker/libnetwork/drivers/solaris/bridge/bridge.go b/vendor/src/github.com/docker/libnetwork/drivers/solaris/bridge/bridge.go |
9458 diff --git a/vendor/src/github.com/docker/libnetwork/drivers/solaris/bridge/bridge.go b/vendor/src/github.com/docker/libnetwork/drivers/solaris/bridge/bridge.go |
9459 new file mode 100644 |
9459 new file mode 100644 |
9460 index 0000000..da5e3f6 |
9460 index 0000000..23db1d9 |
9461 --- /dev/null |
9461 --- /dev/null |
9462 +++ b/vendor/src/github.com/docker/libnetwork/drivers/solaris/bridge/bridge.go |
9462 +++ b/vendor/src/github.com/docker/libnetwork/drivers/solaris/bridge/bridge.go |
9463 @@ -0,0 +1,1084 @@ |
9463 @@ -0,0 +1,1084 @@ |
9464 +package bridge |
9464 +package bridge |
9465 + |
9465 + |
10090 + c := n.config |
10090 + c := n.config |
10091 + |
10091 + |
10092 + // Program any required port mapping and store them in the endpoint |
10092 + // Program any required port mapping and store them in the endpoint |
10093 + endpoint.portMapping, err = n.allocatePorts(epConfig, |
10093 + endpoint.portMapping, err = n.allocatePorts(epConfig, |
10094 + endpoint, c.DefaultBindingIntf, c.DefaultBindingIP, |
10094 + endpoint, c.DefaultBindingIntf, c.DefaultBindingIP, |
10095 + c.BridgeName+"_gw0") |
10095 + c.BridgeName+"_gw0", c.AddressIPv4) |
10096 + if err != nil { |
10096 + if err != nil { |
10097 + return err |
10097 + return err |
10098 + } |
10098 + } |
10099 + |
10099 + |
10100 + return nil |
10100 + return nil |
11110 + |
11110 + |
11111 +// BadRequest denotes the type of this error |
11111 +// BadRequest denotes the type of this error |
11112 +func (address InvalidLinkIPAddrError) BadRequest() {} |
11112 +func (address InvalidLinkIPAddrError) BadRequest() {} |
11113 diff --git a/vendor/src/github.com/docker/libnetwork/drivers/solaris/bridge/port_mapping.go b/vendor/src/github.com/docker/libnetwork/drivers/solaris/bridge/port_mapping.go |
11113 diff --git a/vendor/src/github.com/docker/libnetwork/drivers/solaris/bridge/port_mapping.go b/vendor/src/github.com/docker/libnetwork/drivers/solaris/bridge/port_mapping.go |
11114 new file mode 100644 |
11114 new file mode 100644 |
11115 index 0000000..f2b1fd5 |
11115 index 0000000..a2e0599 |
11116 --- /dev/null |
11116 --- /dev/null |
11117 +++ b/vendor/src/github.com/docker/libnetwork/drivers/solaris/bridge/port_mapping.go |
11117 +++ b/vendor/src/github.com/docker/libnetwork/drivers/solaris/bridge/port_mapping.go |
11118 @@ -0,0 +1,218 @@ |
11118 @@ -0,0 +1,247 @@ |
11119 +package bridge |
11119 +package bridge |
11120 + |
11120 + |
11121 +import ( |
11121 +import ( |
11122 + "bytes" |
11122 + "bytes" |
11123 + "errors" |
11123 + "errors" |
11137 +const ( |
11137 +const ( |
11138 + maxAllocatePortAttempts = 10 |
11138 + maxAllocatePortAttempts = 10 |
11139 +) |
11139 +) |
11140 + |
11140 + |
11141 +func addPFRules(epid, bindIntf string, bs []types.PortBinding, |
11141 +func addPFRules(epid, bindIntf string, bs []types.PortBinding, |
11142 + gwIntf string) { |
11142 + gwIntf string, nwAddr *net.IPNet) { |
11143 + id := epid[:12] |
11143 + id := epid[:12] |
11144 + fname := "/var/lib/docker/network/files/pf." + id |
11144 + fname := "/var/lib/docker/network/files/pf." + id |
11145 + |
11145 + |
11146 + f, err := os.OpenFile(fname, |
11146 + f, err := os.OpenFile(fname, |
11147 + os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0600) |
11147 + os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0600) |
11148 + if err != nil { |
11148 + if err != nil { |
11149 + logrus.Warnf("cannot open temp pf file") |
11149 + logrus.Warnf("cannot open temp pf file") |
11150 + return |
11150 + return |
11151 + } |
11151 + } |
|
11152 + gwIPaddr := nwAddr.String() |
|
11153 + _, gwNetwork, err := net.ParseCIDR(gwIPaddr) |
|
11154 + if err != nil { |
|
11155 + logrus.Warnf("ParseCIDR error.") |
|
11156 + return |
|
11157 + } |
|
11158 + |
11152 + for _, b := range bs { |
11159 + for _, b := range bs { |
|
11160 + // tag created for every container port must be unique. Hence a |
|
11161 + // combination of epid + port number of the container is used |
|
11162 + // to create the tag. |
|
11163 + tag := fmt.Sprintf("%s%d", id, b.Port) |
11153 + r := fmt.Sprintf( |
11164 + r := fmt.Sprintf( |
11154 + "pass in on %s proto %s from any to (%s) " + |
11165 + "pass in on %s proto %s from any to (%s) " + |
11155 + "port %d rdr-to %s port %d\n", bindIntf, |
11166 + "port %d rdr-to %s port %d\n", bindIntf, |
11156 + b.Proto.String(), bindIntf, b.HostPort, |
11167 + b.Proto.String(), bindIntf, b.HostPort, |
11157 + b.IP.String(), b.Port) |
11168 + b.IP.String(), b.Port) |
11175 + bindIntf) |
11186 + bindIntf) |
11176 + _, err = f.WriteString(r) |
11187 + _, err = f.WriteString(r) |
11177 + if err != nil { |
11188 + if err != nil { |
11178 + logrus.Warnf("cannot write to %s: %v", fname, err) |
11189 + logrus.Warnf("cannot write to %s: %v", fname, err) |
11179 + } |
11190 + } |
|
11191 + r = fmt.Sprintf( |
|
11192 + "pass in on %s inet proto %s from %s to (%s) " + |
|
11193 + "port %d tag %s nat-to (%s) static-port route-to %s\n", gwIntf, |
|
11194 + b.Proto.String(), gwNetwork, bindIntf, b.HostPort, tag, bindIntf, |
|
11195 + gwIntf) |
|
11196 + _, err = f.WriteString(r) |
|
11197 + if err != nil { |
|
11198 + logrus.Warnf("cannot write to %s: %v", fname, err) |
|
11199 + } |
|
11200 + r = fmt.Sprintf( |
|
11201 + "pass out on %s inet proto %s from any to (%s) " + |
|
11202 + "tagged %s rdr-to %s port %d reply-to %s\n", gwIntf, |
|
11203 + b.Proto.String(), bindIntf, tag, b.IP.String(), b.Port, |
|
11204 + gwIntf) |
|
11205 + _, err = f.WriteString(r) |
|
11206 + if err != nil { |
|
11207 + logrus.Warnf("cannot write to %s: %v", fname, err) |
|
11208 + } |
11180 + } |
11209 + } |
11181 + f.Close() |
11210 + f.Close() |
11182 + |
11211 + |
11183 + anchor := fmt.Sprintf("_auto/docker/ep%s", id) |
11212 + anchor := fmt.Sprintf("_auto/docker/ep%s", id) |
11184 + err = exec.Command("/usr/sbin/pfctl", "-a", anchor, "-f", fname).Run() |
11213 + err = exec.Command("/usr/sbin/pfctl", "-a", anchor, "-f", fname).Run() |
11194 + if err != nil { |
11223 + if err != nil { |
11195 + logrus.Warnf("pfctl -F failed: %v", err) |
11224 + logrus.Warnf("pfctl -F failed: %v", err) |
11196 + } |
11225 + } |
11197 +} |
11226 +} |
11198 + |
11227 + |
11199 +func (n *bridgeNetwork) allocatePorts(epc *endpointConfiguration, ep *bridgeEndpoint, bindIntf string, reqDefBindIP net.IP, gwIntf string) ([]types.PortBinding, error) { |
11228 +func (n *bridgeNetwork) allocatePorts(epc *endpointConfiguration, ep *bridgeEndpoint, bindIntf string, reqDefBindIP net.IP, gwIntf string, nwAddr *net.IPNet) ([]types.PortBinding, error) { |
11200 + if epc == nil || epc.PortBindings == nil || len(epc.PortBindings) == 0 { |
11229 + if epc == nil || epc.PortBindings == nil || len(epc.PortBindings) == 0 { |
11201 + return nil, nil |
11230 + return nil, nil |
11202 + } |
11231 + } |
11203 + |
11232 + |
11204 + defHostIP := defaultBindingIP |
11233 + defHostIP := defaultBindingIP |
11209 + bs, err := n.allocatePortsInternal(epc.PortBindings, |
11238 + bs, err := n.allocatePortsInternal(epc.PortBindings, |
11210 + bindIntf, ep.addr.IP, defHostIP) |
11239 + bindIntf, ep.addr.IP, defHostIP) |
11211 + if err != nil { |
11240 + if err != nil { |
11212 + return nil, err |
11241 + return nil, err |
11213 + } |
11242 + } |
11214 + addPFRules(ep.id, bindIntf, bs, gwIntf) |
11243 + addPFRules(ep.id, bindIntf, bs, gwIntf, nwAddr) |
11215 + return bs, err |
11244 + return bs, err |
11216 +} |
11245 +} |
11217 + |
11246 + |
11218 +func (n *bridgeNetwork) allocatePortsInternal(bindings []types.PortBinding, bindIntf string, containerIP, defHostIP net.IP) ([]types.PortBinding, error) { |
11247 +func (n *bridgeNetwork) allocatePortsInternal(bindings []types.PortBinding, bindIntf string, containerIP, defHostIP net.IP) ([]types.PortBinding, error) { |
11219 + bs := make([]types.PortBinding, 0, len(bindings)) |
11248 + bs := make([]types.PortBinding, 0, len(bindings)) |