Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-20 Thread Michael Grimm
On 20.07.2013, at 19:01, Hiroki Sato  wrote:
> Michael Grimm  wrote in 
> <5c2419e4-d5b7-4f1a-aed0-90ef73305...@odo.in-berlin.de>:

> tr> Now, a range definition and "prefixlen 56" is recognized properly:
> 
> Thank you.

Well, actually, we do have to thank you!

>  Committed as r253505 and will be merged to stable/9.

Great news and with kind regards,
Michael

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


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-20 Thread Hiroki Sato
Michael Grimm  wrote
  in <5c2419e4-d5b7-4f1a-aed0-90ef73305...@odo.in-berlin.de>:

tr> On 20.07.2013, at 16:46, Hiroki Sato  wrote:
tr> > Hiroki Sato  wrote in 
<20130718.123323.1730389945845032580@allbsd.org>:
tr> >
tr> > Can you test the attached patch?  The old version (in stable/9 now)
tr> > does not support "address range spec + options" properly and ignore
tr> > the options part.
tr> >
tr> > The attached patch accepts options and treats "netmask" for inet and
tr> > "prefixlen" in inet6 in a reasonable way so that the specified
tr> > options do not conflict with the default /NN values.
tr>
tr> I can confirm that your patch is working for my examples used before.
tr>
tr> Now, a range definition and "prefixlen 56" is recognized properly:

 Thank you.  Committed as r253505 and will be merged to stable/9.

-- Hiroki


pgp2zlCMgHI0D.pgp
Description: PGP signature


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-20 Thread Michael Grimm
On 20.07.2013, at 16:46, Hiroki Sato  wrote:
> Hiroki Sato  wrote in 
> <20130718.123323.1730389945845032580@allbsd.org>:

> hr> Michael Grimm  wrote
> hr>   in :
> hr>
> hr> tr> On 12.07.2013, at 09:03, Hiroki Sato  wrote:
> hr> tr>
> hr> tr> > Please let me know if the existing configurations and/or the new
> hr> tr> > formats do not work.
> hr> tr>
> hr> tr> First of all: great work! It is that much easier to deal with 
> aliases, now.
> hr> tr>
> hr> tr> There is only one minor issue, if at all:
> hr> tr>
> hr> tr> rc.conf:
> hr> tr> | ifconfig_em0_ipv6="inet6 dead:beef::::1 prefixlen 56"
> hr> tr> | ifconfig_em0_aliases="\
> hr> tr> | inet6 dead:beef::::2-3 prefixlen 56 \
> hr> tr> | inet6 dead:beef::::4 prefixlen 56 \
> hr> tr> | inet6 dead:beef::::5-6/56"
> hr> tr>
> hr> tr> ifconfig:
> hr> tr> | inet6 dead:beef::::1 prefixlen 56
> hr> tr> | inet6 dead:beef::::2 prefixlen 64
> hr> tr> | inet6 dead:beef::::3 prefixlen 64
> hr> tr> | inet6 dead:beef::::4 prefixlen 56
> hr> tr> | inet6 dead:beef::::5 prefixlen 56
> hr> tr> | inet6 dead:beef::::6 prefixlen 56
> hr> tr>
> hr> tr> Any combination of a range definition (2-3) *and* "prefixlen 56"is 
> ignored
> hr> tr> whereas a range definition (5-6) *and* "/56" is interpreted as wanted.
> hr> tr>
> hr> tr> Well, that combination of a range and "prefix" isn't documented, thus 
> I am
> hr> tr> not sure if that's an issue or a feature?
> hr>
> hr>  It seems a bug.  Thank you for your report.  I am investigating it now.
> 
> Can you test the attached patch?  The old version (in stable/9 now)
> does not support "address range spec + options" properly and ignore
> the options part.
> 
> The attached patch accepts options and treats "netmask" for inet and
> "prefixlen" in inet6 in a reasonable way so that the specified
> options do not conflict with the default /NN values.

I can confirm that your patch is working for my examples used before. 

Now, a range definition and "prefixlen 56" is recognized properly:

ifconfig:
|   inet6 dead:beef::::2 prefixlen 56 
|   inet6 dead:beef::::3 prefixlen 56 
|   inet6 dead:beef::::4 prefixlen 56 
|   inet6 dead:beef::::5 prefixlen 56 
|   inet6 dead:beef::::6 prefixlen 56 

Thanks and with kind regards,
Michael


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


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-20 Thread Hiroki Sato
Hiroki Sato  wrote
  in <20130718.123323.1730389945845032580@allbsd.org>:

hr> Michael Grimm  wrote
hr>   in :
hr>
hr> tr> On 12.07.2013, at 09:03, Hiroki Sato  wrote:
hr> tr>
hr> tr> > Please let me know if the existing configurations and/or the new
hr> tr> > formats do not work.
hr> tr>
hr> tr> First of all: great work! It is that much easier to deal with aliases, 
now.
hr> tr>
hr> tr> There is only one minor issue, if at all:
hr> tr>
hr> tr> rc.conf:
hr> tr> | ifconfig_em0_ipv6="inet6 dead:beef::::1 prefixlen 56"
hr> tr> | ifconfig_em0_aliases="\
hr> tr> | inet6 dead:beef::::2-3 prefixlen 56 \
hr> tr> | inet6 dead:beef::::4 prefixlen 56 \
hr> tr> | inet6 dead:beef::::5-6/56"
hr> tr>
hr> tr> ifconfig:
hr> tr> |   inet6 dead:beef::::1 prefixlen 56
hr> tr> |   inet6 dead:beef::::2 prefixlen 64
hr> tr> |   inet6 dead:beef::::3 prefixlen 64
hr> tr> |   inet6 dead:beef::::4 prefixlen 56
hr> tr> |   inet6 dead:beef::::5 prefixlen 56
hr> tr> |   inet6 dead:beef::::6 prefixlen 56
hr> tr>
hr> tr> Any combination of a range definition (2-3) *and* "prefixlen 56" is 
ignored
hr> tr> whereas a range definition (5-6) *and* "/56" is interpreted as wanted.
hr> tr>
hr> tr> Well, that combination of a range and "prefix" isn't documented, thus I 
am
hr> tr> not sure if that's an issue or a feature?
hr>
hr>  It seems a bug.  Thank you for your report.  I am investigating it now.

 Can you test the attached patch?  The old version (in stable/9 now)
 does not support "address range spec + options" properly and ignore
 the options part.

 The attached patch accepts options and treats "netmask" for inet and
 "prefixlen" in inet6 in a reasonable way so that the specified
 options do not conflict with the default /NN values.

-- Hiroki
Index: etc/network.subr
===
--- etc/network.subr	(revision 253489)
+++ etc/network.subr	(working copy)
@@ -721,9 +721,14 @@
 #
 ifalias_expand_addr()
 {
+	local _af _action

-	afexists $1 || return
-	ifalias_expand_addr_$1 $2 $3
+	_af=$1
+	_action=$2
+	shift 2
+
+	afexists $_af || return
+	ifalias_expand_addr_$_af $_action $*
 }

 # ifalias_expand_addr_inet action addr
@@ -731,19 +736,31 @@
 #
 ifalias_expand_addr_inet()
 {
-	local _action _arg _cidr _cidr_addr
+	local _action _arg _cidr _cidr_addr _exargs
 	local _ipaddr _plen _range _iphead _iptail _iplow _iphigh _ipcount
 	local _retstr _c
 	_action=$1
 	_arg=$2
+	shift 2
+	_exargs=$*
 	_retstr=

-	case $_action:$_arg in
+	case $_action:$_arg:$_exargs in
 	*:*--*)		return ;;			# invalid
-	tmp:*)		echo $_arg && return ;;		# already expanded
-	tmp:*-*)	_action="alias"	;;		# to be expanded
-	*:*-*)		;;# to be expanded
-	*:*)		echo inet $_arg && return ;;	# already expanded
+	tmp:*:*netmask*)		# already expanded w/ netmask option
+		echo ${_arg%/[0-9]*} $_exargs && return
+	;;
+	tmp:*:*)			# already expanded w/o netmask option
+		echo $_arg $_exargs && return
+	;;
+	tmp:*[0-9]-[0-9]*:*)	_action="alias"	;;	# to be expanded
+	*:*[0-9]-[0-9]*:*)	;;			# to be expanded
+	*:*:*netmask*)			# already expanded w/ netmask option
+		echo inet ${_arg%/[0-9]*} $_exargs && return
+	;;
+	*:*:*)# already expanded w/o netmask option
+		echo inet $_arg $_exargs && return
+	;;
 	esac

 	for _cidr in $_arg; do
@@ -796,7 +813,7 @@
 	done

 	for _c in $_retstr; do
-		ifalias_expand_addr_inet $_action $_c
+		ifalias_expand_addr_inet $_action $_c $_exargs
 	done
 }

@@ -805,20 +822,32 @@
 #
 ifalias_expand_addr_inet6()
 {
-	local _action _arg _cidr _cidr_addr
+	local _action _arg _cidr _cidr_addr _exargs
 	local _ipaddr _plen _ipleft _ipright _iplow _iphigh _ipcount
 	local _ipv4part
 	local _retstr _c
 	_action=$1
 	_arg=$2
+	shift 2
+	_exargs=$*
 	_retstr=

-	case $_action:$_arg in
-	*:*--*)		return ;;			# invalid
-	tmp:*)		echo $_arg && return ;;
-	tmp:*-*)	_action="alias"	;;
-	*:*-*)		;;
-	*:*)		echo inet6 $_arg && return ;;
+	case $_action:$_arg:$_exargs in
+	*:*--*:*)	return ;;			# invalid
+	tmp:*:*prefixlen*)	# already expanded w/ prefixlen option
+		echo ${_arg%/[0-9]*} $_exargs && return
+	;;
+	tmp:*:*)		# already expanded w/o prefixlen option
+		echo $_arg $_exargs && return
+	;;
+	tmp:*[0-9a-zA-Z]-[0-9a-zA-Z]*:*)_action="alias"	;;# to be expanded
+	*:*[0-9a-zA-Z]-[0-9a-zA-Z]*:*)	;;		# to be expanded
+	*:*:*prefixlen*)	# already expanded w/ prefixlen option
+		echo inet6 ${_arg%/[0-9]*} $_exargs && return
+	;;
+	*:*:*)			# already expanded w/o prefixlen option
+		echo inet6 $_arg $_exargs && return
+	;;
 	esac

 	for _cidr in $_arg; do
@@ -872,7 +901,7 @@
 			fi

 			for _c in $_retstr; do
-ifalias_expand_addr_inet6 $_action $_c
+ifalias_expand_addr_inet6 $_action $_c $_exargs
 			done
 		else
 			# v4mapped/v4compat should handle as an IPv4 alias
@@ -888,7 +917,7 @@
 			_retstr=`ifalias_expand_addr_inet \
 			tmp ${_ipv4part}${_plen:+/}${_plen}`
 			

Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-17 Thread Hiroki Sato
Michael Grimm  wrote
  in :

tr> On 12.07.2013, at 09:03, Hiroki Sato  wrote:
tr>
tr> > Please let me know if the existing configurations and/or the new
tr> > formats do not work.
tr>
tr> First of all: great work! It is that much easier to deal with aliases, now.
tr>
tr> There is only one minor issue, if at all:
tr>
tr> rc.conf:
tr> | ifconfig_em0_ipv6="inet6 dead:beef::::1 prefixlen 56"
tr> | ifconfig_em0_aliases="\
tr> | inet6 dead:beef::::2-3 prefixlen 56 \
tr> | inet6 dead:beef::::4 prefixlen 56 \
tr> | inet6 dead:beef::::5-6/56"
tr>
tr> ifconfig:
tr> |   inet6 dead:beef::::1 prefixlen 56
tr> |   inet6 dead:beef::::2 prefixlen 64
tr> |   inet6 dead:beef::::3 prefixlen 64
tr> |   inet6 dead:beef::::4 prefixlen 56
tr> |   inet6 dead:beef::::5 prefixlen 56
tr> |   inet6 dead:beef::::6 prefixlen 56
tr>
tr> Any combination of a range definition (2-3) *and* "prefixlen 56" is ignored
tr> whereas a range definition (5-6) *and* "/56" is interpreted as wanted.
tr>
tr> Well, that combination of a range and "prefix" isn't documented, thus I am
tr> not sure if that's an issue or a feature?

 It seems a bug.  Thank you for your report.  I am investigating it now.

