diff --git a/bin/bitbake-worker b/bin/bitbake-worker
index 50380201c..9a744ce56 100755
--- a/bin/bitbake-worker
+++ b/bin/bitbake-worker
@@ -293,7 +293,8 @@ def fork_off_task(cfg, data, databuilder, workerdata, extraconfigdata, runtask):
                         bb.utils.disable_network(uid, gid)
                     else:
                         logger.debug("Skipping disable network for %s since %s is not a local uid." % (taskname, uid))
-                    bb.utils.landlock_restrict_network()
+                    if not bb.utils.to_boolean(the_data.getVarFlag(taskname, 'landlock-disable')):
+                        bb.utils.landlock_restrict_network()
 
                 # exported_vars() expands each value, so it must be called before
                 # empty_environment() below: an expansion that shells out needs the
