Ubuntu

NetworkManager does not call /etc/network/if-pre-up.d scripts

Reported by JoeDuncan on 2009-03-02
98
This bug affects 15 people
Affects Status Importance Assigned to Milestone
network-manager (Ubuntu)
Medium
Alexander Sack
Nominated for Intrepid by Robert Maz

Bug Description

Binary package hint: network-manager

Ubuntu 8.10, Linux 2.6.27-12-generic #1 SMP Thu Feb 5 09:26:35 UTC 2009 i686 GNU/Linux
NetworkManager 0.7~~svn20081018t105859-0ubuntu1.8.10.1

I've been trying to get a script to trigger on the "pre-up" phase of network configuration, however, NetworkManager doesn't seem to call it's dispatcher for "pre-up" or "post-down" events.

None of the scripts I put in /etc/network/if-pre-up.d ever got called, so I added the following line to the top of the dispatcher script "/etc/NetworkManager/dispatcher.d/01ifupdown":

logger -t $0 "called with $1 $2"

Where $0 is the name of the script, $1 is the network interface and $2 is the network event.

After bringing some network connections up and down, I checked the logs, and NetworkManager doesn't seem to be calling "/etc/NetworkManager/dispatch.d/01ifupdown" for either "pre-up" or "post-down" events. The only entries that show up are for "up" and "down" events.

According to the changelog both "pre-up" and "post-down" events are supposed to be supported as of version 0.5.1-0ubuntu12:

https://launchpad.net/ubuntu/+source/network-manager

description: updated
Alexander Sack (asac) wrote :

indeed. seems we dropped that state during 0.6 to 0.7 transition. I will try to get this for beta.

Changed in network-manager:
assignee: nobody → asac
importance: Undecided → Medium
milestone: none → ubuntu-9.04-beta
status: New → In Progress
JoeDuncan (joe-rl-duncan) wrote :

Thanks for the quick response.

Would downgrading network-manager to 0.6 be a viable workaround until an update becomes available in the repositories then?

On Mon, Mar 02, 2009 at 06:17:19PM -0000, JoeDuncan wrote:
> Thanks for the quick response.
>
> Would downgrading network-manager to 0.6 be a viable workaround until an
> update becomes available in the repositories then?
>

After discussing with a few folks we found that pre-up will not come
back ... please provide detailed infos for your use-case as we have to
find other means to achieve this.

 - Alexander

ChrisPenwell (romanmir) wrote :

I am seeing a slightly different problem. I have a script that goes out and gets the external IP address of wherever I am.

It would be closer to ideal if this script would run when the network comes up, rather than having it run this script as a cron job, however, when I put a link to the script, or the script itself in the /etc/network/up.d/ folder nothing happens.

I'd like to think that I'm missing something, but I don't think I am.

I have tested it and it seems that the if-up.d scripts are not being triggered when the network comes back up.

I'm running a fresh install of Ubuntu Jaunty.

urusha (urusha) wrote :

I have kubuntu 9.04 with all last updates on amd64 and 've got the same bug as Rober Maz has. All scripts from dispatcher.d only works with up or down arguments but not with pre-up/post-down. The same scripts as I try to run now worked with kubuntu 8.10 and (not sure) an early beta of 9.04.

urusha (urusha) wrote :

Information about kubuntu 8.10 and beta could be wrong. Old scripts were also with up and down arguments. Well i don't know if it worked with pre-up/post-down or not.

Bertrand Marc (beberking) wrote :

I have the same issue. I'd like to run macchanger to change my MAC address before the interface is brought up. I used to do this with Network-Manager 0.6 in if-pre-up.d/, but since Network-Manager 0.7, my script to change my MAC address isn't called anymore...

Is there a workaround to change the MAC address and use Network-Manager ?

Marlon (rac-sword2) wrote :

I use pre-up to run a script to reload my iptables configuration. I didnt want to put it anywhere else as it makes sense to me to load them right before networking is up. I dont understand how you can drop it and not show it in the release notes, as already noted above support for pre-up post-down events is available since 0.5.1-0ubuntu12 so a sunset note on the release notes would be helpful if it's not coming back.

Using Ubuntu 9.04 final with all updates up to now.

sockmonkey (sockmonkey) wrote :