-- Hiroki


pgpeQ_UFShVrJ.pgp
Description: PGP signature


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-17 Thread Michael Grimm

On 12.07.2013, at 09:03, Hiroki Sato  wrote:

> Please let me know if the existing configurations and/or the new
> formats do not work.

First of all: great work! It is that much easier to deal with aliases, now.

There is only one minor issue, if at all:

rc.conf:
| ifconfig_em0_ipv6="inet6 dead:beef::::1 prefixlen 56"
| ifconfig_em0_aliases="\
| inet6 dead:beef::::2-3 prefixlen 56 \
| inet6 dead:beef::::4 prefixlen 56 \
| inet6 dead:beef::::5-6/56"

ifconfig:
|   inet6 dead:beef::::1 prefixlen 56 
|   inet6 dead:beef::::2 prefixlen 64 
|   inet6 dead:beef::::3 prefixlen 64 
|   inet6 dead:beef::::4 prefixlen 56 
|   inet6 dead:beef::::5 prefixlen 56 
|   inet6 dead:beef::::6 prefixlen 56 

Any combination of a range definition (2-3) *and* "prefixlen 56" is ignored
whereas a range definition (5-6) *and* "/56" is interpreted as wanted.

Well, that combination of a range and "prefix" isn't documented, thus I am
not sure if that's an issue or a feature?

With kind regards,
Michael

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


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-17 Thread Mark Felder
Thanks for that info, Hiroki. I'm running CURRENT on my main server and
do see this now. Could you also make a note to add it to
/etc/default/rc.conf as well?


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


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-17 Thread Hiroki Sato
Mark Felder  wrote
  in <1374062120.4532.140661256673649.36ed5...@webmail.messagingengine.com>:

fe> On Wed, Jul 17, 2013, at 4:36, Hiroki Sato wrote:
fe> >
fe> >  The recommended way is ifconfig_IF_aliasN or ifconfig_IF_aliases.
fe> >  ipv4_addr_IF will not be removed in the near future, but please use
fe> >  ifconfig_IF_alias{N,es} for newly-configured systems.  Backward
fe> >  compatibility for not breaking the existing configurations will be
fe> >  maintained as much as possible (even on the upcoming 10.0R and
fe> >  later).
fe> >
fe>
fe> Almost everyone is familiar with ifconfig_IF_aliasN, but can you provide
fe> example syntax for ifconfig_IF_aliases ? I've never seen that before and
fe> can't find it documented.

 I committed some descriptions about it to rc.conf(5) at the same
 time.  It is basically the same as ifconfig_IF_aliasN, but can have
 multiple address specification.  Both of ifconfig_IF_alias{N,es} now
 supports range specification, so there is no difference in the
 functionality.  The following two examples give the same result:

   ifconfig_ed0_alias0="inet 127.0.0.251 netmask 0x"
   ifconfig_ed0_alias1="inet 127.0.0.252 netmask 0x"
   ifconfig_ed0_alias2="inet 127.0.0.253 netmask 0x"
   ifconfig_ed0_alias3="inet 127.0.0.254 netmask 0x"

   ifconfig_ed0_aliases="\
 inet 127.0.0.251 netmask 0x \
 inet 127.0.0.252 netmask 0x \
 inet 127.0.0.253 netmask 0x \
 inet 127.0.0.254 netmask 0x \
   "

 The implementation actually converts values in the variables in
 ifconfig_IF_aliasN, ipv6_ifconfig_IF_aliasN, and ipv4_addrs_IF into a
 list of them in a consistent format (AF-keyword + address spec +
 options) used in ifconfig_IF_aliases, and then it processes
 ifconfig_IF_aliases and them.

 ifconfig_IF_aliasN accepts address spec without address family
 keyword for backward compatibility, but ifconfig_IF_aliases does not.
 This is the difference between the two.

fe> This thread isn't exactly the proper forum to debate the future of
fe> network configuration on FreeBSD, but please take this into
fe> consideration. And thank you for your work on the rc.d scripts --
fe> they're the #1 reason many of us prefer working with FreeBSD.

 Fair enough.  Please do not hesitate to speak up on freebsd-rc@ for
 this kind of topics.

-- Hiroki


pgpjGe9dn7kJF.pgp
Description: PGP signature


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-17 Thread Mark Felder
On Wed, Jul 17, 2013, at 4:36, Hiroki Sato wrote:
> 
>  The recommended way is ifconfig_IF_aliasN or ifconfig_IF_aliases.
>  ipv4_addr_IF will not be removed in the near future, but please use
>  ifconfig_IF_alias{N,es} for newly-configured systems.  Backward
>  compatibility for not breaking the existing configurations will be
>  maintained as much as possible (even on the upcoming 10.0R and
>  later).
>

Almost everyone is familiar with ifconfig_IF_aliasN, but can you provide
example syntax for ifconfig_IF_aliases ? I've never seen that before and
can't find it documented.

> 
>  This is because we have a lot of variables which have (almost) the
>  same functionality in rc.conf and I want to simplify them by merging
>  them with each other, not because these are better than the others.
>  Variables with overlapped functionality have made difficult to
>  maintain/improve the rc.d scripts.
> 

I would actually prefer to see the ifconfig_IF_aliasN syntax go away
entirely as it simply cannot scale without becoming tedious. I know we
can't cover every edge case, but after discussing with people on this
list about the desire for ipv6_addrs_IF, now committed, it seems I'm not
the only example of this use case.

The best scenario I can describe is a situation where you have a shared
webhosting environment on FreeBSD. I may very well have 200 IPs on one
server. Being able to use ranges and CIDR syntax is invaluable. The idea
of ifconfig_IF_aliasN is not so bad as long as you never have to make
any changes. However, it's not uncommon to receive a work order from
sales where a customer needs to be moved from the shared webhosting
environment to their own private VM. We need to move the IP they were
using as we probably do not control DNS and it might be difficult for
the customer to get that changed. Removing an IP from the middle of 200
ifconfig_IF_aliasN entries requires you to renumber them all. This is
simply cruel and error-prone. Being able to adjust the ranges of
ipv4_addrs_IF is much cleaner and reliable.

This thread isn't exactly the proper forum to debate the future of
network configuration on FreeBSD, but please take this into
consideration. And thank you for your work on the rc.d scripts --
they're the #1 reason many of us prefer working with FreeBSD.
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-17 Thread Thomas Steen Rasmussen

On 17-07-2013 13:41, Mark Felder wrote:

On Wed, Jul 17, 2013, at 6:09, Thomas Steen Rasmussen wrote:

Hello,

Does this work on stable/9 or only on current ? If not, are there
any plans to MFC ? I ask because I don't see the
ifconfig_IF_aliases syntax in /etc/defaults/rc.conf on a newly
built stable/9 box.


It's there in /etc/defaults/rc.conf, but maybe not very obvious:

#ifconfig_lo0_alias0="inet 127.0.0.254 netmask 0x" # Sample
alias entry.

It is also in the Handbook:

http://www.freebsd.org/doc/en/books/handbook/configtuning-virtual-hosts.html

Hello,

There is a big difference between ifconfig_IF_aliasN which is v4
only and requires a line for each IP, and must be continous,
meaning that _alias1, _alias2, _alias4 wont work - and the new
fancy ifconfig_IF_aliases which accepts both address families
and also ranges and stuff.

I was asking about the new _aliases form.

Thanks!

/Thomas Steen Rasmussen

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


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-17 Thread Mark Felder
On Wed, Jul 17, 2013, at 6:09, Thomas Steen Rasmussen wrote:
> Hello,
> 
> Does this work on stable/9 or only on current ? If not, are there
> any plans to MFC ? I ask because I don't see the
> ifconfig_IF_aliases syntax in /etc/defaults/rc.conf on a newly
> built stable/9 box.
> 

It's there in /etc/defaults/rc.conf, but maybe not very obvious:

#ifconfig_lo0_alias0="inet 127.0.0.254 netmask 0x" # Sample
alias entry.

It is also in the Handbook:

http://www.freebsd.org/doc/en/books/handbook/configtuning-virtual-hosts.html




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


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-17 Thread Thomas Steen Rasmussen

On 17-07-2013 11:36, Hiroki Sato wrote:

  The recommended way is ifconfig_IF_aliasN or ifconfig_IF_aliases.
  ipv4_addr_IF will not be removed in the near future, but please use
  ifconfig_IF_alias{N,es} for newly-configured systems.

Hello,

Does this work on stable/9 or only on current ? If not, are there
any plans to MFC ? I ask because I don't see the
ifconfig_IF_aliases syntax in /etc/defaults/rc.conf on a newly
built stable/9 box.

Thanks for this by the way - it _greatly_ simplifies rc.conf
on my jail hosts, very nice.

Best regards,

Thomas Steen Rasmussen

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


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-17 Thread Hiroki Sato
Łukasz Wąsikowski  wrote
  in <51e53ac7.1040...@wasikowski.net>:

lu> hr># IPv4 address range spec.  Now deprecated.
lu> hr>ipv4_addr_em0="10.2.1.1-10"
lu> 
lu> So I'm a little confused now :) If I'd use post r252015 system then
lu> would this be better way?
lu> 
lu> ifconfig_em0_aliases="inet 10.0.0.66/28 inet 10.0.0.67-78 inet6
lu> fdda:5cc1:23:4::1/48 inet6 fdda:5cc1:23:4::2-f"

"Dewayne Geraghty"  wrote
  in <14677223DB6D4CD48E880520725B3552@white>:

de> Sato-san,
de> 
de> You have provided a very useful summary of ifconfig parameters for
de> rc.conf. However, you are missing one example that would provide
de> clearer understanding.  Would you please advise if 
de>  
de> ipv4_addr_em0="10.2.1.1-10/32"
de> 
de> is deprecated, backward compatible or remains valid into the future?
de> 
de> I particularly appreciate the succinctness of:
de> ifconfig_em0_aliases="inet 10.3.3.201-204/24 inet6
de> 2001:db8:210-213::1/64 inet 10.1.1.1/24"

 The recommended way is ifconfig_IF_aliasN or ifconfig_IF_aliases.
 ipv4_addr_IF will not be removed in the near future, but please use
 ifconfig_IF_alias{N,es} for newly-configured systems.  Backward
 compatibility for not breaking the existing configurations will be
 maintained as much as possible (even on the upcoming 10.0R and
 later).

 This is because we have a lot of variables which have (almost) the
 same functionality in rc.conf and I want to simplify them by merging
 them with each other, not because these are better than the others.
 Variables with overlapped functionality have made difficult to
 maintain/improve the rc.d scripts.

-- Hiroki


pgpzCODgf7YuF.pgp
Description: PGP signature


RE: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-16 Thread Dewayne Geraghty
Sato-san,

You have provided a very useful summary of ifconfig parameters for rc.conf. 
However, you are missing one example that would provide
clearer understanding.  Would you please advise if 
 
ipv4_addr_em0="10.2.1.1-10/32"

is deprecated, backward compatible or remains valid into the future?

I particularly appreciate the succinctness of:
ifconfig_em0_aliases="inet 10.3.3.201-204/24 inet6 2001:db8:210-213::1/64 inet 
10.1.1.1/24"

Kind regards, Dewayne.

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


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-16 Thread Mark Felder
On Tue, 16 Jul 2013 12:19:31 -0500, Kevin Oberman
<[1]rkober...@gmail.com> wrote:



> It didn't. 10.2.1.1-10 syntax did.



