Re: ng_ether naming

2013-01-28 Thread Gleb Smirnoff
On Sun, Jan 27, 2013 at 01:16:53PM +0200, Andriy Gapon wrote:
A based on your suggestions and submissions I've produced the following patch:
A http://people.freebsd.org/~avg/ng_ether-renaming.diff
A 
A It's only compile-tested at the moment :)
A but I'd like to get your opinion about the direction of the change(s).
A I am going to really test the change very soon.

Patch is okay.

If you wan't to close all related PRs, you also need to patch ppp(8),
so that it does same sanitation of interface names when running PPPoE.

And probably drop a note to Dmitry, who maintains mpd5.

-- 
Totus tuus, Glebius.
___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to freebsd-net-unsubscr...@freebsd.org


Re: ng_ether naming

2013-01-27 Thread Andriy Gapon

Guys,

based on your suggestions and submissions I've produced the following patch:
http://people.freebsd.org/~avg/ng_ether-renaming.diff

It's only compile-tested at the moment :)
but I'd like to get your opinion about the direction of the change(s).
I am going to really test the change very soon.

Thank you.

-- 
Andriy Gapon
___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to freebsd-net-unsubscr...@freebsd.org


Re: ng_ether naming

2013-01-27 Thread Ermal Luçi
Hello,

it looks good, for just interface renaming scope.

The problem of it is that you need to check if the ifnet pointer needs
updated as well.
For coming and going interfaces like vlans you would have to update some
pointers as well at least the ifnet one.

The complete patch would rather include moving detach/attach(?) code from
if_ethersubr.c to ng_ether based on interface events.


On Sun, Jan 27, 2013 at 12:16 PM, Andriy Gapon a...@freebsd.org wrote:


 Guys,

 based on your suggestions and submissions I've produced the following
 patch:
 http://people.freebsd.org/~avg/ng_ether-renaming.diff

 It's only compile-tested at the moment :)
 but I'd like to get your opinion about the direction of the change(s).
 I am going to really test the change very soon.

 Thank you.

 --
 Andriy Gapon




-- 
Ermal
___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to freebsd-net-unsubscr...@freebsd.org


Re: ng_ether naming

2012-12-14 Thread Andriy Gapon
on 13/12/2012 20:57 Ermal Luçi said the following:
 
 
 
 On Thu, Dec 13, 2012 at 5:25 PM, Andriy Gapon a...@freebsd.org
 mailto:a...@freebsd.org wrote:
 
 on 13/12/2012 14:08 Alexander V. Chernikov said the following:
  On 13.12.2012 15:46, Andriy Gapon wrote:
 
  ng_ether uses if_xname for naming its nodes.
  This could be troublesome for mapping interface names to their ng_ether
 companions
  in the face of interface renaming capability.  Especially given that 
 interface
  renaming and ng_ether _module_ loading may happen in an arbitrary 
 order.
 
  I am not sure how to solve this best.
 
  One possibility is to use if_dname+if_dunit combination for ng_ether
 naming.  This
  should be stable and available for querying.  This behavior should 
 also be
  backward compatible with ng_ether being compiled into kernel
 (if_dname+if_dunit ==
  if_xname before any renaming could occur).
 
  Another possibility is to do ng_ether renaming when its interface is 
 renamed.
  This seems nicer but appears to be more work and more intrusive, 
 because
  interfaces would have to know about their ng_ether nodes.
 
  Not exactly. You can register for ifnet_departure_event and 
 ifnet_arrival_event.
 
  Interface renaming is done via sending departure event with old name 
 and arrvial
  event with new one.
 
 Good to know.  Thank you!
 
 
 So which approach sounds better?
 Or maybe there is even a better one?
 
 
 The best is interface event handling.
 Just recopy the new name from if_xname and should be done.

There is one problem with the current code which would automatically apply to 
the
interface renaming handling.
ng_ether does not do any validation or normalization of if_xname and the name
can contain symbols which are prohibited in a netgraph name, such as '.' for 
example.
ng_name_node would fail and warning would be logged but a node would stay 
unnamed.
I am a bit reluctant to write netgraph name escaping code myself.  Perhaps it
already exists in some place?

-- 
Andriy Gapon
___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to freebsd-net-unsubscr...@freebsd.org


Re: ng_ether naming

2012-12-14 Thread Nikolay Denev
On Dec 14, 2012, at 7:02 PM, Andriy Gapon a...@freebsd.org wrote:

 on 13/12/2012 20:57 Ermal Luçi said the following:
 
 
 
 On Thu, Dec 13, 2012 at 5:25 PM, Andriy Gapon a...@freebsd.org
 mailto:a...@freebsd.org wrote:
 
on 13/12/2012 14:08 Alexander V. Chernikov said the following:
 On 13.12.2012 15:46, Andriy Gapon wrote:
 
 ng_ether uses if_xname for naming its nodes.
 This could be troublesome for mapping interface names to their ng_ether
companions
 in the face of interface renaming capability.  Especially given that 
 interface
 renaming and ng_ether _module_ loading may happen in an arbitrary order.
 
 I am not sure how to solve this best.
 
 One possibility is to use if_dname+if_dunit combination for ng_ether
naming.  This
 should be stable and available for querying.  This behavior should also be
 backward compatible with ng_ether being compiled into kernel