I haven't been able to find a workaround to get macchanger and iptables to load before the interface has gone up. Its no use running macchanger after the interface has gone up because your mac has already been logged by then, and the delay might allow an automated attack to establish a session before iptables can filter, not good security practice :/
Why was this feature dropped? I can't think of one good reason... Guess i'll have to go look for some alternative.

Alexander Sack (asac) wrote :

upstream believes pre-up is a bad idea ... I won't add a patch for that as it will be major maintenance burden in long run.

Changed in network-manager (Ubuntu):
status: In Progress → Won't Fix
Marlon (rac-sword2) wrote :

Since you are the maintainers of the distro is definitively your call on doing so but it would have been nice as I said in my previous post to have it documented on the release notes instead of just taking it out without warning. That said since you might be the authority of sorts on this issue where should a script be run if we want it to run before the network is up? i.e. iptables reload, mac address changing as someone else mentioned above, etc.

Thank you,

Marlon

Marlon (rac-sword2) wrote :

As a workaround I added the reload iptables lines to the "lo" network adapter setup thinking that since the loop back is the first thing set up it should work, but I think that is a very ugly way since I'm modifying a config file created automatically instead of simply adding a script to a folder.

If anyone has a better idea please, let me know.

On Tue, Sep 22, 2009 at 02:16:41PM -0000, Marlon wrote:
> Since you are the maintainers of the distro is definitively your call on
> doing so but it would have been nice as I said in my previous post to
> have it documented on the release notes instead of just taking it out
> without warning. That said since you might be the authority of sorts on
> this issue where should a script be run if we want it to run before the
> network is up? i.e. iptables reload, mac address changing as someone
> else mentioned above, etc.
>

If we can come up with a list of issues that are most pressing we
might check if there is a feasible way for special case solutions
rather than allowing all kind of up.d scripts.

 - Alexander

Marlon, you can manually edit the /etc/init.d/networking script to call
whatever commands you like before bringing up the network interfaces.

Ugly and inelegant I know, but if the powers that be have decided for
whatever reason to nuke the nice way of doing it, it's all we're left with.

On Thu, Sep 24, 2009 at 9:39 AM, Alexander Sack <email address hidden> wrote:

> On Tue, Sep 22, 2009 at 02:16:41PM -0000, Marlon wrote:
> > Since you are the maintainers of the distro is definitively your call on
> > doing so but it would have been nice as I said in my previous post to
> > have it documented on the release notes instead of just taking it out
> > without warning. That said since you might be the authority of sorts on
> > this issue where should a script be run if we want it to run before the
> > network is up? i.e. iptables reload, mac address changing as someone
> > else mentioned above, etc.
> >
>
> If we can come up with a list of issues that are most pressing we
> might check if there is a feasible way for special case solutions
> rather than allowing all kind of up.d scripts.
>
>
> - Alexander
>
> --
> NetworkManager does not call /etc/network/if-pre-up.d scripts
> https://bugs.launchpad.net/bugs/336736
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in “network-manager” package in Ubuntu: Won't Fix
>
> Bug description:
> Binary package hint: network-manager
>
> Ubuntu 8.10, Linux 2.6.27-12-generic #1 SMP Thu Feb 5 09:26:35 UTC 2009
> i686 GNU/Linux
> NetworkManager 0.7~~svn20081018t105859-0ubuntu1.8.10.1
>
> I've been trying to get a script to trigger on the "pre-up" phase of
> network configuration, however, NetworkManager doesn't seem to call it's
> dispatcher for "pre-up" or "post-down" events.
>
> None of the scripts I put in /etc/network/if-pre-up.d ever got called, so I
> added the following line to the top of the dispatcher script
> "/etc/NetworkManager/dispatcher.d/01ifupdown":
>
> logger -t $0 "called with $1 $2"
>
> Where $0 is the name of the script, $1 is the network interface and $2 is
> the network event.
>
> After bringing some network connections up and down, I checked the logs,
> and NetworkManager doesn't seem to be calling
> "/etc/NetworkManager/dispatch.d/01ifupdown" for either "pre-up" or
> "post-down" events. The only entries that show up are for "up" and "down"
> events.
>
> According to the changelog both "pre-up" and "post-down" events are
> supposed to be supported as of version 0.5.1-0ubuntu12:
>
> https://launchpad.net/ubuntu/+source/network-manager
>

--
Joe Duncan
PhD Program, Psychology
Queen's University
<email address hidden>
(647)216-9135

