@@ -118,10 +118,15 @@ func (route *NetfilterRoute) Create() error {
118
118
119
119
// Allow docker's virtual bridge interface to access the introspection server. Inserting it after applying
120
120
// the rule to drop all connections other than loopback interface will push it on top of priority.
121
- err = route .modifyNetfilterEntry (iptablesTableFilter , iptablesInsert , allowIntrospectionForDockerIptablesInputChainArgs , true )
122
- if err != nil {
123
- log .Errorf ("Error adding input chain entry to allow %s access to introspection server: %w" , err )
124
- return err
121
+ if defaultDockerBridgeNetworkName != "" {
122
+ err = route .modifyNetfilterEntry (iptablesTableFilter , iptablesInsert ,
123
+ allowIntrospectionForDockerIptablesInputChainArgs , true )
124
+ if err != nil {
125
+ log .Errorf (
126
+ "Error adding input chain entry to allow %s access to introspection server: %w" ,
127
+ err )
128
+ return err
129
+ }
125
130
}
126
131
}
127
132
@@ -150,9 +155,13 @@ func (route *NetfilterRoute) Remove() error {
150
155
introspectionInputError = fmt .Errorf ("error removing input chain entry: %v" , introspectionInputError )
151
156
}
152
157
153
- dockerIntrospectionInputError = route .modifyNetfilterEntry (iptablesTableFilter , iptablesDelete , allowIntrospectionForDockerIptablesInputChainArgs , true )
154
- if dockerIntrospectionInputError != nil {
155
- dockerIntrospectionInputError = fmt .Errorf ("error removing input chain entry: %v" , dockerIntrospectionInputError )
158
+ if defaultDockerBridgeNetworkName != "" {
159
+ dockerIntrospectionInputError = route .modifyNetfilterEntry (iptablesTableFilter ,
160
+ iptablesDelete , allowIntrospectionForDockerIptablesInputChainArgs , true )
161
+ if dockerIntrospectionInputError != nil {
162
+ dockerIntrospectionInputError = fmt .Errorf (
163
+ "error removing input chain entry: %v" , dockerIntrospectionInputError )
164
+ }
156
165
}
157
166
158
167
outputErr := route .modifyNetfilterEntry (iptablesTableNat , iptablesDelete , getOutputChainArgs , false )
0 commit comments