(if_dname+if_dunit ==
 if_xname before any renaming could occur).
 
 Another possibility is to do ng_ether renaming when its interface is 
 renamed.
 This seems nicer but appears to be more work and more intrusive, because
 interfaces would have to know about their ng_ether nodes.
 
 Not exactly. You can register for ifnet_departure_event and 
 ifnet_arrival_event.
 
 Interface renaming is done via sending departure event with old name and 
 arrvial
 event with new one.
 
Good to know.  Thank you!
 
 
So which approach sounds better?
Or maybe there is even a better one?
 
 
 The best is interface event handling.
 Just recopy the new name from if_xname and should be done.
 
 There is one problem with the current code which would automatically apply to 
 the
 interface renaming handling.
 ng_ether does not do any validation or normalization of if_xname and the 
 name
 can contain symbols which are prohibited in a netgraph name, such as '.' for 
 example.
 ng_name_node would fail and warning would be logged but a node would stay 
 unnamed.
 I am a bit reluctant to write netgraph name escaping code myself.  Perhaps 
 it
 already exists in some place?
 
 -- 
 Andriy Gapon
 ___
 freebsd-net@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-net
 To unsubscribe, send any mail to freebsd-net-unsubscr...@freebsd.org


Hi,

Some time ago I had similar issue : 
http://lists.freebsd.org/pipermail/freebsd-net/2011-February/027982.html

The patch is also in : kern/154850

--
Nikolay
___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to freebsd-net-unsubscr...@freebsd.org


ng_ether naming

2012-12-13 Thread Andriy Gapon

ng_ether uses if_xname for naming its nodes.
This could be troublesome for mapping interface names to their ng_ether 
companions
in the face of interface renaming capability.  Especially given that interface
renaming and ng_ether _module_ loading may happen in an arbitrary order.

I am not sure how to solve this best.

One possibility is to use if_dname+if_dunit combination for ng_ether naming.  
This
should be stable and available for querying.  This behavior should also be
backward compatible with ng_ether being compiled into kernel (if_dname+if_dunit 
==
if_xname before any renaming could occur).

Another possibility is to do ng_ether renaming when its interface is renamed.
This seems nicer but appears to be more work and more intrusive, because
interfaces would have to know about their ng_ether nodes.

What do you think?
Thank you.

And just in case:
$ ifconfig -l
net0 lo0
$ ngctl list
There are 2 total nodes:
  Name: re0 Type: ether   ID: 0001   Num hooks: 0
  Name: ngctl11353  Type: socket  ID: 0003   Num hooks: 0

-- 
Andriy Gapon
___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to freebsd-net-unsubscr...@freebsd.org


Re: ng_ether naming

2012-12-13 Thread Alexander V. Chernikov

On 13.12.2012 15:46, Andriy Gapon wrote:


ng_ether uses if_xname for naming its nodes.
This could be troublesome for mapping interface names to their ng_ether 
companions
in the face of interface renaming capability.  Especially given that interface
renaming and ng_ether _module_ loading may happen in an arbitrary order.

I am not sure how to solve this best.

One possibility is to use if_dname+if_dunit combination for ng_ether naming.  
This
should be stable and available for querying.  This behavior should also be
backward compatible with ng_ether being compiled into kernel (if_dname+if_dunit 
==
if_xname before any renaming could occur).

Another possibility is to do ng_ether renaming when its interface is renamed.
This seems nicer but appears to be more work and more intrusive, because
interfaces would have to know about their ng_ether nodes.


Not exactly. You can register for ifnet_departure_event and 
ifnet_arrival_event.


Interface renaming is done via sending departure event with old name and 
arrvial event with new one.


What do you think?
Thank you.

And just in case:
$ ifconfig -l
net0 lo0
$ ngctl list
There are 2 total nodes:
   Name: re0 Type: ether   ID: 0001   Num hooks: 0
   Name: ngctl11353  Type: socket  ID: 0003   Num hooks: 0




--
WBR, Alexander


___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to freebsd-net-unsubscr...@freebsd.org


Re: ng_ether naming

2012-12-13 Thread Andriy Gapon
on 13/12/2012 14:08 Alexander V. Chernikov said the following:
 On 13.12.2012 15:46, Andriy Gapon wrote:

 ng_ether uses if_xname for naming its nodes.
 This could be troublesome for mapping interface names to their ng_ether 
 companions
 in the face of interface renaming capability.  Especially given that 
 interface
 renaming and ng_ether _module_ loading may happen in an arbitrary order.

 I am not sure how to solve this best.

 One possibility is to use if_dname+if_dunit combination for ng_ether naming. 
  This
 should be stable and available for querying.  This behavior should also be
 backward compatible with ng_ether being compiled into kernel 
 (if_dname+if_dunit ==
 if_xname before any renaming could occur).

 Another possibility is to do ng_ether renaming when its interface is renamed.
 This seems nicer but appears to be more work and more intrusive, because
 interfaces would have to know about their ng_ether nodes.
 
 Not exactly. You can register for ifnet_departure_event and 
 ifnet_arrival_event.
 
 Interface renaming is done via sending departure event with old name and 
 arrvial
 event with new one.

Good to know.  Thank you!


So which approach sounds better?
Or maybe there is even a better one?


 What do you think?
 Thank you.

 And just in case:
 $ ifconfig -l
 net0 lo0
 $ ngctl list
 There are 2 total nodes:
Name: re0 Type: ether   ID: 0001   Num hooks: 0
Name: ngctl11353  Type: socket  ID: 0003   Num hooks: 0

 
 


-- 
Andriy Gapon
___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to freebsd-net-unsubscr...@freebsd.org