On Thu, Sep 24, 2009 at 02:25:27PM -0000, JoeDuncan wrote:
> Marlon, you can manually edit the /etc/init.d/networking script to call
> whatever commands you like before bringing up the network interfaces.
>
> Ugly and inelegant I know, but if the powers that be have decided for
> whatever reason to nuke the nice way of doing it, it's all we're left with.

I offered to look into special case solutions for most important use
cases. Thats not enough? Or just too much thought?

 - Alexander

Marlon (rac-sword2) wrote :

Alexander,

I cant speak for everyone but I do appreciate your offer. Is there a way for a list to be made? My biggest thing is the use of iptables and to be able to reload them before the network is up. Like I said in a previous post my way of doing this right now is to edit the /etc/network/interfaces config file by adding the iptables reload comand right under "auto lo".

Marlon (rac-sword2) wrote :

Actually I take that back it's as follows:
auto lo
iface lo inet loopback
pre-up iptables-restore < /etc/iptables.conf

Is this the right way or am I leaving it unprotected for a couple of secs?

Bertrand Marc (beberking) wrote :

Alexander Sack a écrit :
> On Thu, Sep 24, 2009 at 02:25:27PM -0000, JoeDuncan wrote:
>
>> Marlon, you can manually edit the /etc/init.d/networking script to call
>> whatever commands you like before bringing up the network interfaces.
>>
>> Ugly and inelegant I know, but if the powers that be have decided for
>> whatever reason to nuke the nice way of doing it, it's all we're left with.
>>
>
> I offered to look into special case solutions for most important use
> cases. Thats not enough? Or just too much thought?
>
> - Alexander
>
>
Thanks a lot for your offer ! As I said a few months ago, I'd really
like to change my mac address and use Network-manager at the same time.
And the only way I know to do that is to use macchanger during pre-up...
Do you know a workaround ?

Bertrand

Download full text (3.8 KiB)

Alexander,

I appreciate your trying to help, but I am just not that interested in
pursuing this. I had a need to make some changes for a VPN at school
(routing etc...) prior to the network coming up; pre-up has been disabled
for whatever reason, so I found a one-off workaround to use.

It's a hassle to maintain however, so I have simply abandoned using the VPN
- it's simply not worth it for the single service I needed it for, I can do
without.

I had thought the lack of "pre-up" was a simple oversight that would be
quickly fixed once noticed (which is why I opened the bug). I am frankly
astonished, however, that it was simply dropped with no good reason and no
mention in the docs/change files.

I don't know who "upstream" is (I know what the word means - but I
personally do not know who it refers to in this context) so I cannot fathom
their reasoning for abandoning it. It seems like an arbitrary, or at worst,
biased decision to get rid of a perfectly good, working and elegant system
that many people were using.

I'd be interested in hearing what reasons "upstream" has for getting rid of
pre-up, but I am frankly not hopeful that said reasons will be forthcoming.
I am not interested in helping to create a bunch of one-off, special case
hacks to replace a perfectly good system that was axed due to a dumb
decision.

It's sad to see such lock-down approaches being taken in a Linux distro. I
had always believed that Linux was a free and open system, in the truest
senses of the words, where users were allowed to do whatever they choose
with the system. It seems to me a restrictive step back to take something
that was once easy to do and deliberately make it harder.

You can count me out of this process.

Thanks for the attempt.

On Thu, Sep 24, 2009 at 12:00 PM, Alexander Sack <email address hidden> wrote:

> On Thu, Sep 24, 2009 at 02:25:27PM -0000, JoeDuncan wrote:
> > Marlon, you can manually edit the /etc/init.d/networking script to call
> > whatever commands you like before bringing up the network interfaces.
> >
> > Ugly and inelegant I know, but if the powers that be have decided for
> > whatever reason to nuke the nice way of doing it, it's all we're left
> with.
>
> I offered to look into special case solutions for most important use
> cases. Thats not enough? Or just too much thought?
>
> - Alexander
>
> --
> NetworkManager does not call /etc/network/if-pre-up.d scripts
> https://bugs.launchpad.net/bugs/336736
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in “network-manager” package in Ubuntu: Won't Fix
>
> Bug description:
> Binary package hint: network-manager
>
> Ubuntu 8.10, Linux 2.6.27-12-generic #1 SMP Thu Feb 5 09:26:35 UTC 2009
> i686 GNU/Linux
> NetworkManager 0.7~~svn20081018t105859-0ubuntu1.8.10.1
>
> I've been trying to get a script to trigger on the "pre-up" phase of
> network configuration, however, NetworkManager doesn't seem to call it's
> dispatcher for "pre-up" or "post-down" events.
>
> None of the scripts I put in /etc/network/if-pre-up.d ever got called, so I
> added the following line to the top of the dispatcher script
> "/etc/NetworkManager/dispatcher.d/01ifupdown":...

