Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Oct 2011 00:02:51 +0400
From:      Sergey Kandaurov <pluknet@gmail.com>
To:        Devin Teske <devin.teske@fisglobal.com>
Cc:        Dave Robison <Dave.Robison@fisglobal.com>, FreeBSD amd64 <freebsd-amd64@freebsd.org>
Subject:   Re: 32-bit route(8) on amd64 host and jails
Message-ID:  <CAE-mSO%2Bk07E2ocxQLngNhKwE9B9gy8yH16kuBsVwShAmewU0Ew@mail.gmail.com>
In-Reply-To: <102d01cc8d06$0fd26a70$2f773f50$@fisglobal.com>
References:  <714EF3C9-33B0-4EF5-B52C-1E95F7F432F9@fisglobal.com> <CAE-mSO%2B4KKWeC6-Z3UAi70bxxEUJL5gUD0phEfNzzkDMXrA3pg@mail.gmail.com> <CAE-mSO%2B_hc%2BGJHYUyX6dBS6NckV=iiHRrGMYbc=AxQeqKwK2Zg@mail.gmail.com> <102d01cc8d06$0fd26a70$2f773f50$@fisglobal.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 17 October 2011 23:50, Devin Teske <devin.teske@fisglobal.com> wrote:
>> -----Original Message-----
>> From: Sergey Kandaurov [mailto:pluknet@gmail.com]
>> Sent: Friday, October 14, 2011 2:40 PM
>> To: Devin Teske
>> Cc: FreeBSD amd64; Dave Robison
>> Subject: Re: 32-bit route(8) on amd64 host and jails
>>
>> On 21 September 2011 16:47, Sergey Kandaurov <pluknet@gmail.com> wrote:
>> > On 21 September 2011 06:40, Devin Teske <devin.teske@fisglobal.com> wr=
ote:
>> >> I'm noticing that a 32-bit route(8) shows strange behaviour while run=
ning
>> under an amd64 kernel (regardless of whether in the base-host -- utilizi=
ng
>> /usr/lib32/libc.so.7 -- or in a jail and/or vimage -- 32-bit in nature;
> results are
>> same).
>> >>
>> >> Executable runs fine, but you can't (a) set the default route or (b) =
view
> the
>> default route (after successfully setting it with the amd64 build, of co=
urse).
>> >>
>> >> ASIDE: This is under 8.1-RELEASE.
>> >>
>> >> When attempting to set the default route, you get the following...
>> >>
>> >> root@kps0a / # route add -net default 10.10.125.99
>> >> route: writing to routing socket: Invalid argument add net default:
>> >> gateway 10.10.125.99: Invalid argument
>> >>
>> >> Meanwhile, using the amd64 version, no issues.
>> >>
>> >> When attempting to view the default route, you get the following...
>> >>
>> >> root@kps0a / # route -n get default
>> >> =A0 route to: default
>> >> destination: default
>> >> =A0 =A0 =A0 mask: default
>> >> =A0 =A0gateway: default
>> >> =A0 =A0 =A0flags: <UP,GATEWAY,DONE,STATIC>
>> >> =A0recvpipe =A0sendpipe =A0ssthresh =A0rtt,msec =A0 =A0mtu =A0 =A0 =
=A0 =A0weight
>> >> expire
>> >> =A0 =A0 =A0 0 =A0 =A0 =A0 =A0 0 =A0 =A0 =A0 =A0 0 =A0 =A0 =A0 =A0 0 =
=A0 =A0 =A0 =A0 0 =A0 =A0 =A0 =A0 0
>> >> -1316570637
>> >>
>> >> It's the "gateway: default" that's out of place.
>> >>
>> >
>> > Currently, FreeBSD has a poor shape of rtsocket freebsd32
>> > compatibility, AFAIK only sysctl layer (sysctl_rtsock) is aware of it.
>> > That means when a 32bit app writes some data to a routing socket,
>> > kernel expects to receive it in the native ABI, and it doesn't work.
>>
>> Can you please try this preliminary patch and report back?
>> You only need to rebuild kernel and reboot with the attached patch to en=
able
> use
>> of e.g. 32-bit route(8) command on amd64 kernel.
>> No any userland utility needs to rebuild to enable the compatibility.
>> Tested on 8.2 amd64 only with route get default and route delete/add.
>>
>
> First-off, let me say thank you. The patch works as-expected (for amd64).

Great, thanks!
I will continue to clean up it to a committable state.

>
> ASIDE: attached is a patch that applies cleanly to RELENG_8_1 -- in case =
anyone
> is interested.
>
> However -- as you probably already know -- the patch should not be applie=
d to
> i386, else the following compiler error arises:
>
> #################### BEGIN COMPILER OUTPUT ####################
> cc -c -O -pipe =A0-std=3Dc99 -g -Wall -Wredundant-decls -Wnested-externs
> -Wstrict-prototypes =A0-Wmissing-prototypes -Wpointer-arith -Winline -Wca=
st-qual
> -Wundef -Wno-pointer-sign -fformat-extensions -nostdinc =A0-I. -I../../..
> -I../../../contrib/altq -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include
> opt_global.h -fno-common -finline-limit=3D8000 --param inline-unit-growth=
=3D100
> --param large-function-growth=3D1000 =A0-mno-align-long-strings
> -mpreferred-stack-boundary=3D2 =A0-mno-mmx -mno-3dnow -mno-sse -mno-sse2 =
-mno-sse3
> -ffreestanding -fstack-protector -Werror =A0../../../net/rtsock.c
> ../../../net/rtsock.c: In function 'route_output':
> ../../../net/rtsock.c:1136: error: 'rp' undeclared (first use in this fun=
ction)
> ../../../net/rtsock.c:1136: error: (Each undeclared identifier is reporte=
d only
> once
> ../../../net/rtsock.c:1136: error: for each function it appears in.)
> ../../../net/rtsock.c: At top level:
> ../../../net/rtsock.c:1156: error: expected identifier or '(' before 'ret=
urn'
> ../../../net/rtsock.c:1158: error: expected identifier or '(' before '}' =
token
> *** Error code 1
> #################### END COMPILER OUTPUT ####################
>
> Again, thank you for the patch!
> --
> Devin
>
> P.S. +1 vote to get this cleaned-up and committed HEAD and then MFC'd to
> RELENG_8

I hope to do that in some not so far future.

>
> P.P.S. Any chance there's a patch in the works to allow 32-bit "netstat -=
nr"
> under adm64 kernel? Currently comes back with "no name list".

Yeah, this is a known issue to my regret.
That will be a different one good project to make this work.

>
> ______________________________________________________________________
> The information contained in this message is proprietary and/or confident=
ial. If you are not the intended recipient, please: (i) delete the message =
and all copies; (ii) do not disclose, distribute or use the message in any =
manner; and (iii) notify the sender immediately. In addition, please be awa=
re that any message addressed to our domain is subject to archiving and rev=
iew by persons other than the intended recipient. Thank you.
>



--=20
wbr,
pluknet



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAE-mSO%2Bk07E2ocxQLngNhKwE9B9gy8yH16kuBsVwShAmewU0Ew>