I'm not totally clear on this yet -- the entire concept of being able
to do *ranges* is deprecated? Or is it deprecated because it's missing
the CIDR?





Thanks

References

1. mailto:rkober...@gmail.com
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-16 Thread Kevin Oberman
On Tue, Jul 16, 2013 at 5:25 AM, Mark Felder  wrote:

> On Tue, Jul 16, 2013, at 7:21, Łukasz Wąsikowski wrote:
> >
> > I'm using ipv4_addrs_em0 now (and ipv6_addrs_em0 with Kimmo Paasiala's
> > patch), but Hiroki Sato wrote:
> >
> > hr># IPv4 address range spec.  Now deprecated.
> > hr>ipv4_addr_em0="10.2.1.1-10"
> >
> > So I'm a little confused now :)
>
> As am I... when did ipv4_addr get deprecated?
>

It didn't.  10.2.1.1-10 syntax did.
-- 
R. Kevin Oberman, Network Engineer
E-mail: rkober...@gmail.com
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"

Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-16 Thread Mark Felder
On Tue, Jul 16, 2013, at 7:21, Łukasz Wąsikowski wrote:
> 
> I'm using ipv4_addrs_em0 now (and ipv6_addrs_em0 with Kimmo Paasiala's
> patch), but Hiroki Sato wrote:
> 
> hr># IPv4 address range spec.  Now deprecated.
> hr>ipv4_addr_em0="10.2.1.1-10"
> 
> So I'm a little confused now :)

As am I... when did ipv4_addr get deprecated?
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"

Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-16 Thread Łukasz Wąsikowski
W dniu 2013-07-16 13:29, Mark Felder pisze:

> On Tue, Jul 16, 2013, at 6:12, Łukasz Wąsikowski wrote:
>>
>> What is the current, non deprecated way, to configure IP addresses in
>> rc.conf? Let's say for a dual stack, multi IP box I need to set:
>>
>> 10.0.0.66/28 and 10.0.0.67-78 as aliases and
>> fdda:5cc1:23:4::1/48 and fdda:5cc1:23:4::2-f as aliases
>>
>> What is the best way to accomplish it?
>>
> 
> 
> ipv4_addrs_em0="10.0.0.66-78/28"
> 
> ipv6 syntax depends on if you're using 8.x or 9.1-RELEASE, but you're
> going to have to do all the aliases manually.

I'm using ipv4_addrs_em0 now (and ipv6_addrs_em0 with Kimmo Paasiala's
patch), but Hiroki Sato wrote:

hr># IPv4 address range spec.  Now deprecated.
hr>ipv4_addr_em0="10.2.1.1-10"

So I'm a little confused now :) If I'd use post r252015 system then
would this be better way?

ifconfig_em0_aliases="inet 10.0.0.66/28 inet 10.0.0.67-78 inet6
fdda:5cc1:23:4::1/48 inet6 fdda:5cc1:23:4::2-f"

-- 
best regards,
Lukasz Wasikowski
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"

Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-16 Thread Mark Felder
On Tue, Jul 16, 2013, at 6:12, Łukasz Wąsikowski wrote:
>
> What is the current, non deprecated way, to configure IP addresses in
> rc.conf? Let's say for a dual stack, multi IP box I need to set:
> 
> 10.0.0.66/28 and 10.0.0.67-78 as aliases and
> fdda:5cc1:23:4::1/48 and fdda:5cc1:23:4::2-f as aliases
> 
> What is the best way to accomplish it?
>


ipv4_addrs_em0="10.0.0.66-78/28"

ipv6 syntax depends on if you're using 8.x or 9.1-RELEASE, but you're
going to have to do all the aliases manually.
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"

Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-16 Thread Łukasz Wąsikowski
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

W dniu 2013-07-12 09:03, Hiroki Sato pisze:

> Please let me know if the existing configurations and/or the new 
> formats do not work.  The following is a summary of the supported 
> rc.conf variables, FYI:
> 
> Hiroki Sato  wrote in
> <201306200229.r5k2tnfr085...@svn.freebsd.org>:
> 

[...]

What is the current, non deprecated way, to configure IP addresses in
rc.conf? Let's say for a dual stack, multi IP box I need to set:

10.0.0.66/28 and 10.0.0.67-78 as aliases and
fdda:5cc1:23:4::1/48 and fdda:5cc1:23:4::2-f as aliases

What is the best way to accomplish it?

- -- 
best regards,
Lukasz Wasikowski
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlHlKqQACgkQXlaUxx+udUUtnwCfc74UJLDPnCjec+v8TP0d8ceV
Pz4AnA6Nd5rwO5HL/LYdaJiPmBC1ENxC
=bzG8
-END PGP SIGNATURE-
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-12 Thread Hiroki Sato
Michael Grimm  wrote
  in <4c07217dc9200841dfd065a6d5284...@mx1.enfer-du-nord.net>:

tr> On 2013-07-12 6:56, Hiroki Sato wrote:
tr> > Kevin Oberman  wrote
tr> >   in :
tr> > rk> On Wed, Jul 10, 2013 at 4:46 AM, Mark Felder  wrote:
tr> > rk>
tr> > rk> > On Wed, 10 Jul 2013 06:44:12 -0500, Michael Grimm <
tr> > rk> > trash...@odo.in-berlin.de> wrote:
tr> > rk> >
tr> > rk> >  Will that patch make it into 9.2? If I am not mistaken, that patch 
isn't
tr> > rk> >> in stable yet.
tr> > rk> >>
tr> > rk> >
tr> > rk> > I would also like to see this patch hit 9.x sooner than later. It's 
so
tr> > rk> > painful when someone forgets to fix the alias numbering on servers 
with
tr> > rk> > many, many IPv4 and IPv6 addresses...
tr> > rk> >
tr> > rk>
tr> > rk> Please, please, please, please, ...!
tr> > rk>
tr> > rk> Freeze is only two days away, so time for 9.2 is almost over and I 
can see
tr> > rk> no good reason NOT to get this done.
tr> >  r252015 was merged to stable/9 today.
tr>
tr> Thanks! This is highly appreciated. A first glance at network.subr tells me 
that
tr> much more has been modified/simplified regarding alias definitions, great.

 Please let me know if the existing configurations and/or the new
 formats do not work.  The following is a summary of the supported
 rc.conf variables, FYI:

Hiroki Sato  wrote
  in <201306200229.r5k2tnfr085...@svn.freebsd.org>:

hr>   A summary of the supported ifconfig_* variables is as follows:
hr>
hr># IPv4 configuration.
hr>ifconfig_em0="inet 192.168.0.1"
hr># IPv6 configuration.
hr>ifconfig_em0_ipv6="inet6 2001:db8::1/64"
hr># IPv4 address range spec.  Now deprecated.
hr>ipv4_addr_em0="10.2.1.1-10"
hr># IPv6 alias.
hr>ifconfig_em0_alias0="inet6 2001:db8:5::1 prefixlen 70"
hr># IPv4 alias.
hr>ifconfig_em0_alias1="inet 10.2.2.1/24"
hr># IPv4 alias with range spec w/o AF keyword (backward compat).
hr>ifconfig_em0_alias2="10.3.1.1-10/32"
hr># IPv6 alias with range spec.
hr>ifconfig_em0_alias3="inet6 2001:db8:20-2f::1/64"
hr># ifconfig_IF_aliases is just like ifconfig_IF_aliasN.
hr>ifconfig_em0_aliases="inet 10.3.3.201-204/24 inet6 
2001:db8:210-213::1/64 inet 10.1.1.1/24"
hr># IPv6 alias (backward compat)
hr>ipv6_ifconfig_em0_alias0="inet6 2001:db8:f::1/64"
hr># IPv6 alias w/o AF keyword (backward compat)
hr>ipv6_ifconfig_em0_alias1="2001:db8:f:1::1/64"
hr># IPv6 prefix.
hr>ipv6_prefix_em0="2001:db8::/64"

-- Hiroki


pgp_2ncrav6RP.pgp
Description: PGP signature


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-11 Thread Michael Grimm

On 2013-07-12 6:56, Hiroki Sato wrote:

Kevin Oberman  wrote
  in 
:


rk> On Wed, Jul 10, 2013 at 4:46 AM, Mark Felder  wrote:
rk>
rk> > On Wed, 10 Jul 2013 06:44:12 -0500, Michael Grimm <
rk> > trash...@odo.in-berlin.de> wrote:
rk> >
rk> >  Will that patch make it into 9.2? If I am not mistaken, that 
patch isn't

rk> >> in stable yet.
rk> >>
rk> >
rk> > I would also like to see this patch hit 9.x sooner than later. 
It's so
rk> > painful when someone forgets to fix the alias numbering on 
servers with

rk> > many, many IPv4 and IPv6 addresses...
rk> >
rk>
rk> Please, please, please, please, ...!
rk>
rk> Freeze is only two days away, so time for 9.2 is almost over and I 
can see

rk> no good reason NOT to get this done.

 r252015 was merged to stable/9 today.


Thanks! This is highly appreciated. A first glance at network.subr tells 
me that
much more has been modified/simplified regarding alias definitions, 
great.


Regards, Michael

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


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-11 Thread Kevin Oberman
On Thu, Jul 11, 2013 at 9:56 PM, Hiroki Sato  wrote:

> Kevin Oberman  wrote
>   in :
>
> rk> On Wed, Jul 10, 2013 at 4:46 AM, Mark Felder  wrote:
> rk>
> rk> > On Wed, 10 Jul 2013 06:44:12 -0500, Michael Grimm <
> rk> > trash...@odo.in-berlin.de> wrote:
> rk> >
> rk> >  Will that patch make it into 9.2? If I am not mistaken, that patch
> isn't
> rk> >> in stable yet.
> rk> >>
> rk> >
> rk> > I would also like to see this patch hit 9.x sooner than later. It's
> so
> rk> > painful when someone forgets to fix the alias numbering on servers
> with
> rk> > many, many IPv4 and IPv6 addresses...
> rk> >
> rk>
> rk> Please, please, please, please, ...!
> rk>
> rk> Freeze is only two days away, so time for 9.2 is almost over and I can
> see
> rk> no good reason NOT to get this done.
>
>  r252015 was merged to stable/9 today.
>
> -- Hiroki
>

Just under the wire! I'm sure that I am not the only one who appreciates it.

-- 
R. Kevin Oberman, Network Engineer
E-mail: rkober...@gmail.com
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-11 Thread Hiroki Sato
Kevin Oberman  wrote
  in :

rk> On Wed, Jul 10, 2013 at 4:46 AM, Mark Felder  wrote:
rk>
rk> > On Wed, 10 Jul 2013 06:44:12 -0500, Michael Grimm <
rk> > trash...@odo.in-berlin.de> wrote:
rk> >
rk> >  Will that patch make it into 9.2? If I am not mistaken, that patch isn't
rk> >> in stable yet.
rk> >>
rk> >
rk> > I would also like to see this patch hit 9.x sooner than later. It's so
rk> > painful when someone forgets to fix the alias numbering on servers with
rk> > many, many IPv4 and IPv6 addresses...
rk> >
rk>
rk> Please, please, please, please, ...!
rk>
rk> Freeze is only two days away, so time for 9.2 is almost over and I can see
rk> no good reason NOT to get this done.

 r252015 was merged to stable/9 today.

-- Hiroki


pgpwRUfj8rol1.pgp
Description: PGP signature


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-11 Thread Łukasz Wąsikowski
W dniu 2013-07-10 17:52, Kevin Oberman pisze:

> On Wed, Jul 10, 2013 at 4:46 AM, Mark Felder  wrote:
> 
>> On Wed, 10 Jul 2013 06:44:12 -0500, Michael Grimm <
>> trash...@odo.in-berlin.de> wrote:
>>
>>  Will that patch make it into 9.2? If I am not mistaken, that patch isn't
>>> in stable yet.
>>>
>>
>> I would also like to see this patch hit 9.x sooner than later. It's so
>> painful when someone forgets to fix the alias numbering on servers with
>> many, many IPv4 and IPv6 addresses...
>>
> 
> Please, please, please, please, ...!
> 
> Freeze is only two days away, so time for 9.2 is almost over and I can see
> no good reason NOT to get this done.