Read more...

sockmonkey (sockmonkey) wrote :
Download full text (4.4 KiB)

Seconded, I'd also appreciate a bit of transparency regarding the reason for
this decision, and who made it.

On Thu, Sep 24, 2009 at 7:52 PM, JoeDuncan <email address hidden> wrote:

> Alexander,
>
> I appreciate your trying to help, but I am just not that interested in
> pursuing this. I had a need to make some changes for a VPN at school
> (routing etc...) prior to the network coming up; pre-up has been disabled
> for whatever reason, so I found a one-off workaround to use.
>
> It's a hassle to maintain however, so I have simply abandoned using the VPN
> - it's simply not worth it for the single service I needed it for, I can do
> without.
>
> I had thought the lack of "pre-up" was a simple oversight that would be
> quickly fixed once noticed (which is why I opened the bug). I am frankly
> astonished, however, that it was simply dropped with no good reason and no
> mention in the docs/change files.
>
> I don't know who "upstream" is (I know what the word means - but I
> personally do not know who it refers to in this context) so I cannot fathom
> their reasoning for abandoning it. It seems like an arbitrary, or at worst,
> biased decision to get rid of a perfectly good, working and elegant system
> that many people were using.
>
> I'd be interested in hearing what reasons "upstream" has for getting rid of
> pre-up, but I am frankly not hopeful that said reasons will be forthcoming.
> I am not interested in helping to create a bunch of one-off, special case
> hacks to replace a perfectly good system that was axed due to a dumb
> decision.
>
> It's sad to see such lock-down approaches being taken in a Linux distro. I
> had always believed that Linux was a free and open system, in the truest
> senses of the words, where users were allowed to do whatever they choose
> with the system. It seems to me a restrictive step back to take something
> that was once easy to do and deliberately make it harder.
>
> You can count me out of this process.
>
> Thanks for the attempt.
>
> On Thu, Sep 24, 2009 at 12:00 PM, Alexander Sack <email address hidden>
> wrote:
>
> > On Thu, Sep 24, 2009 at 02:25:27PM -0000, JoeDuncan wrote:
> > > Marlon, you can manually edit the /etc/init.d/networking script to call
> > > whatever commands you like before bringing up the network interfaces.
> > >
> > > Ugly and inelegant I know, but if the powers that be have decided for
> > > whatever reason to nuke the nice way of doing it, it's all we're left
> > with.
> >
> > I offered to look into special case solutions for most important use
> > cases. Thats not enough? Or just too much thought?
> >
> > - Alexander
> >
> > --
> > NetworkManager does not call /etc/network/if-pre-up.d scripts
> > https://bugs.launchpad.net/bugs/336736
> > You received this bug notification because you are a direct subscriber
> > of the bug.
> >
> > Status in “network-manager” package in Ubuntu: Won't Fix
> >
> > Bug description:
> > Binary package hint: network-manager
> >
> > Ubuntu 8.10, Linux 2.6.27-12-generic #1 SMP Thu Feb 5 09:26:35 UTC 2009
> > i686 GNU/Linux
> > NetworkManager 0.7~~svn20081018t105859-0ubuntu1.8.10.1
> >
> > I've been trying to get a script to trigger on the "pre-up" phase o...

Read more...

On Thu, Sep 24, 2009 at 06:34:17PM -0000, sockmonkey wrote:
> Seconded, I'd also appreciate a bit of transparency regarding the reason for
> this decision, and who made it.

Upstream is: http://projects.gnome.org/NetworkManager/

 - Alexander

Petr Sodomka (pesmail2003) wrote :

So is there a way how to start firewall before interface is up?

Why we have many packages which depend on this functionality?

See apt-file search etc/network/if-pre-up.d

