All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
To: Richard Purdie <richard.purdie@linuxfoundation.org>,
	"bitbake-devel@lists.openembedded.org"
	<bitbake-devel@lists.openembedded.org>
Subject: RE: [bitbake-devel] [PATCH] utils: Enable the loopback interface in disable_network()
Date: Fri, 23 Sep 2022 15:52:17 +0000	[thread overview]
Message-ID: <8f7c969baf4e4112ae9e7a2b21ee12a3@axis.com> (raw)
In-Reply-To: <c88684a7e0becc8137066edfce1c13f493fcdd33.camel@linuxfoundation.org>

> -----Original Message-----
> From: Richard Purdie <richard.purdie@linuxfoundation.org>
> Sent: den 23 september 2022 16:54
> To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>; bitbake-
> devel@lists.openembedded.org
> Subject: Re: [bitbake-devel] [PATCH] utils: Enable the loopback interface
> in disable_network()
> 
> On Fri, 2022-09-23 at 14:42 +0000, Peter Kjellerstedt wrote:
> > Ok. I hope it is then ok that I add a new task varflag "network-loopback"
> > (or maybe even just "loopback"?) E.g.:
> >
> > diff --git a/bitbake/bin/bitbake-worker b/bitbake/bin/bitbake-worker
> > index 7be39370b3..4115604d99 100755
> > --- a/bitbake/bin/bitbake-worker
> > +++ b/bitbake/bin/bitbake-worker
> > @@ -267,6 +267,8 @@ def fork_off_task(cfg, data, databuilder,
> > workerdata, fn, task, taskname, taskha
> >                      if bb.utils.is_local_uid(uid):
> >                          logger.debug("Attempting to disable network for %s" % taskname)
> >                          bb.utils.disable_network(uid, gid)
> > +                        if the_data.getVarFlag(taskname, 'network-loopback', False):
> > +                            bb.utils.loopback_up()
> >                      else:
> >                          logger.debug("Skipping disable network for %s since %s is not a local uid." % (taskname, uid))
> >
> > With that in place, I see no drawbacks compared to always
> > enabling the loopback interface in disable_network() since
> > setting, e.g., do_compile[network-loopback] = "1" will make
> > sure it is only enabled when actually needed, compared to,
> > e.g., doing it in an anonymous Python function.
> 
> Setting it in a prefunc doesn't look that bad once you have a function
> for it?
> 
> python enable_loopback () {
>     bb.utils.loopback_up()
> }
> 
> do_compile[prefuncs] += "enable_loopback"

Hmm. What worries me here is what happens when enable_loopback is 
called for a task that has network=1? Hopefully it only does some 
unnecessary work, but I do not know... That's why I find the 
varflag solution more appealing as I know it will only enable the 
loopback interface when networking has actually been disabled.

> On the subject of naming, it may be clearer as something like:
> 
> bb.utils.enable_loopback_networking()
> 
> as we need to think about how this looks without context we have in
> these patches.

Agreed.

> Cheers,
> 
> Richard

//Peter


      reply	other threads:[~2022-09-23 15:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-23 10:16 [PATCH] utils: Enable the loopback interface in disable_network() Peter Kjellerstedt
2022-09-23 13:16 ` [bitbake-devel] " Richard Purdie
2022-09-23 14:42   ` Peter Kjellerstedt
2022-09-23 14:54     ` Richard Purdie
2022-09-23 15:52       ` Peter Kjellerstedt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8f7c969baf4e4112ae9e7a2b21ee12a3@axis.com \
    --to=peter.kjellerstedt@axis.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.