+1 to that, please commit it.

-- 
best regards,
Lukasz Wasikowski
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-10 Thread Kevin Oberman
On Wed, Jul 10, 2013 at 4:46 AM, Mark Felder  wrote:

> On Wed, 10 Jul 2013 06:44:12 -0500, Michael Grimm <
> trash...@odo.in-berlin.de> wrote:
>
>  Will that patch make it into 9.2? If I am not mistaken, that patch isn't
>> in stable yet.
>>
>
> I would also like to see this patch hit 9.x sooner than later. It's so
> painful when someone forgets to fix the alias numbering on servers with
> many, many IPv4 and IPv6 addresses...
>

Please, please, please, please, ...!

Freeze is only two days away, so time for 9.2 is almost over and I can see
no good reason NOT to get this done.
-- 
R. Kevin Oberman, Network Engineer
E-mail: rkober...@gmail.com
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-10 Thread Mark Felder
On Wed, 10 Jul 2013 06:44:12 -0500, Michael Grimm  
 wrote:


Will that patch make it into 9.2? If I am not mistaken, that patch isn't  
in stable yet.


I would also like to see this patch hit 9.x sooner than later. It's so  
painful when someone forgets to fix the alias numbering on servers with  
many, many IPv4 and IPv6 addresses...

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


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-07-10 Thread Michael Grimm

Hi --

[Upcoming code freeze in stable]

On 2013-04-13 22:15, Michael Grimm wrote:

On 13.04.2013, at 14:29, Kimmo Paasiala  wrote:



[great deal of simplification by ipv6_addrs_IF]


Sorry to resurrect this thread but since nothing has happened in about
three months I have to ask: What can I do to have this commited to
HEAD?


+1

Nowadays -where IPv6 becomes more and more available by ISPs- I 
*really*

would like to see this simplification implemented, soon, very soon. The
current scheme is way to much error prone, and, its a pain in the ass!

Thanks for the patch,
Michael


Will that patch make it into 9.2? If I am not mistaken, that patch isn't 
in stable yet.


Regards,
Michael

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


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-04-21 Thread Łukasz Wąsikowski
W dniu 2013-04-13 22:15, Michael Grimm pisze:

> On 13.04.2013, at 14:29, Kimmo Paasiala  wrote:
> 
> [great deal of simplification by ipv6_addrs_IF]
> 
>> Sorry to resurrect this thread but since nothing has happened in about
>> three months I have to ask: What can I do to have this commited to
>> HEAD?
> 
> +1
> 
> Nowadays -where IPv6 becomes more and more available by ISPs- I *really*
> would like to see this simplification implemented, soon, very soon. The
> current scheme is way to much error prone, and, its a pain in the ass!

Kimmo's patch worked for me. It would be great to have ipv6_addrs_if out
of the box.

-- 
best regards,
Lukasz Wasikowski
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-04-13 Thread Michael Grimm
Hi --

On 13.04.2013, at 14:29, Kimmo Paasiala  wrote:

[great deal of simplification by ipv6_addrs_IF]

> Sorry to resurrect this thread but since nothing has happened in about
> three months I have to ask: What can I do to have this commited to
> HEAD?

+1

Nowadays -where IPv6 becomes more and more available by ISPs- I *really*
would like to see this simplification implemented, soon, very soon. The
current scheme is way to much error prone, and, its a pain in the ass!