bridge-utils: /etc/network/if-pre-up.d/bridge
ethtool: /etc/network/if-pre-up.d/ethtool
hostap-utils: /etc/network/if-pre-up.d/hostap-utils
hostapd: /etc/network/if-pre-up.d/hostapd
ifenslave-2.6: /etc/network/if-pre-up.d/ifenslave
ifupdown-extra: /etc/network/if-pre-up.d/00check-network-cable
ifupdown-scripts-zg2: /etc/network/if-pre-up.d/00README.linkdir
linux-wlan-ng: /etc/network/if-pre-up.d/linux-wlan-ng-pre-up
uml-utilities: /etc/network/if-pre-up.d/uml-utilities
vde2: /etc/network/if-pre-up.d/vde2
vlan: /etc/network/if-pre-up.d/vlan
whereami: /etc/network/if-pre-up.d/whereami
wireless-tools: /etc/network/if-pre-up.d/wireless-tools
wpasupplicant: /etc/network/if-pre-up.d/wpasupplicant

Alexander Sack (asac) wrote :

On Sun, Nov 01, 2009 at 08:10:41PM -0000, Petr Sodomka wrote:
> So is there a way how to start firewall before interface is up?
>
> Why we have many packages which depend on this functionality?
>
> See apt-file search etc/network/if-pre-up.d
>
> bridge-utils: /etc/network/if-pre-up.d/bridge
> ethtool: /etc/network/if-pre-up.d/ethtool
> hostap-utils: /etc/network/if-pre-up.d/hostap-utils
> hostapd: /etc/network/if-pre-up.d/hostapd
> ifenslave-2.6: /etc/network/if-pre-up.d/ifenslave
> ifupdown-extra: /etc/network/if-pre-up.d/00check-network-cable
> ifupdown-scripts-zg2: /etc/network/if-pre-up.d/00README.linkdir
> linux-wlan-ng: /etc/network/if-pre-up.d/linux-wlan-ng-pre-up
> uml-utilities: /etc/network/if-pre-up.d/uml-utilities
> vde2: /etc/network/if-pre-up.d/vde2
> vlan: /etc/network/if-pre-up.d/vlan
> whereami: /etc/network/if-pre-up.d/whereami
> wireless-tools: /etc/network/if-pre-up.d/wireless-tools
> wpasupplicant: /etc/network/if-pre-up.d/wpasupplicant

except for brigding (and whereami), most of those exist purely because they
are needed to work at all with ifupdown. For instance, take wpasupplicant.
That one does all the busineess in pre-up.d ... which is done by NM directly
anyway. So running this in NM would actually hurt.

ifupdown-* stuff obviously the same. would be counter-productive to
call them. hostap* wireless-tools etc. stuff is also for hooks to do wifi stuff
already done by NM ... and so on.

 - Alexander

MarcH (marc-herbert-gmail) wrote :

Upstream's rationale is explained here:
<http://thread.gmane.org/gmane.linux.network.networkmanager.devel/13766/focus=13846>

... as well as in other discussions on the same list: search it.

Marlon (rac-sword2) wrote :

Got it, so according to that email chain it wont be fixed for a couple of reasons including latency and also...:
"2) appropriateness
    a) many of the things people used to do in pre-up or pre-down
scripts (munging routing tables, other stuff) are better done by
*modifying the connection config itself*"

1.- Ok, how can I get the iptable to load a configuration file using the above recommended method of "modifying the connection config itself"?

2.- Also, adding any type of script using this method, wouldnt it do the same as the preup/predown scripts folder? Couldnt it also fault against the same reasons for which the pre-up/pre-down phase was taken away?

I realize that my questions my sound sarcastic to some but I didnt ask them in such a "tone". I'm simply not as knowledgeable in *nix and want a solution to my specific use (loading iptables configuration before the network interface is up).

Thank you and forgive my lack of knowledge,

Marlon

Eric Carvalho (eric-carvalho) wrote :

A (ugly) work around is to use the loopback pre-up script.

/etc/network/interfaces:

auto lo
iface lo inet loopback
       pre-up /path/to/script

That way I was able to change my MAC address before the ethX get up.
I think this could be used to load firewall rules as well.

Definitely, this job should be done by NM.

Eric, I think you have missed the point. Using "pre-up" scripts is what this
bug is about.

"pre-up" script functionality has been removed.

