Julian Elischer writes:
 > I was thinking of doing this..
 > 
 > but slightly differnt....
 > renaming the node would change the interface name too.
 > but what you have would work as well.

Only problem it is no hook between node renaming code in ng_base.c and
interface allocation code in ng_iface.c

below more extended patch, that supports allocation first free
interface with name "ifname#".

 > "Vladimir B. Grebenschikov" wrote:
 > > 
 > > Tring to use netgraph system for some pruposes
 > > (frame-relay/tunneling/sync) I found that it is too complicated to
 > > follow naming schemes for different clients, and build firewall
 > > tables And not very clean witch ngX for what.
 > > 
 > > There two patches:
 > > 
 > > first allow name netgraph network interface.
 > > 
 > > # ngctl msg ng0: setifname \"sync0\"
 > > 
 > > will name interace ng0 as sync0
 > > 
 > > second patch allows rename already named netgraph node (I don't understand why
 > > netgraph designers don't allow this)
 > > 
 > > # ngctl name ng0: sync0
 > > 
 > > so small script will easy create interface:
 > > 
 > > mkif() {
 > >   name="$1"
 > >   ngname=`( echo "mkpeer iface dummy inet";  echo "msg .:dummy getifname" ) \
 > >          | ngctl -f - | perl -n -e '/Args:\s+\"(ng\d+)\"/ && print "$1\n";'`
 > >   if [ "$name" != "" ]; then
 > >      ngctl msg $ngname: setifname \"$name\"
 > >      ngctl name $ngname: $name
 > >      ngname=$name
 > >   fi
 > > }
 > > 
 > > # SYNC interfaces
 > > mkif sync0
 > > # some other netgraph stuff
 > > 
 > > mkif sync1
 > > ...
 > > mkif sync2
 > > ...
 > > 
 > > # framerelay
 > > mkif frm0
 > > ...
 > > mkif frm1
 > > ...
 > > 

iface-setname.patch



 > -- 
 >       __--_|\  Julian Elischer
 >      /       \ [EMAIL PROTECTED]
 >     (   OZ    ) World tour 2000-2001
 > ---> X_.---._/  

--
TSB Russian Express, Moscow
Vladimir B. Grebenschikov, [EMAIL PROTECTED]

Reply via email to