Thanks for the patch,
Michael

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


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-04-13 Thread Kimmo Paasiala
On Thu, Jan 17, 2013 at 7:24 AM, Kimmo Paasiala  wrote:
> On Thu, Dec 27, 2012 at 11:42 PM, Phil Kulin  wrote:
>> 2012/12/26 Kimmo Paasiala :
>>
>>> I've revised the patch again and updated it at gihub,
>>> https://gist.github.com/4362018.  It can now be applied at top level
>>> of sources (/usr/src typically). It now does the deconfiguration in
>>> reverse order of the configuration, meaning the aliases configured
>>> with ipv6_addrs_IF are removed before the ones configured with
>>> ifconfig_IF_aliasN="inet6 ...".
>>
>> Adapted for FreeBSD 8.2, works fine:
>>
>> --- network.subr.orig   2011-02-17 05:19:39.0 +0300
>> +++ network.subr2012-12-28 00:46:38.0 +0400
>> @@ -312,6 +312,12 @@ afexists()
>>  #  1 otherwise.
>>  ipv6if()
>>  {
>> +   # Test for $ipv6_addrs_IF. If it exists then the
>> +   # interface should be configured for IPv6
>> +   _tmpargs=$(get_if_var $_if ipv6_addrs_IF)
>> +   if [ -n "${_tmpargs}" ]; then
>> +   return 0
>> +   fi
>> if ! checkyesno ipv6_enable; then
>> return 1
>> fi
>> @@ -948,7 +954,12 @@ network6_interface_setup()
>> rtsol_interface=no
>> ifconfig $i inet6 ${ipv6_ifconfig} alias
>> fi
>> -
>> +   ipv6_addrs=`get_if_var $i ipv6_addrs_IF`
>> +   if [ -n "${ipv6_addrs}" ]; then
>> +   rtsol_available=no
>> +   rtsol_interface=no
>> +   ipv6_addrs_common ${i} alias
>> +   fi
>> # Wireless NIC cards are virtualized through the wlan 
>> interface
>> if ! is_wired_interface ${i}; then
>> case "${i}" in
>> @@ -1178,3 +1189,39 @@ network6_getladdr()
>> esac
>> done
>>  }
>> +
>> +ipv6_addrs_common()
>> +{
>> +   local _ret _if _action _ip6prefix _ip6prefixes
>> +   local _ip6addr _prefixlen
>> +   local _range _ip6net _ip6low _ip6high
>> +   _ret=1
>> +   _if=$1
>> +   _action=$2
>> +   # get the prefixes from ipv6_addrs_IF variable
>> +   _ip6prefixes=`get_if_var $_if ipv6_addrs_IF`
>> +   for _ip6prefix in ${_ip6prefixes}; do
>> +   _ip6addr=${_ip6prefix%%/*}
>> +   _prefixlen=${_ip6prefix##*/}
>> +   _range=${_ip6addr##*:}
>> +   _ip6net=${_ip6addr%:*}
>> +   _ip6low=${_range%-*}
>> +   _ip6high=${_range#*-}
>> +   # If deleting an alias, set _prefixlen to null string.
>> +   if [ "${_action}" = "-alias" ]; then
>> +   _prefixlen=""
>> +   else
>> +   _prefixlen="prefixlen $_prefixlen"
>> +   fi
>> +   _ip6high=$(("0x${_ip6high}"))
>> +   _ip6count=$(("0x${_ip6low}"))
>> +   while [ "${_ip6count}" -le "${_ip6high}" ]; do
>> +   # Re-uses the _ip6addr variable from above
>> +   _ip6addr=$(printf "%x" "${_ip6count}")
>> +   eval "ifconfig ${_if} inet6
>> ${_ip6net}:${_ip6addr} ${_prefixlen} ${_action}"
>> +   _ip6count=$((${_ip6count}+1))
>> +   _ret=0
>> +   done
>> +   done
>> +   return $_ret
>> +}
>>
>>
>> --
>> Non nobis Domine non nobis sed Nomini Tuo da gloriam
>> Phil Kulin
>
> I don't have an 8.X system to test but I guess it's fine.
>
> Any more interest in this? I'd love to see this added, not because I
> wrote it but because I want to contribute in any way I can.
>
> -Kimmo

Sorry to resurrect this thread but since nothing has happened in about
three months I have to ask: What can I do to have this commited to
HEAD? I'd be even willing to become a src committer if that's what is
required. I feel that I'm compentent enough. Who can I contact?

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


Re: ipv6_addrs_IF aliases in rc.conf(5)

2013-01-16 Thread Kimmo Paasiala
On Thu, Dec 27, 2012 at 11:42 PM, Phil Kulin  wrote:
> 2012/12/26 Kimmo Paasiala :
>
>> I've revised the patch again and updated it at gihub,
>> https://gist.github.com/4362018.  It can now be applied at top level
>> of sources (/usr/src typically). It now does the deconfiguration in
>> reverse order of the configuration, meaning the aliases configured
>> with ipv6_addrs_IF are removed before the ones configured with
>> ifconfig_IF_aliasN="inet6 ...".
>
> Adapted for FreeBSD 8.2, works fine:
>
> --- network.subr.orig   2011-02-17 05:19:39.0 +0300
> +++ network.subr2012-12-28 00:46:38.0 +0400
> @@ -312,6 +312,12 @@ afexists()
>  #  1 otherwise.
>  ipv6if()
>  {
> +   # Test for $ipv6_addrs_IF. If it exists then the
> +   # interface should be configured for IPv6
> +   _tmpargs=$(get_if_var $_if ipv6_addrs_IF)
> +   if [ -n "${_tmpargs}" ]; then
> +   return 0
> +   fi
> if ! checkyesno ipv6_enable; then
> return 1
> fi
> @@ -948,7 +954,12 @@ network6_interface_setup()
> rtsol_interface=no
> ifconfig $i inet6 ${ipv6_ifconfig} alias
> fi
> -
> +   ipv6_addrs=`get_if_var $i ipv6_addrs_IF`
> +   if [ -n "${ipv6_addrs}" ]; then
> +   rtsol_available=no
> +   rtsol_interface=no
> +   ipv6_addrs_common ${i} alias
> +   fi
> # Wireless NIC cards are virtualized through the wlan 
> interface
> if ! is_wired_interface ${i}; then
> case "${i}" in
> @@ -1178,3 +1189,39 @@ network6_getladdr()
> esac
> done
>  }
> +
> +ipv6_addrs_common()
> +{
> +   local _ret _if _action _ip6prefix _ip6prefixes
> +   local _ip6addr _prefixlen
> +   local _range _ip6net _ip6low _ip6high
> +   _ret=1
> +   _if=$1
> +   _action=$2
> +   # get the prefixes from ipv6_addrs_IF variable
> +   _ip6prefixes=`get_if_var $_if ipv6_addrs_IF`
> +   for _ip6prefix in ${_ip6prefixes}; do
> +   _ip6addr=${_ip6prefix%%/*}
> +   _prefixlen=${_ip6prefix##*/}
> +   _range=${_ip6addr##*:}
> +   _ip6net=${_ip6addr%:*}
> +   _ip6low=${_range%-*}
> +   _ip6high=${_range#*-}
> +   # If deleting an alias, set _prefixlen to null string.
> +   if [ "${_action}" = "-alias" ]; then
> +   _prefixlen=""
> +   else
> +   _prefixlen="prefixlen $_prefixlen"
> +   fi
> +   _ip6high=$(("0x${_ip6high}"))
> +   _ip6count=$(("0x${_ip6low}"))
> +   while [ "${_ip6count}" -le "${_ip6high}" ]; do
> +   # Re-uses the _ip6addr variable from above
> +   _ip6addr=$(printf "%x" "${_ip6count}")
> +   eval "ifconfig ${_if} inet6
> ${_ip6net}:${_ip6addr} ${_prefixlen} ${_action}"
> +   _ip6count=$((${_ip6count}+1))
> +   _ret=0
> +   done
> +   done
> +   return $_ret
> +}
>
>
> --
> Non nobis Domine non nobis sed Nomini Tuo da gloriam
> Phil Kulin

I don't have an 8.X system to test but I guess it's fine.

Any more interest in this? I'd love to see this added, not because I
wrote it but because I want to contribute in any way I can.

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


Re: ipv6_addrs_IF aliases in rc.conf(5)

2012-12-27 Thread Phil Kulin
2012/12/26 Kimmo Paasiala :

> I've revised the patch again and updated it at gihub,
> https://gist.github.com/4362018.  It can now be applied at top level
> of sources (/usr/src typically). It now does the deconfiguration in
> reverse order of the configuration, meaning the aliases configured
> with ipv6_addrs_IF are removed before the ones configured with
> ifconfig_IF_aliasN="inet6 ...".

Adapted for FreeBSD 8.2, works fine:

--- network.subr.orig   2011-02-17 05:19:39.0 +0300
+++ network.subr2012-12-28 00:46:38.0 +0400
@@ -312,6 +312,12 @@ afexists()
 #  1 otherwise.
 ipv6if()
 {
+   # Test for $ipv6_addrs_IF. If it exists then the
+   # interface should be configured for IPv6
+   _tmpargs=$(get_if_var $_if ipv6_addrs_IF)
+   if [ -n "${_tmpargs}" ]; then
+   return 0
+   fi
if ! checkyesno ipv6_enable; then
return 1
fi
@@ -948,7 +954,12 @@ network6_interface_setup()
rtsol_interface=no
ifconfig $i inet6 ${ipv6_ifconfig} alias
fi
-
+   ipv6_addrs=`get_if_var $i ipv6_addrs_IF`
+   if [ -n "${ipv6_addrs}" ]; then
+   rtsol_available=no
+   rtsol_interface=no
+   ipv6_addrs_common ${i} alias
+   fi
# Wireless NIC cards are virtualized through the wlan interface
if ! is_wired_interface ${i}; then
case "${i}" in
@@ -1178,3 +1189,39 @@ network6_getladdr()
esac
done
 }
+
+ipv6_addrs_common()
+{
+   local _ret _if _action _ip6prefix _ip6prefixes
+   local _ip6addr _prefixlen
+   local _range _ip6net _ip6low _ip6high
+   _ret=1
+   _if=$1
+   _action=$2
+   # get the prefixes from ipv6_addrs_IF variable
+   _ip6prefixes=`get_if_var $_if ipv6_addrs_IF`
+   for _ip6prefix in ${_ip6prefixes}; do
+   _ip6addr=${_ip6prefix%%/*}
+   _prefixlen=${_ip6prefix##*/}
+   _range=${_ip6addr##*:}
+   _ip6net=${_ip6addr%:*}
+   _ip6low=${_range%-*}
+   _ip6high=${_range#*-}
+   # If deleting an alias, set _prefixlen to null string.
+   if [ "${_action}" = "-alias" ]; then
+   _prefixlen=""
+   else
+   _prefixlen="prefixlen $_prefixlen"
+   fi
+   _ip6high=$(("0x${_ip6high}"))
+   _ip6count=$(("0x${_ip6low}"))
+   while [ "${_ip6count}" -le "${_ip6high}" ]; do
+   # Re-uses the _ip6addr variable from above
+   _ip6addr=$(printf "%x" "${_ip6count}")
+   eval "ifconfig ${_if} inet6
${_ip6net}:${_ip6addr} ${_prefixlen} ${_action}"
+   _ip6count=$((${_ip6count}+1))
+   _ret=0
+   done
+   done
+   return $_ret
+}


-- 
Non nobis Domine non nobis sed Nomini Tuo da gloriam
Phil Kulin
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: ipv6_addrs_IF aliases in rc.conf(5)

2012-12-26 Thread Thomas Steen Rasmussen
On 26-12-2012 10:33, Kimmo Paasiala wrote:
> Now, is there any interest in seeing this feature as part of future
> versions of FreeBSD? Could it be incorporated to HEAD and then MFC'ed
> to 9-STABLE  if it turns out it's seen as a useful feature?

Yes please! I've been waiting for this for a while, as it will greatly
simplify my rc.conf on a whole bunch of jail hosts. I've spoken with
bz@ about this at eurobsdcon in November 2011 and he agreed that it
is a missing feature, so I suspect it is a matter of time before your
patch is picked up by a committer. Thank you for your work!


Best regards

Thomas Steen Rasmussen

ps. bz@ cc'ed so he sees this thread

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


Re: ipv6_addrs_IF aliases in rc.conf(5)

2012-12-26 Thread Kimmo Paasiala
On Mon, Dec 24, 2012 at 6:07 AM, Kimmo Paasiala  wrote:
> On Sat, Dec 22, 2012 at 7:49 PM, Łukasz Wąsikowski
>  wrote:
>> W dniu 2012-12-22 18:14, Ben Morrow pisze:
>>> Quoth =?UTF-8?B?xYF1a2FzeiBXxIVzaWtvd3NraQ==?= :
 W dniu 2012-12-22 04:41, Kimmo Paasiala pisze:

> Yeah, this is problem in network.subr. An interface is not recognized
> as IPv6 capable if the interface is not in "ipv6_network_interfaces"
> and there's no "ifconfig_IF_ipv6" in rc.conf(5), bummer. For IPv4 it
> "just works" because the interface is always assumed to be IPv4
> capable.

 Ok, I used ifconfig_em0_ipv6="up" and it worked. So it looks like this:
>>>
>>> The documented way to do this is to just set the link-local address in
>>> ifconfig_IF_ipv6, since an interface is required to have a link-local
>>> address. Either configure an fe80:: address explicitly or set
>>>
>>> ifconfig_em0_ipv6="inet6 auto_linklocal"
>>>
>>> Alternatively, if you set ipv6_activate_all_interfaces all interfaces
>>> will be considered IPv6-capable.
>>
>> link-local address is assigned by default, even with ifconfig_IF_ipv6="up".
>>
>> root@freebsd:~ # grep -Ev '^[[:space:]]*#|^$' /etc/rc.conf ; ifconfig
>> em0 | grep -E '^[[:space:]]*inet6' | head -2
>> hostname="freebsd"
>> ifconfig_em0="up"
>> ipv4_addrs_em0="192.168.168.20-24/24"
>> defaultrouter="192.168.168.1"
>> ipv6_network_interfaces="em0"
>> ipv6_defaultrouter="2001:6a0:1cb::"
>> ifconfig_em0_ipv6="up"
>> ipv6_addrs_em0="2001:6a0:1cb::1-e/128"
>> sshd_enable="YES"
>> dumpdev="NO"
>> named_enable="YES"
>> inet6 fe80::a00:27ff:fe02:8371%em0 prefixlen 64 scopeid 0x1
>> inet6 2001:6a0:1cb::1 prefixlen 128
>>
>> Of course using "inet6 auto_linklocal" instead of "up" seems a better
>> way to do it, thank you for this tip.
>>
>> --
>> best regards,
>> Lukasz Wasikowski
>
>
> I have put up the patch at github as:
>
> https://gist.github.com/4362018
>
> This version should work with just the ipv6_addrs_IF in rc.conf(5). I
> changed the detection of ipv6 interfaces so that just having the
> ipv6_addrs_IF line is enough.
>
> -Kimmo

I've revised the patch again and updated it at gihub,
https://gist.github.com/4362018.  It can now be applied at top level
of sources (/usr/src typically). It now does the deconfiguration in
reverse order of the configuration, meaning the aliases configured
with ipv6_addrs_IF are removed before the ones configured with
ifconfig_IF_aliasN="inet6 ...".

Also as noted in my previous message it's possible to configure all
IPv6 addresses with a single ipv6_addrs_IF line in rc.conf:

ipv6_addrs_re0="2001:db8::::1-4/64"


I consider this version of the patch pretty much completed work. It
applies cleanly to HEAD version r244694 and I don't see why it
wouldn't work in HEAD as well.

Now, is there any interest in seeing this feature as part of future
versions of FreeBSD? Could it be incorporated to HEAD and then MFC'ed
to 9-STABLE  if it turns out it's seen as a useful feature?

Regards,

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

Re: ipv6_addrs_IF aliases in rc.conf(5)

2012-12-23 Thread Kimmo Paasiala
On Sat, Dec 22, 2012 at 7:49 PM, Łukasz Wąsikowski
 wrote:
> W dniu 2012-12-22 18:14, Ben Morrow pisze:
>> Quoth =?UTF-8?B?xYF1a2FzeiBXxIVzaWtvd3NraQ==?= :
>>> W dniu 2012-12-22 04:41, Kimmo Paasiala pisze:
>>>
 Yeah, this is problem in network.subr. An interface is not recognized
 as IPv6 capable if the interface is not in "ipv6_network_interfaces"
 and there's no "ifconfig_IF_ipv6" in rc.conf(5), bummer. For IPv4 it
 "just works" because the interface is always assumed to be IPv4
 capable.
>>>
>>> Ok, I used ifconfig_em0_ipv6="up" and it worked. So it looks like this:
>>
>> The documented way to do this is to just set the link-local address in
>> ifconfig_IF_ipv6, since an interface is required to have a link-local
>> address. Either configure an fe80:: address explicitly or set
>>
>> ifconfig_em0_ipv6="inet6 auto_linklocal"
>>
>> Alternatively, if you set ipv6_activate_all_interfaces all interfaces
>> will be considered IPv6-capable.
>
> link-local address is assigned by default, even with ifconfig_IF_ipv6="up".
>
> root@freebsd:~ # grep -Ev '^[[:space:]]*#|^$' /etc/rc.conf ; ifconfig
> em0 | grep -E '^[[:space:]]*inet6' | head -2
> hostname="freebsd"
> ifconfig_em0="up"
> ipv4_addrs_em0="192.168.168.20-24/24"
> defaultrouter="192.168.168.1"
> ipv6_network_interfaces="em0"
> ipv6_defaultrouter="2001:6a0:1cb::"
> ifconfig_em0_ipv6="up"
> ipv6_addrs_em0="2001:6a0:1cb::1-e/128"
> sshd_enable="YES"
> dumpdev="NO"
> named_enable="YES"
> inet6 fe80::a00:27ff:fe02:8371%em0 prefixlen 64 scopeid 0x1
> inet6 2001:6a0:1cb::1 prefixlen 128
>
> Of course using "inet6 auto_linklocal" instead of "up" seems a better
> way to do it, thank you for this tip.
>
> --
> best regards,
> Lukasz Wasikowski


I have put up the patch at github as:

https://gist.github.com/4362018

This version should work with just the ipv6_addrs_IF in rc.conf(5). I
changed the detection of ipv6 interfaces so that just having the
ipv6_addrs_IF line is enough.

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

Re: ipv6_addrs_IF aliases in rc.conf(5)

2012-12-22 Thread Łukasz Wąsikowski
W dniu 2012-12-22 18:14, Ben Morrow pisze:
> Quoth =?UTF-8?B?xYF1a2FzeiBXxIVzaWtvd3NraQ==?= :
>> W dniu 2012-12-22 04:41, Kimmo Paasiala pisze:
>>
>>> Yeah, this is problem in network.subr. An interface is not recognized
>>> as IPv6 capable if the interface is not in "ipv6_network_interfaces"
>>> and there's no "ifconfig_IF_ipv6" in rc.conf(5), bummer. For IPv4 it
>>> "just works" because the interface is always assumed to be IPv4
>>> capable.
>>
>> Ok, I used ifconfig_em0_ipv6="up" and it worked. So it looks like this:
> 
> The documented way to do this is to just set the link-local address in
> ifconfig_IF_ipv6, since an interface is required to have a link-local
> address. Either configure an fe80:: address explicitly or set
> 
> ifconfig_em0_ipv6="inet6 auto_linklocal"
> 
> Alternatively, if you set ipv6_activate_all_interfaces all interfaces
> will be considered IPv6-capable.

link-local address is assigned by default, even with ifconfig_IF_ipv6="up".

root@freebsd:~ # grep -Ev '^[[:space:]]*#|^$' /etc/rc.conf ; ifconfig
em0 | grep -E '^[[:space:]]*inet6' | head -2
hostname="freebsd"
ifconfig_em0="up"
ipv4_addrs_em0="192.168.168.20-24/24"
defaultrouter="192.168.168.1"
ipv6_network_interfaces="em0"
ipv6_defaultrouter="2001:6a0:1cb::"
ifconfig_em0_ipv6="up"
ipv6_addrs_em0="2001:6a0:1cb::1-e/128"
sshd_enable="YES"
dumpdev="NO"
named_enable="YES"
inet6 fe80::a00:27ff:fe02:8371%em0 prefixlen 64 scopeid 0x1
inet6 2001:6a0:1cb::1 prefixlen 128

Of course using "inet6 auto_linklocal" instead of "up" seems a better
way to do it, thank you for this tip.

-- 
best regards,
Lukasz Wasikowski
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: ipv6_addrs_IF aliases in rc.conf(5)

2012-12-22 Thread Ben Morrow
Quoth =?UTF-8?B?xYF1a2FzeiBXxIVzaWtvd3NraQ==?= :
> W dniu 2012-12-22 04:41, Kimmo Paasiala pisze:
> 
> > Yeah, this is problem in network.subr. An interface is not recognized
> > as IPv6 capable if the interface is not in "ipv6_network_interfaces"
> > and there's no "ifconfig_IF_ipv6" in rc.conf(5), bummer. For IPv4 it
> > "just works" because the interface is always assumed to be IPv4
> > capable.
> 
> Ok, I used ifconfig_em0_ipv6="up" and it worked. So it looks like this:

The documented way to do this is to just set the link-local address in
ifconfig_IF_ipv6, since an interface is required to have a link-local
address. Either configure an fe80:: address explicitly or set

ifconfig_em0_ipv6="inet6 auto_linklocal"

Alternatively, if you set ipv6_activate_all_interfaces all interfaces
will be considered IPv6-capable.

Ben

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


Re: ipv6_addrs_IF aliases in rc.conf(5)

2012-12-22 Thread Kimmo Paasiala
On Sat, Dec 22, 2012 at 4:25 PM, Łukasz Wąsikowski
 wrote:
> W dniu 2012-12-22 04:41, Kimmo Paasiala pisze:
>
 It looks like the reason for the difference to ipv4_addrs_IF is that
 the "alias" parameter for ifconfig(8) operates differently for IPv6
 addresses, the first address of an interface can't be added with
 "alias", for IPv4 it does not care. I'll have to dig deeper but that's
 what the problem seems to be.

 -Kimmo
>>>
>>> The 'alias' parameter of ifconfig(8) is not the problem on the first
>>> ipv6 address, I have verified that. However, there's probably
>>> something in network.subr or /etc/rc.d/netif that I have overlooked
>>> and causes my code to be skipped if there's no ifconfig_IF_ipv6
>>> variable defined in rc.conf(5).
>>>
>>> -Kimmo
>>
>> Yeah, this is problem in network.subr. An interface is not recognized
>> as IPv6 capable if the interface is not in "ipv6_network_interfaces"
>> and there's no "ifconfig_IF_ipv6" in rc.conf(5), bummer. For IPv4 it
>> "just works" because the interface is always assumed to be IPv4
>> capable.
>
> Ok, I used ifconfig_em0_ipv6="up" and it worked. So it looks like this:
>
> ipv6_activate_all_interfaces="NO"
> ipv6_network_interfaces="em0"
> ifconfig_em0_ipv6="up"
> ipv6_addrs_em0="2001:6a0:1cb::1-ff/64"
> ipv6_defaultrouter="2001:6a0:1cb::"
>
> Good job, thank you! :)
>
> --
> best regards,
> Lukasz Wasikowski

I'm looking into fixing the issue so you could just have the
ipv6_addrs_em0 line in rc.conf. However I don't want to flood the PR
and this mailing list with different versions of the patch. I want to
get it right next time. Stay tuned.

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

Re: ipv6_addrs_IF aliases in rc.conf(5)

2012-12-22 Thread Łukasz Wąsikowski
W dniu 2012-12-22 04:41, Kimmo Paasiala pisze:

>>> It looks like the reason for the difference to ipv4_addrs_IF is that
>>> the "alias" parameter for ifconfig(8) operates differently for IPv6
>>> addresses, the first address of an interface can't be added with
>>> "alias", for IPv4 it does not care. I'll have to dig deeper but that's
>>> what the problem seems to be.
>>>
>>> -Kimmo
>>
>> The 'alias' parameter of ifconfig(8) is not the problem on the first
>> ipv6 address, I have verified that. However, there's probably
>> something in network.subr or /etc/rc.d/netif that I have overlooked
>> and causes my code to be skipped if there's no ifconfig_IF_ipv6
>> variable defined in rc.conf(5).
>>
>> -Kimmo
> 
> Yeah, this is problem in network.subr. An interface is not recognized
> as IPv6 capable if the interface is not in "ipv6_network_interfaces"
> and there's no "ifconfig_IF_ipv6" in rc.conf(5), bummer. For IPv4 it
> "just works" because the interface is always assumed to be IPv4
> capable.

Ok, I used ifconfig_em0_ipv6="up" and it worked. So it looks like this:

ipv6_activate_all_interfaces="NO"
ipv6_network_interfaces="em0"
ifconfig_em0_ipv6="up"
ipv6_addrs_em0="2001:6a0:1cb::1-ff/64"
ipv6_defaultrouter="2001:6a0:1cb::"

Good job, thank you! :)

-- 
best regards,
Lukasz Wasikowski
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: ipv6_addrs_IF aliases in rc.conf(5)

2012-12-21 Thread Kimmo Paasiala
On Sat, Dec 22, 2012 at 5:09 AM, Kimmo Paasiala  wrote:
> On Sat, Dec 22, 2012 at 3:19 AM, Kimmo Paasiala  wrote:
>> On Sat, Dec 22, 2012 at 1:38 AM, Łukasz Wąsikowski
>>  wrote:
>>> W dniu 2012-12-21 13:23, Kimmo Paasiala pisze:
 On Fri, Dec 21, 2012 at 5:43 AM, Kimmo Paasiala  wrote:
> On Thu, Dec 20, 2012 at 3:27 PM, Jilles Tjoelker  wrote:
>> On Thu, Dec 20, 2012 at 01:04:34PM +0200, Kimmo Paasiala wrote:
>>> A question related to this for those who have been doing work on the
>>> rc(8) scripts. Can I assume that /usr/bin is available when
>>> network.subr functions are used? Doing calculations on hexadecimal
>>> numbers is going to be very awkward if I can't use for example bc(1).
>>
>> You cannot assume that /usr/bin is available when setting up the
>> network. It may be that /usr is mounted via NFS.
>>
>> You can use hexadecimal numbers (prefixed with 0x) in $((...))
>> expressions. In FreeBSD 9.0 or newer, sh has a printf builtin you can
>> use; in older versions you can use hexdigit and hexprint from
>> network.subr.
>>
>> --
>> Jilles Tjoelker
>
> Thanks, I've rewitten my patch to support ranges. It is attached in
> this message.
>
> Again it's against a very recent 9-STABLE, I still haven't found time
> to see if it applies to CURRENT.
>
> It does allow you to do crazy stuff like
>
> ipv6_addrs_re0="2001:db8::::1-/64"
>
> However I didn't find anything to limit the number of aliases in the
> ipv4 version of the function either.
>
> Please test it :)
>
>
> Then a question about the PR
> (http://www.freebsd.org/cgi/query-pr.cgi?pr=174225) I wrote, how can I
> attach this new patch to it? The submit follow up -button fires up my
> email client and I'm not so sure how to submit a new patch for the PR
> in an email in such a way that it appears properly formatted in the
> PR.
>
> Regards,
>
> Kimmo Paasiala

 PR updated with the new patch.
>>>
>>> Your patch applied cleanly, but it's not working or I am doing something
>>> wrong.
>>>
>>> root@freebsd:~ # uname -a
>>> FreeBSD freebsd 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #1 r244567: Fri
>>> Dec 21 23:57:28 CET 2012 root@freebsd:/usr/obj/usr/src/sys/GENERIC
>>> amd64
>>>
>>> root@freebsd:~ # grep -Ev '^[[:space:]]*#|^$' /etc/rc.conf
>>> hostname="freebsd"
>>> ifconfig_em0="up"
>>> ipv4_addrs_em0="192.168.168.20-24/24"
>>> defaultrouter="192.168.168.1"
>>> ipv6_activate_all_interfaces="YES"
>>> ipv6_addrs_em0="2001:6a0:1cb::1-6/64"
>>> ipv6_defaultrouter="2001:6a0:1cb::"
>>> sshd_enable="YES"
>>> dumpdev="NO"
>>> named_enable="YES"
>>>
>>> root@freebsd:~ # ifconfig
>>> em0: flags=8843 metric 0 mtu 1500
>>> options=9b
>>> ether 08:00:27:02:83:71
>>> inet6 fe80::a00:27ff:fe02:8371%em0 prefixlen 64 scopeid 0x1
>>> inet 192.168.168.20 netmask 0xff00 broadcast 192.168.168.255
>>> inet 192.168.168.21 netmask 0x broadcast 192.168.168.21
>>> inet 192.168.168.22 netmask 0x broadcast 192.168.168.22
>>> inet 192.168.168.23 netmask 0x broadcast 192.168.168.23
>>> inet 192.168.168.24 netmask 0x broadcast 192.168.168.24
>>> nd6 options=21
>>> media: Ethernet autoselect (1000baseT )
>>> status: active
>>> lo0: flags=8049 metric 0 mtu 16384
>>> options=63
>>> inet6 ::1 prefixlen 128
>>> inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
>>> inet 127.0.0.1 netmask 0xff00
>>> nd6 options=21
>>>
>>> --
>>> best regards,
>>> Lukasz Wasikowski
>>
>> You need to first add a single ipv6 address using the
>> ifconfig_em0_ipv6 -syntax.
>>
>> ifconfig_em0_ipv6="2001:6a0:1cb::1/64"
>>
>> And then this should add the rest of the addresses
>>
>> ipv6_addrs_em0="2001:6a0:1cb::2-6/64"
>>
>> It looks like the reason for the difference to ipv4_addrs_IF is that
>> the "alias" parameter for ifconfig(8) operates differently for IPv6
>> addresses, the first address of an interface can't be added with
>> "alias", for IPv4 it does not care. I'll have to dig deeper but that's
>> what the problem seems to be.
>>
>> -Kimmo
>
> The 'alias' parameter of ifconfig(8) is not the problem on the first
> ipv6 address, I have verified that. However, there's probably
> something in network.subr or /etc/rc.d/netif that I have overlooked
> and causes my code to be skipped if there's no ifconfig_IF_ipv6
> variable defined in rc.conf(5).
>
> -Kimmo

Yeah, this is problem in network.subr. An interface is not recognized
as IPv6 capable if the interface is not in "ipv6_network_interfaces"
and there's no "ifconfig_IF_ipv6" in rc.conf(5), bummer. For IPv4 it
"just works" because the interface is always assumed to be IPv4
capable.

-Kimmo
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org

Re: ipv6_addrs_IF aliases in rc.conf(5)

2012-12-21 Thread Kimmo Paasiala
On Sat, Dec 22, 2012 at 3:19 AM, Kimmo Paasiala  wrote:
> On Sat, Dec 22, 2012 at 1:38 AM, Łukasz Wąsikowski
>  wrote:
>> W dniu 2012-12-21 13:23, Kimmo Paasiala pisze:
>>> On Fri, Dec 21, 2012 at 5:43 AM, Kimmo Paasiala  wrote:
 On Thu, Dec 20, 2012 at 3:27 PM, Jilles Tjoelker  wrote:
> On Thu, Dec 20, 2012 at 01:04:34PM +0200, Kimmo Paasiala wrote:
>> A question related to this for those who have been doing work on the
>> rc(8) scripts. Can I assume that /usr/bin is available when
>> network.subr functions are used? Doing calculations on hexadecimal
>> numbers is going to be very awkward if I can't use for example bc(1).
>
> You cannot assume that /usr/bin is available when setting up the
> network. It may be that /usr is mounted via NFS.
>
> You can use hexadecimal numbers (prefixed with 0x) in $((...))
> expressions. In FreeBSD 9.0 or newer, sh has a printf builtin you can
> use; in older versions you can use hexdigit and hexprint from
> network.subr.
>
> --
> Jilles Tjoelker

 Thanks, I've rewitten my patch to support ranges. It is attached in
 this message.

 Again it's against a very recent 9-STABLE, I still haven't found time
 to see if it applies to CURRENT.

 It does allow you to do crazy stuff like

 ipv6_addrs_re0="2001:db8::::1-/64"

 However I didn't find anything to limit the number of aliases in the
 ipv4 version of the function either.

 Please test it :)


 Then a question about the PR
 (http://www.freebsd.org/cgi/query-pr.cgi?pr=174225) I wrote, how can I
 attach this new patch to it? The submit follow up -button fires up my
 email client and I'm not so sure how to submit a new patch for the PR
 in an email in such a way that it appears properly formatted in the
 PR.

 Regards,

 Kimmo Paasiala
>>>
>>> PR updated with the new patch.
>>
>> Your patch applied cleanly, but it's not working or I am doing something
>> wrong.
>>
>> root@freebsd:~ # uname -a
>> FreeBSD freebsd 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #1 r244567: Fri
>> Dec 21 23:57:28 CET 2012 root@freebsd:/usr/obj/usr/src/sys/GENERIC
>> amd64
>>
>> root@freebsd:~ # grep -Ev '^[[:space:]]*#|^$' /etc/rc.conf
>> hostname="freebsd"
>> ifconfig_em0="up"
>> ipv4_addrs_em0="192.168.168.20-24/24"
>> defaultrouter="192.168.168.1"
>> ipv6_activate_all_interfaces="YES"
>> ipv6_addrs_em0="2001:6a0:1cb::1-6/64"
>> ipv6_defaultrouter="2001:6a0:1cb::"
>> sshd_enable="YES"
>> dumpdev="NO"
>> named_enable="YES"
>>
>> root@freebsd:~ # ifconfig
>> em0: flags=8843 metric 0 mtu 1500
>> options=9b
>> ether 08:00:27:02:83:71
>> inet6 fe80::a00:27ff:fe02:8371%em0 prefixlen 64 scopeid 0x1
>> inet 192.168.168.20 netmask 0xff00 broadcast 192.168.168.255
>> inet 192.168.168.21 netmask 0x broadcast 192.168.168.21
>> inet 192.168.168.22 netmask 0x broadcast 192.168.168.22
>> inet 192.168.168.23 netmask 0x broadcast 192.168.168.23
>> inet 192.168.168.24 netmask 0x broadcast 192.168.168.24
>> nd6 options=21
>> media: Ethernet autoselect (1000baseT )
>> status: active
>> lo0: flags=8049 metric 0 mtu 16384
>> options=63
>> inet6 ::1 prefixlen 128
>> inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
>> inet 127.0.0.1 netmask 0xff00
>> nd6 options=21
>>
>> --
>> best regards,
>> Lukasz Wasikowski
>
> You need to first add a single ipv6 address using the
> ifconfig_em0_ipv6 -syntax.
>
> ifconfig_em0_ipv6="2001:6a0:1cb::1/64"
>
> And then this should add the rest of the addresses
>
> ipv6_addrs_em0="2001:6a0:1cb::2-6/64"
>
> It looks like the reason for the difference to ipv4_addrs_IF is that
> the "alias" parameter for ifconfig(8) operates differently for IPv6
> addresses, the first address of an interface can't be added with
> "alias", for IPv4 it does not care. I'll have to dig deeper but that's
> what the problem seems to be.
>
> -Kimmo

The 'alias' parameter of ifconfig(8) is not the problem on the first
ipv6 address, I have verified that. However, there's probably
something in network.subr or /etc/rc.d/netif that I have overlooked
and causes my code to be skipped if there's no ifconfig_IF_ipv6
variable defined in rc.conf(5).

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

Re: ipv6_addrs_IF aliases in rc.conf(5)

2012-12-21 Thread Kimmo Paasiala
On Sat, Dec 22, 2012 at 1:38 AM, Łukasz Wąsikowski
 wrote:
> W dniu 2012-12-21 13:23, Kimmo Paasiala pisze:
>> On Fri, Dec 21, 2012 at 5:43 AM, Kimmo Paasiala  wrote:
>>> On Thu, Dec 20, 2012 at 3:27 PM, Jilles Tjoelker  wrote:
 On Thu, Dec 20, 2012 at 01:04:34PM +0200, Kimmo Paasiala wrote:
> A question related to this for those who have been doing work on the
> rc(8) scripts. Can I assume that /usr/bin is available when
> network.subr functions are used? Doing calculations on hexadecimal
> numbers is going to be very awkward if I can't use for example bc(1).

 You cannot assume that /usr/bin is available when setting up the
 network. It may be that /usr is mounted via NFS.

 You can use hexadecimal numbers (prefixed with 0x) in $((...))
 expressions. In FreeBSD 9.0 or newer, sh has a printf builtin you can
 use; in older versions you can use hexdigit and hexprint from
 network.subr.

 --
 Jilles Tjoelker
>>>
>>> Thanks, I've rewitten my patch to support ranges. It is attached in
>>> this message.
>>>
>>> Again it's against a very recent 9-STABLE, I still haven't found time
>>> to see if it applies to CURRENT.
>>>
>>> It does allow you to do crazy stuff like
>>>
>>> ipv6_addrs_re0="2001:db8::::1-/64"
>>>
>>> However I didn't find anything to limit the number of aliases in the
>>> ipv4 version of the function either.
>>>
>>> Please test it :)
>>>
>>>
>>> Then a question about the PR
>>> (http://www.freebsd.org/cgi/query-pr.cgi?pr=174225) I wrote, how can I
>>> attach this new patch to it? The submit follow up -button fires up my
>>> email client and I'm not so sure how to submit a new patch for the PR
>>> in an email in such a way that it appears properly formatted in the
>>> PR.
>>>
>>> Regards,
>>>
>>> Kimmo Paasiala
>>
>> PR updated with the new patch.
>
> Your patch applied cleanly, but it's not working or I am doing something
> wrong.
>
> root@freebsd:~ # uname -a
> FreeBSD freebsd 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #1 r244567: Fri
> Dec 21 23:57:28 CET 2012 root@freebsd:/usr/obj/usr/src/sys/GENERIC
> amd64
>
> root@freebsd:~ # grep -Ev '^[[:space:]]*#|^$' /etc/rc.conf
> hostname="freebsd"
> ifconfig_em0="up"
> ipv4_addrs_em0="192.168.168.20-24/24"
> defaultrouter="192.168.168.1"
> ipv6_activate_all_interfaces="YES"
> ipv6_addrs_em0="2001:6a0:1cb::1-6/64"
> ipv6_defaultrouter="2001:6a0:1cb::"
> sshd_enable="YES"
> dumpdev="NO"
> named_enable="YES"
>
> root@freebsd:~ # ifconfig
> em0: flags=8843 metric 0 mtu 1500
> options=9b
> ether 08:00:27:02:83:71
> inet6 fe80::a00:27ff:fe02:8371%em0 prefixlen 64 scopeid 0x1
> inet 192.168.168.20 netmask 0xff00 broadcast 192.168.168.255
> inet 192.168.168.21 netmask 0x broadcast 192.168.168.21
> inet 192.168.168.22 netmask 0x broadcast 192.168.168.22
> inet 192.168.168.23 netmask 0x broadcast 192.168.168.23
> inet 192.168.168.24 netmask 0x broadcast 192.168.168.24
> nd6 options=21
> media: Ethernet autoselect (1000baseT )
> status: active
> lo0: flags=8049 metric 0 mtu 16384
> options=63
> inet6 ::1 prefixlen 128
> inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
> inet 127.0.0.1 netmask 0xff00
> nd6 options=21
>
> --
> best regards,
> Lukasz Wasikowski

You need to first add a single ipv6 address using the
ifconfig_em0_ipv6 -syntax.

ifconfig_em0_ipv6="2001:6a0:1cb::1/64"

And then this should add the rest of the addresses

ipv6_addrs_em0="2001:6a0:1cb::2-6/64"

It looks like the reason for the difference to ipv4_addrs_IF is that
the "alias" parameter for ifconfig(8) operates differently for IPv6
addresses, the first address of an interface can't be added with
"alias", for IPv4 it does not care. I'll have to dig deeper but that's
what the problem seems to be.

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

Re: ipv6_addrs_IF aliases in rc.conf(5)

2012-12-21 Thread Łukasz Wąsikowski
W dniu 2012-12-21 13:23, Kimmo Paasiala pisze:
> On Fri, Dec 21, 2012 at 5:43 AM, Kimmo Paasiala  wrote:
>> On Thu, Dec 20, 2012 at 3:27 PM, Jilles Tjoelker  wrote:
>>> On Thu, Dec 20, 2012 at 01:04:34PM +0200, Kimmo Paasiala wrote:
 A question related to this for those who have been doing work on the
 rc(8) scripts. Can I assume that /usr/bin is available when
 network.subr functions are used? Doing calculations on hexadecimal
 numbers is going to be very awkward if I can't use for example bc(1).
>>>
>>> You cannot assume that /usr/bin is available when setting up the
>>> network. It may be that /usr is mounted via NFS.
>>>
>>> You can use hexadecimal numbers (prefixed with 0x) in $((...))
>>> expressions. In FreeBSD 9.0 or newer, sh has a printf builtin you can
>>> use; in older versions you can use hexdigit and hexprint from
>>> network.subr.
>>>
>>> --
>>> Jilles Tjoelker
>>
>> Thanks, I've rewitten my patch to support ranges. It is attached in
>> this message.
>>
>> Again it's against a very recent 9-STABLE, I still haven't found time
>> to see if it applies to CURRENT.
>>
>> It does allow you to do crazy stuff like
>>
>> ipv6_addrs_re0="2001:db8::::1-/64"
>>
>> However I didn't find anything to limit the number of aliases in the
>> ipv4 version of the function either.
>>
>> Please test it :)
>>
>>
>> Then a question about the PR
>> (http://www.freebsd.org/cgi/query-pr.cgi?pr=174225) I wrote, how can I
>> attach this new patch to it? The submit follow up -button fires up my
>> email client and I'm not so sure how to submit a new patch for the PR
>> in an email in such a way that it appears properly formatted in the
>> PR.
>>
>> Regards,
>>
>> Kimmo Paasiala
> 
> PR updated with the new patch.

Your patch applied cleanly, but it's not working or I am doing something
wrong.

root@freebsd:~ # uname -a
FreeBSD freebsd 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #1 r244567: Fri
Dec 21 23:57:28 CET 2012 root@freebsd:/usr/obj/usr/src/sys/GENERIC
amd64

root@freebsd:~ # grep -Ev '^[[:space:]]*#|^$' /etc/rc.conf
hostname="freebsd"
ifconfig_em0="up"
ipv4_addrs_em0="192.168.168.20-24/24"
defaultrouter="192.168.168.1"
ipv6_activate_all_interfaces="YES"
ipv6_addrs_em0="2001:6a0:1cb::1-6/64"
ipv6_defaultrouter="2001:6a0:1cb::"
sshd_enable="YES"
dumpdev="NO"
named_enable="YES"

root@freebsd:~ # ifconfig
em0: flags=8843 metric 0 mtu 1500
options=9b
ether 08:00:27:02:83:71
inet6 fe80::a00:27ff:fe02:8371%em0 prefixlen 64 scopeid 0x1
inet 192.168.168.20 netmask 0xff00 broadcast 192.168.168.255
inet 192.168.168.21 netmask 0x broadcast 192.168.168.21
inet 192.168.168.22 netmask 0x broadcast 192.168.168.22
inet 192.168.168.23 netmask 0x broadcast 192.168.168.23
inet 192.168.168.24 netmask 0x broadcast 192.168.168.24
nd6 options=21
media: Ethernet autoselect (1000baseT )
status: active
lo0: flags=8049 metric 0 mtu 16384
options=63
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
inet 127.0.0.1 netmask 0xff00
nd6 options=21

-- 
best regards,
Lukasz Wasikowski
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: ipv6_addrs_IF aliases in rc.conf(5)

2012-12-21 Thread Kimmo Paasiala
On Fri, Dec 21, 2012 at 5:43 AM, Kimmo Paasiala  wrote:
> On Thu, Dec 20, 2012 at 3:27 PM, Jilles Tjoelker  wrote:
>> On Thu, Dec 20, 2012 at 01:04:34PM +0200, Kimmo Paasiala wrote:
>>> A question related to this for those who have been doing work on the
>>> rc(8) scripts. Can I assume that /usr/bin is available when
>>> network.subr functions are used? Doing calculations on hexadecimal
>>> numbers is going to be very awkward if I can't use for example bc(1).
>>
>> You cannot assume that /usr/bin is available when setting up the
>> network. It may be that /usr is mounted via NFS.
>>
>> You can use hexadecimal numbers (prefixed with 0x) in $((...))
>> expressions. In FreeBSD 9.0 or newer, sh has a printf builtin you can
>> use; in older versions you can use hexdigit and hexprint from
>> network.subr.
>>
>> --
>> Jilles Tjoelker
>
> Thanks, I've rewitten my patch to support ranges. It is attached in
> this message.
>
> Again it's against a very recent 9-STABLE, I still haven't found time
> to see if it applies to CURRENT.
>
> It does allow you to do crazy stuff like
>
> ipv6_addrs_re0="2001:db8::::1-/64"
>
> However I didn't find anything to limit the number of aliases in the
> ipv4 version of the function either.
>
> Please test it :)
>
>
> Then a question about the PR
> (http://www.freebsd.org/cgi/query-pr.cgi?pr=174225) I wrote, how can I
> attach this new patch to it? The submit follow up -button fires up my
> email client and I'm not so sure how to submit a new patch for the PR
> in an email in such a way that it appears properly formatted in the
> PR.
>
> Regards,
>
> Kimmo Paasiala

PR updated with the new patch.

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


Re: ipv6_addrs_IF aliases in rc.conf(5)

2012-12-20 Thread Kimmo Paasiala
On Thu, Dec 20, 2012 at 3:27 PM, Jilles Tjoelker  wrote:
> On Thu, Dec 20, 2012 at 01:04:34PM +0200, Kimmo Paasiala wrote:
>> A question related to this for those who have been doing work on the
>> rc(8) scripts. Can I assume that /usr/bin is available when
>> network.subr functions are used? Doing calculations on hexadecimal
>> numbers is going to be very awkward if I can't use for example bc(1).
>
> You cannot assume that /usr/bin is available when setting up the
> network. It may be that /usr is mounted via NFS.
>
> You can use hexadecimal numbers (prefixed with 0x) in $((...))
> expressions. In FreeBSD 9.0 or newer, sh has a printf builtin you can
> use; in older versions you can use hexdigit and hexprint from
> network.subr.
>
> --
> Jilles Tjoelker

Thanks, I've rewitten my patch to support ranges. It is attached in
this message.

Again it's against a very recent 9-STABLE, I still haven't found time
to see if it applies to CURRENT.

It does allow you to do crazy stuff like

ipv6_addrs_re0="2001:db8::::1-/64"

However I didn't find anything to limit the number of aliases in the
ipv4 version of the function either.

Please test it :)


Then a question about the PR
(http://www.freebsd.org/cgi/query-pr.cgi?pr=174225) I wrote, how can I
attach this new patch to it? The submit follow up -button fires up my
email client and I'm not so sure how to submit a new patch for the PR
in an email in such a way that it appears properly formatted in the
PR.

Regards,

Kimmo Paasiala
Index: network.subr
===
--- network.subr(revision 244523)
+++ network.subr(working copy)
@@ -562,6 +562,7 @@
fi
 
ifalias_up ${_if} inet6 && _ret=0
+   ipv6_addrs_common ${_if} alias && _ret=0
ipv6_prefix_hostid_addr_common ${_if} alias && _ret=0
ipv6_accept_rtadv_up ${_if} && _ret=0
 
@@ -684,6 +685,49 @@
return $_ret
 }
 
+
+ipv6_addrs_common()
+{
+   local _ret _if _action _ip6prefix _ip6prefixes
+   local _ip6addr _prefixlen
+   local _range _ip6net _ip6low _ip6high
+   _ret=1
+   _if=$1
+   _action=$2
+
+# get the prefixes from ipv6_addrs_IF variable
+   _ip6prefixes=`get_if_var $_if ipv6_addrs_IF`
+   for _ip6prefix in ${_ip6prefixes}; do
+   _ip6addr=${_ip6prefix%%/*}
+   _prefixlen=${_ip6prefix##*/}
+   _range=${_ip6addr##*:}
+   _ip6net=${_ip6addr%:*}
+   _ip6low=${_range%-*}
+   _ip6high=${_range#*-}
+
+# If deleting an alias, set _prefixlen to null string.
+   if [ "${_action}" = "-alias" ]; then
+   _prefixlen=""
+   else
+   _prefixlen="prefixlen $_prefixlen"
+   fi
+
+   _ip6high=$(("0x${_ip6high}"))
+   _ip6count=$(("0x${_ip6low}"))
+   while [ "${_ip6count}" -le "${_ip6high}"  ]; do
+# Re-uses the _ip6addr variable from above
+   _ip6addr=$(printf "%x" "${_ip6count}")
+   eval "ifconfig ${_if} inet6 ${_ip6net}:${_ip6addr} 
${_prefixlen} ${_action}"
+   _ip6count=$((${_ip6count}+1))
+   _ret=0
+   done
+   done
+
+   return $_ret
+}
+
+
+
 # ifalias_up if af
 #  Configure aliases for network interface $if.
 #  It returns 0 if at least one alias was configured or
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"

Re: ipv6_addrs_IF aliases in rc.conf(5)

2012-12-20 Thread Jilles Tjoelker
On Thu, Dec 20, 2012 at 01:04:34PM +0200, Kimmo Paasiala wrote:
> A question related to this for those who have been doing work on the
> rc(8) scripts. Can I assume that /usr/bin is available when
> network.subr functions are used? Doing calculations on hexadecimal
> numbers is going to be very awkward if I can't use for example bc(1).

You cannot assume that /usr/bin is available when setting up the
network. It may be that /usr is mounted via NFS.

You can use hexadecimal numbers (prefixed with 0x) in $((...))
expressions. In FreeBSD 9.0 or newer, sh has a printf builtin you can
use; in older versions you can use hexdigit and hexprint from
network.subr.

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


Re: ipv6_addrs_IF aliases in rc.conf(5)

2012-12-20 Thread Kimmo Paasiala
On Wed, Dec 19, 2012 at 11:47 PM, Kimmo Paasiala  wrote:
> On Wed, Dec 19, 2012 at 3:46 PM, Łukasz Wąsikowski
>  wrote:
>> W dniu 2012-12-19 07:14, Kimmo Paasiala pisze:
>>
 I wrote a small patch for /etc/network.subr to add support for
 ipv6_addrs_IF aliases in rc.conf(5) to match the already existing
 ipv4_addrs_IF aliases for ipv4 addresses. With this patch the ipv6
 aliases can be written like:
>>
>> [...]
>>
>>> Did anyone try my patch? I thought it would be nice to have the
>>> ipv6_addrs_IF syntax supported to complement the existing
>>> ipv4_addrs_IF alias syntax.
>>
>> Can I use range syntax in it like in ipv4? I mean something like:
>>
>> ipv4_addrs_lagg0="x.x.x.10-30/22"
>>
>> That feature would be very nice to have for ipv6.
>>
>> --
>> best regards,
>> Lukasz Wasikowski
>
> I have to admit I overlooked the possibility to use ranges like that.
> It doesn't look too hard to add that feature as well for ipv6 aliases
> using the existing code for ipv4 aliases. I'll prepare a new patch and
> update the PR when I have it working.
>
> -Kimmo

A question related to this for those who have been doing work on the
rc(8) scripts. Can I assume that /usr/bin is available when
network.subr functions are used? Doing calculations on hexadecimal
numbers is going to be very awkward if I can't use for example bc(1).

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

Re: ipv6_addrs_IF aliases in rc.conf(5)

2012-12-19 Thread Kimmo Paasiala
On Wed, Dec 19, 2012 at 3:46 PM, Łukasz Wąsikowski
 wrote:
> W dniu 2012-12-19 07:14, Kimmo Paasiala pisze:
>
>>> I wrote a small patch for /etc/network.subr to add support for
>>> ipv6_addrs_IF aliases in rc.conf(5) to match the already existing
>>> ipv4_addrs_IF aliases for ipv4 addresses. With this patch the ipv6
>>> aliases can be written like:
>
> [...]
>
>> Did anyone try my patch? I thought it would be nice to have the
>> ipv6_addrs_IF syntax supported to complement the existing
>> ipv4_addrs_IF alias syntax.
>
> Can I use range syntax in it like in ipv4? I mean something like:
>
> ipv4_addrs_lagg0="x.x.x.10-30/22"
>
> That feature would be very nice to have for ipv6.
>
> --
> best regards,
> Lukasz Wasikowski

I have to admit I overlooked the possibility to use ranges like that.
It doesn't look too hard to add that feature as well for ipv6 aliases
using the existing code for ipv4 aliases. I'll prepare a new patch and
update the PR when I have it working.

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

Re: ipv6_addrs_IF aliases in rc.conf(5)

2012-12-19 Thread Łukasz Wąsikowski
W dniu 2012-12-19 07:14, Kimmo Paasiala pisze:

>> I wrote a small patch for /etc/network.subr to add support for
>> ipv6_addrs_IF aliases in rc.conf(5) to match the already existing
>> ipv4_addrs_IF aliases for ipv4 addresses. With this patch the ipv6
>> aliases can be written like:

[...]

> Did anyone try my patch? I thought it would be nice to have the
> ipv6_addrs_IF syntax supported to complement the existing
> ipv4_addrs_IF alias syntax.

Can I use range syntax in it like in ipv4? I mean something like:

ipv4_addrs_lagg0="x.x.x.10-30/22"

That feature would be very nice to have for ipv6.

-- 
best regards,
Lukasz Wasikowski
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: ipv6_addrs_IF aliases in rc.conf(5)

2012-12-18 Thread Kimmo Paasiala
On Fri, Dec 7, 2012 at 12:42 PM, Kimmo Paasiala  wrote:
> Hello,
>
> I wrote a small patch for /etc/network.subr to add support for
> ipv6_addrs_IF aliases in rc.conf(5) to match the already existing
> ipv4_addrs_IF aliases for ipv4 addresses. With this patch the ipv6
> aliases can be written like:
>
> ipv6_addrs_re0="2001:db8::::1/64 2001:db8::::2/64"
>
> Only this syntax is supported, it's not possible to use the "prefixlen
> nn" syntax in the list.
>
> The patch is against a recent 9-STABLE, last changed rev of
> network.subr on my SVN checkout is r242187. I don't have a CURRENT
> system to test if it applies to CURRENT as well.
>
> The patch can be found attached to a PR I sent:
>
> http://www.freebsd.org/cgi/query-pr.cgi?pr=174225
>
>
> I wrote this patch inspired by a question on the FreeBSD forums:
>
> http://forums.freebsd.org/showthread.php?t=36136
>
> Please test and report if it works for you :)
>
>
> Regards,
> Kimmo Paasiala

Hello,

Did anyone try my patch? I thought it would be nice to have the
ipv6_addrs_IF syntax supported to complement the existing
ipv4_addrs_IF alias syntax.

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