Summary: | sys-apps/openrc: convert hex netmasks to decimal for freebsd | ||
---|---|---|---|
Product: | Gentoo Hosted Projects | Reporter: | Dmitri Bogomolov <4glitch> |
Component: | OpenRC | Assignee: | OpenRC Team <openrc> |
Status: | RESOLVED FIXED | ||
Severity: | enhancement | CC: | bsd+disabled |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | FreeBSD | ||
Whiteboard: | openrc:oldnet | ||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 439098 | ||
Attachments: | sample patch for openrc-0.11.8 |
Description
Dmitri Bogomolov
2013-03-04 13:35:06 UTC
(In reply to comment #0) > [: 0xff: bad number > [: 0xff: bad number > [: 0xff: bad number > [: 0xff: bad number > * received address 192.168.122.136/ > > Network connection works well. But here is definitely a portability issue. > Please tell me where I can find more information. > > I am unsure, maybe I should write to Roy Marples trac? It's openrc script bug. Netmask must be decimal number. However, FreeBSD returns hexadecimal number. Fails to numerical comparison in conditional branching, you have found a message is displayed. I'll attach a sample patch. NOTE, Please don't forget to etc-update ! FYI, ifconfig results on Linux) netmask 255.255.255.0 on FreeBSD) netmask 0xffffff00 Created attachment 341008 [details, diff]
sample patch for openrc-0.11.8
(In reply to comment #1) > (In reply to comment #0) > > [: 0xff: bad number > > [: 0xff: bad number > > [: 0xff: bad number > > [: 0xff: bad number > > * received address 192.168.122.136/ > > > > Network connection works well. But here is definitely a portability issue. > > Please tell me where I can find more information. > > > > I am unsure, maybe I should write to Roy Marples trac? > > It's openrc script bug. > > Netmask must be decimal number. > However, FreeBSD returns hexadecimal number. Where is the hex number coming from? I can apply the patch to OpenRC, but I would like to know where the hex number is from; that might need to be fixed to give us the expected return value. (In reply to comment #3) > Where is the hex number coming from? I can apply the patch to OpenRC, but I > would like to know where the hex number is from; that might need to be fixed > to give us the expected return value. The output of "ifconfig em0" is this: em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC> ether 52:54:00:fb:f7:a7 inet6 fe80::5054:ff:fefb:f7a7%em0 prefixlen 64 scopeid 0x2 inet 192.168.0.6 netmask 0xffffff00 broadcast 192.168.0.255 <snip> and from /lib/rc/net/ifconfig.sh: _get_inet_address() { local inet= address= n= netmask= rest= LC_ALL=C ifconfig "${IFACE}" | while read inet address n netmask rest; do if [ "${inet}" = "inet" ]; then echo "${address}/$(_netmask2cidr "${netmask}")" return 0 ... It calls "_netmask2cidr 0xffffff00" /etc/init.d/net.lo's _netmask2cidr() convert "0xffffff00" to "0xff.0xff.0xff.0x00" and passed to the patch lines. This is applied in commit f1ae896 and will be part of openrc-0.12. Thanks for the report. |