Re: bridge(4) shouldn't try to create new interfaces when i make a typo

2020-07-09 Thread David Gwynne



> On 10 Jul 2020, at 12:45 am, sven falempin  wrote:
> 
> On Thu, Jul 9, 2020 at 3:31 AM Klemens Nanni  wrote:
>> 
>> On Thu, Jul 09, 2020 at 05:08:01PM +1000, David Gwynne wrote:
>>> if i accidentally `ifconfig bridge add gre0` instead of egre0, having
>>> bridge create gre0 and then not like it is not what i expect to happen.
>>> especially when it leaves me with an extra gre0 interface lying around
>>> afterwards.
>>> 
>>> i can appreciate that this was trying to be helpful when you wanted
>>> to add virtual interfaces to a bridge on boot, but that was before
>>> netstart(8) created all the interfaces with config files up front, before
>>> it then goes through and runs the config for them.
>> I agree.
>> 
>> OK kn
>> 
> 
> this will force the use of create beforehand ?

the interface you want to add as a bridge port will have to exist before you 
can add it to a bridge.

> or ifconfig bridge0 up will still work ?

ifconfig does that, so this diff does not break that.

> because script in the wild may not do the create first.

scripts may have to be fixed as things change.

> 
> -- 
> --
> -
> Knowing is not enough; we must apply. Willing is not enough; we must do
> 



Re: bridge(4) shouldn't try to create new interfaces when i make a typo

2020-07-09 Thread sven falempin
On Thu, Jul 9, 2020 at 3:31 AM Klemens Nanni  wrote:
>
> On Thu, Jul 09, 2020 at 05:08:01PM +1000, David Gwynne wrote:
> > if i accidentally `ifconfig bridge add gre0` instead of egre0, having
> > bridge create gre0 and then not like it is not what i expect to happen.
> > especially when it leaves me with an extra gre0 interface lying around
> > afterwards.
> >
> > i can appreciate that this was trying to be helpful when you wanted
> > to add virtual interfaces to a bridge on boot, but that was before
> > netstart(8) created all the interfaces with config files up front, before
> > it then goes through and runs the config for them.
> I agree.
>
> OK kn
>

this will force the use of create beforehand ?
or ifconfig bridge0 up will still work ?

because script in the wild may not do the create first.

-- 
--
-
Knowing is not enough; we must apply. Willing is not enough; we must do



Re: bridge(4) shouldn't try to create new interfaces when i make a typo

2020-07-09 Thread Klemens Nanni
On Thu, Jul 09, 2020 at 05:08:01PM +1000, David Gwynne wrote:
> if i accidentally `ifconfig bridge add gre0` instead of egre0, having
> bridge create gre0 and then not like it is not what i expect to happen.
> especially when it leaves me with an extra gre0 interface lying around
> afterwards.
> 
> i can appreciate that this was trying to be helpful when you wanted
> to add virtual interfaces to a bridge on boot, but that was before
> netstart(8) created all the interfaces with config files up front, before
> it then goes through and runs the config for them.
I agree.

OK kn



bridge(4) shouldn't try to create new interfaces when i make a typo

2020-07-09 Thread David Gwynne
if i accidentally `ifconfig bridge add gre0` instead of egre0, having
bridge create gre0 and then not like it is not what i expect to happen.
especially when it leaves me with an extra gre0 interface lying around
afterwards.

i can appreciate that this was trying to be helpful when you wanted
to add virtual interfaces to a bridge on boot, but that was before
netstart(8) created all the interfaces with config files up front, before
it then goes through and runs the config for them.

ok?

Index: if_bridge.c
===
RCS file: /cvs/src/sys/net/if_bridge.c,v
retrieving revision 1.340
diff -u -p -r1.340 if_bridge.c
--- if_bridge.c 24 Jun 2020 22:03:42 -  1.340
+++ if_bridge.c 9 Jul 2020 07:02:24 -
@@ -273,14 +273,6 @@ bridge_ioctl(struct ifnet *ifp, u_long c
break;
 
ifs = ifunit(req->ifbr_ifsname);
-
-   /* try to create the interface if it does't exist */
-   if (ifs == NULL) {
-   error = if_clone_create(req->ifbr_ifsname, 0);
-   if (error == 0)
-   ifs = ifunit(req->ifbr_ifsname);
-   }
-
if (ifs == NULL) {  /* no such interface */
error = ENOENT;
break;