Browse code

libnet/d/bridge: CreateEndpoint: use d.config directly

newDriver, which creates a new instance of the bridge driver, is the
only place where the driver config field is set. So there's no need to
gate access to it with a mutex.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>

Albin Kerouanton authored on 2025/08/31 22:02:31
Showing 1 changed files
... ...
@@ -1036,7 +1036,6 @@ func (d *driver) CreateEndpoint(ctx context.Context, nid, eid string, ifInfo dri
1036 1036
 	// Get the network handler and make sure it exists
1037 1037
 	d.mu.Lock()
1038 1038
 	n, ok := d.networks[nid]
1039
-	dconfig := d.config
1040 1039
 	d.mu.Unlock()
1041 1040
 
1042 1041
 	if !ok {
... ...
@@ -1148,7 +1147,7 @@ func (d *driver) CreateEndpoint(ctx context.Context, nid, eid string, ifInfo dri
1148 1148
 		return fmt.Errorf("adding interface %s to bridge %s failed: %v", hostIfName, config.BridgeName, err)
1149 1149
 	}
1150 1150
 
1151
-	if !dconfig.EnableProxy {
1151
+	if !d.config.EnableProxy {
1152 1152
 		err = setHairpinMode(d.nlh, host, true)
1153 1153
 		if err != nil {
1154 1154
 			return err