Skip to content

Commit eacbbde

Browse files
committed
Revert "API: /info: remove BridgeNfIptables, BridgeNfIp6tables fields"
This reverts commit 5d20062, which caused some issues in the docker/cli formatting code that needs some investigating. Let's (temporarily) revert this while we look what's wrong. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 73520a5 commit eacbbde

5 files changed

Lines changed: 12 additions & 92 deletions

File tree

api/server/router/system/system_routes.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,6 @@ func (s *systemRouter) getInfo(ctx context.Context, w http.ResponseWriter, r *ht
122122
info.ContainerdCommit.Expected = info.ContainerdCommit.ID //nolint:staticcheck // ignore SA1019: field is deprecated, but still used on API < v1.49.
123123
info.RuncCommit.Expected = info.RuncCommit.ID //nolint:staticcheck // ignore SA1019: field is deprecated, but still used on API < v1.49.
124124
info.InitCommit.Expected = info.InitCommit.ID //nolint:staticcheck // ignore SA1019: field is deprecated, but still used on API < v1.49.
125-
126-
// These fields are omitted in > API 1.49, and always false
127-
// older API versions.
128-
info.ExtraFields = map[string]any{
129-
"BridgeNfIptables": json.RawMessage("false"),
130-
"BridgeNfIp6tables": json.RawMessage("false"),
131-
}
132125
}
133126
if versions.GreaterThanOrEqualTo(version, "1.42") {
134127
info.KernelMemory = false

api/types/system/info.go

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
// FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16:
2-
//go:build go1.22
3-
41
package system
52

63
import (
7-
"encoding/json"
8-
94
"github.com/docker/docker/api/types/container"
105
"github.com/docker/docker/api/types/registry"
116
"github.com/docker/docker/api/types/swarm"
@@ -34,6 +29,8 @@ type Info struct {
3429
CPUSet bool
3530
PidsLimit bool
3631
IPv4Forwarding bool
32+
BridgeNfIptables bool `json:"BridgeNfIptables"` // Deprecated: netfilter module is now loaded on-demand and no longer during daemon startup, making this field obsolete. This field is always false and will be removed in the next release.
33+
BridgeNfIP6tables bool `json:"BridgeNfIp6tables"` // Deprecated: netfilter module is now loaded on-demand and no longer during daemon startup, making this field obsolete. This field is always false and will be removed in the next release.
3734
Debug bool
3835
NFd int
3936
OomKillDisable bool
@@ -86,26 +83,6 @@ type Info struct {
8683
// messages for the user, and are not intended to be parsed / used for
8784
// other purposes, as they do not have a fixed format.
8885
Warnings []string
89-
90-
// ExtraFields is for internal use to include deprecated fields on older API versions.
91-
ExtraFields map[string]any `json:"-"`
92-
}
93-
94-
// MarshalJSON implements a custom marshaler to include legacy fields
95-
// in API responses.
96-
func (sc *Info) MarshalJSON() ([]byte, error) {
97-
type tmp Info
98-
base, err := json.Marshal((*tmp)(sc))
99-
if err != nil {
100-
return nil, err
101-
}
102-
var merged map[string]any
103-
_ = json.Unmarshal(base, &merged)
104-
105-
for k, v := range sc.ExtraFields {
106-
merged[k] = v
107-
}
108-
return json.Marshal(merged)
10986
}
11087

11188
// ContainerdInfo holds information about the containerd instance used by the daemon.

docs/api/version-history.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ keywords: "API, Docker, rcli, REST, documentation"
2929
* Deprecated: The `ContainerdCommit.Expected`, `RuncCommit.Expected`, and
3030
`InitCommit.Expected` fields in the `GET /info` endpoint were deprecated
3131
in API v1.48, and are now omitted in API v1.49.
32-
* Deprecated: The `BridgeNfIptables` and `BridgeNfIp6tables` fields in the
33-
`GET /info` response were deprecated in API v1.48, and are now omitted
34-
in API v1.49.
3532

3633
## v1.48 API changes
3734

integration/system/info_linux_test.go

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@
33
package system // import "github.com/docker/docker/integration/system"
44

55
import (
6-
"encoding/json"
7-
"io"
8-
"net/http"
96
"testing"
107

118
"github.com/docker/docker/client"
12-
"github.com/docker/docker/testutil/request"
139
"gotest.tools/v3/assert"
1410
is "gotest.tools/v3/assert/cmp"
1511
)
@@ -51,56 +47,3 @@ func TestInfoBinaryCommits(t *testing.T) {
5147
assert.Check(t, is.Equal(info.RuncCommit.Expected, info.RuncCommit.ID)) //nolint:staticcheck // ignore SA1019: field is deprecated, but still used on API < v1.49.
5248
})
5349
}
54-
55-
func TestInfoLegacyFields(t *testing.T) {
56-
ctx := setupTest(t)
57-
58-
const notPresent = "expected field to not be present"
59-
60-
tests := []struct {
61-
name string
62-
url string
63-
expectedFields map[string]any
64-
}{
65-
{
66-
name: "api v1.48 legacy bridge-nftables",
67-
url: "/v1.48/info",
68-
expectedFields: map[string]any{
69-
"BridgeNfIp6tables": false,
70-
"BridgeNfIptables": false,
71-
},
72-
},
73-
{
74-
name: "api v1.49 legacy bridge-nftables",
75-
url: "/v1.49/info",
76-
expectedFields: map[string]any{
77-
"BridgeNfIp6tables": notPresent,
78-
"BridgeNfIptables": notPresent,
79-
},
80-
},
81-
}
82-
for _, tc := range tests {
83-
t.Run(tc.name, func(t *testing.T) {
84-
res, _, err := request.Get(ctx, tc.url)
85-
assert.NilError(t, err)
86-
assert.Equal(t, res.StatusCode, http.StatusOK)
87-
body, err := io.ReadAll(res.Body)
88-
assert.NilError(t, err)
89-
90-
actual := map[string]any{}
91-
err = json.Unmarshal(body, &actual)
92-
assert.NilError(t, err, string(body))
93-
94-
for field, expectedValue := range tc.expectedFields {
95-
if expectedValue == notPresent {
96-
_, found := actual[field]
97-
assert.Assert(t, !found, "field %s should not be present", field)
98-
} else {
99-
_, found := actual[field]
100-
assert.Assert(t, found, "field %s should be present", field)
101-
assert.Check(t, is.DeepEqual(actual[field], expectedValue))
102-
}
103-
}
104-
})
105-
}
106-
}

pkg/sysinfo/sysinfo.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ type SysInfo struct {
2424
// Whether IPv4 forwarding is supported or not, if this was disabled, networking will not work
2525
IPv4ForwardingDisabled bool
2626

27+
// Whether bridge-nf-call-iptables is supported or not
28+
//
29+
// Deprecated: netfilter module is now loaded on-demand and no longer during daemon startup, making this field obsolete. This field is always false and will be removed in the next release.
30+
BridgeNFCallIPTablesDisabled bool
31+
32+
// Whether bridge-nf-call-ip6tables is supported or not
33+
//
34+
// Deprecated: netfilter module is now loaded on-demand and no longer during daemon startup, making this field obsolete. This field is always false and will be removed in the next release.
35+
BridgeNFCallIP6TablesDisabled bool
36+
2737
// Whether the cgroup has the mountpoint of "devices" or not
2838
CgroupDevicesEnabled bool
2939

0 commit comments

Comments
 (0)