Marlon was asking to how to load iptable configs before an interface comes
up without using "pre-up" scripts.

I had a similar issue, but the only thing I could think of was to hand-edit
the if-up scripts to do what I want - now that's ugly.

On Thu, Dec 10, 2009 at 7:14 AM, Eric Carvalho
<email address hidden>wrote:

> A (ugly) work around is to use the loopback pre-up script.
>
> /etc/network/interfaces:
>
> auto lo
> iface lo inet loopback
> pre-up /path/to/script
>
>
> That way I was able to change my MAC address before the ethX get up.
> I think this could be used to load firewall rules as well.
>
> Definitely, this job should be done by NM.
>
> --
> NetworkManager does not call /etc/network/if-pre-up.d scripts
> https://bugs.launchpad.net/bugs/336736
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in “network-manager” package in Ubuntu: Won't Fix
>
> Bug description:
> Binary package hint: network-manager
>
> Ubuntu 8.10, Linux 2.6.27-12-generic #1 SMP Thu Feb 5 09:26:35 UTC 2009
> i686 GNU/Linux
> NetworkManager 0.7~~svn20081018t105859-0ubuntu1.8.10.1
>
> I've been trying to get a script to trigger on the "pre-up" phase of
> network configuration, however, NetworkManager doesn't seem to call it's
> dispatcher for "pre-up" or "post-down" events.
>
> None of the scripts I put in /etc/network/if-pre-up.d ever got called, so I
> added the following line to the top of the dispatcher script
> "/etc/NetworkManager/dispatcher.d/01ifupdown":
>
> logger -t $0 "called with $1 $2"
>
> Where $0 is the name of the script, $1 is the network interface and $2 is
> the network event.
>
> After bringing some network connections up and down, I checked the logs,
> and NetworkManager doesn't seem to be calling
> "/etc/NetworkManager/dispatch.d/01ifupdown" for either "pre-up" or
> "post-down" events. The only entries that show up are for "up" and "down"
> events.
>
> According to the changelog both "pre-up" and "post-down" events are
> supposed to be supported as of version 0.5.1-0ubuntu12:
>
> https://launchpad.net/ubuntu/+source/network-manager
>
> To unsubscribe from this bug, go to:
>
> https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/336736/+subscribe
>

--
Joe Duncan
PhD Program, Psychology
Queen's University
<email address hidden>
(647)216-9135

Download full text (6.9 KiB)

Lol, that's not ugly.

Ugly is taking out a feature in a program that many have come to rely on without even documenting it on the change log.

Ugly is doing so because it might generate more emails about support on scripts that they have no control over because obviously it takes too long to ask "list the contents of the pre-up, pre-down folders here, to make sure there isn’t something new in there that might be timing out."

Ugly is saying that if you need to get something done that was previously in those folders, you need to do it somewhere else, without suggesting an option.

Ugly is also expecting those scripts or commands that someone has been relying on, that load at a specific phase, that might impact security, to be moved somewhere else so that it's not their problem (yes, I know, it was never their problem, but rather the user/admin). The scripts/commands still need to be loaded, they could still time out, but now they won't hear about it so problem solved?

Very ugly is doing all of the above on an operating system that has been looked down upon by many before because it simply "is not windows" (read dumbbed down or "user friendly") while at the same time having the best record for reliability. When so many (including I) have come to love, and prefer this snappy, reliable? and customizable? OS (which frankly is a hell of a lot more "user friendly" now, to the point where if there were more games/commercial apps being developed for it I would ditch Windows in a heartbeat) and encounter things like this, is quite disappointing. Very hard to defend it when its best quality is being "community driven" and customizable and that is obviously not true in this case.

Hell if all linux devs think this way then Grub needs to go away because it might not load one of the images or it might time-out. Take out startup scripts before logon, after logon, or on Desktop load for the same reason, I'm sure they will get less emails/bugs that way. As a matter of fact take out all possible scripts from loading at any time...just give us a hardcoded OS, wait, don’t they call that Windows? Nope, they actually have startup scripts...see a pattern yet?

This email has gone on for way too long and a bit (ok, a lot) of frustration is showing. I appreciate the work of the developers, especially when it's done without any retribution other than the appreciation of the users. I really love the open source mentality and community, so please do not get offended or mad at my ranting. In the spirit of being "open" I had to vent and give my $20.50 (all out of two cents). I apologize if I seem a bit bitter and strong about it, I could be wrong about all of it. I have been wrong many times before.

Thank you,

Marlon

-----Original Message-----
From: <email address hidden> [mailto:<email address hidden>] On Behalf Of JoeDuncan
Sent: Friday, December 11, 2009 10:10 AM
To: <email address hidden>
Subject: Re: [Bug 336736] Re: NetworkManager does not call /etc/network/if-pre-up.d scripts

Eric, I think you have missed the point. Using "pre-up" scripts is what this
bug is about.

"pre-up" script functionality has been removed.

Marlon was asking to how to load ipt...

Read more...

Eric Carvalho (eric-carvalho) wrote :

@JoeDuncan

This bug is about the removal of NetworkManager's pre-up scripts functionality.

The pre-up script inside /etc/network/interfaces file still works. The problem is that if you configure an interface in the interfaces file, NM won't manage that interface. So, as NM ignores loopback, I put a loopback pre-up script in /etc/network/interfaces to do whatever I want before NM takes control of my eth.

foolunch (lunch) wrote :

I'm on ubuntu karmic and here adding a "pre-up sudo ifconfig wlan0 hw ether xx:xx:xx:xx" to the /etc/network/interfaces file doesn't work.

So could anyone please point me to an alternative way of changing the mac address of wlan0 before it and networkmanager start up?
setting it after networkmanager has started messes up things aswell (not being able to connect anymore etc), so I have to kill the interface and networkmanager, then change the mac, then start everything again which obviously isn't the best solution. plus as someone above pointed out, the original mac is already out when the interface has been started and you change it afterwards.
now, how can i achieve that at boot, without the pre-up?

bog (martaina) wrote :

Hello evereyone!

this is my workaround:
I made /etc/init/network-manager.conf to look like this:

-------------snip----------------
# network-manager - network connection manager
#
# The Network Manager daemon manages the system's network connections,
# automatically switching between the best available.

description "network connection manager"

start on (local-filesystems
          and started dbus)
stop on stopping dbus

expect fork
respawn
pre-start script
        /usr/bin/macchanger -e wlan0
        /usr/bin/macchanger -e eth0
        /usr/bin/macchanger -e wmaster0
        /usr/bin/macchanger -e pan0
        #/usr/bin/logger wlan0 `/usr/bin/macchanger -s wlan0`
        #/usr/bin/logger eth0 `/usr/bin/macchanger -s eth0`
end script

---------------------------snip----------------------------------

obviously the crucial part is the pre-start thing.

Hope this helps somebody.

Nice Day
Bog

There is a more elegant workaround which allows to run macchanger before network-manager is started and doesn't require /etc/init/network-manager.conf to be modified (which could cause problems on upgrades).

Simply create /etc/init/macchanger.conf with the following contents (without the "snip" lines):
--------------------snip--------------------
# macchanger - set MAC addresses
#
# Set the MAC addresses for the network interfaces.

description "change mac addresses"

start on starting network-manager

pre-start script
        /usr/bin/macchanger -e wlan0
        /usr/bin/macchanger -e eth0
        /usr/bin/macchanger -e wmaster0
        /usr/bin/macchanger -e pan0
        #/usr/bin/logger wlan0 `/usr/bin/macchanger -s wlan0`
        #/usr/bin/logger eth0 `/usr/bin/macchanger -s eth0`
end script
--------------------snip--------------------

upstart will then make sure that the script is run before network-manager is started (that's what the "starting network-manager" line is about).

This helped me, because the workaround by editing /etc/network/interfaces didn't work for me, so hopefully this helps others too!

Ujjwal Singh (san0013) wrote :

Removing the Pre-Up feature is your call - fine but why still have those "if-" directories in /etc/network/ in the latest Ubuntu release.. ?? i am a noob.

Another solution is to add a macchanger command to the udev rules,
using RUN+="/usr/bin/macchanger -r wlan0" etc
For usb devices tt has the added bonus of changing the mac every time you unplug
the device

Hadmut Danisch (hadmut) wrote :

..which is technically wrong and insecure, since iptables must be setup before the interface is take up while Network Manager runs these script after Network has been taken up.

Furthermore, Network Manager does not guarantee to run these script or may leave a network interface open and thus unprotected if some script fails.

Definitely wrong method.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers