32-bit route(8) on amd64 host and jails

Devin Teske devin.teske at fisglobal.com
Mon Oct 17 19:50:27 UTC 2011


> -----Original Message-----
> From: Sergey Kandaurov [mailto:pluknet at 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 at gmail.com> wrote:
> > On 21 September 2011 06:40, Devin Teske <devin.teske at fisglobal.com> wrote:
> >> I'm noticing that a 32-bit route(8) shows strange behaviour while running
> under an amd64 kernel (regardless of whether in the base-host -- utilizing
> /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 course).
> >>
> >> ASIDE: This is under 8.1-RELEASE.
> >>
> >> When attempting to set the default route, you get the following...
> >>
> >> root at 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 at kps0a / # route -n get default
> >>   route to: default
> >> destination: default
> >>       mask: default
> >>    gateway: default
> >>      flags: <UP,GATEWAY,DONE,STATIC>
> >>  recvpipe  sendpipe  ssthresh  rtt,msec    mtu        weight
> >> expire
> >>       0         0         0         0         0         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 enable
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).

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 applied to
i386, else the following compiler error arises:

#################### BEGIN COMPILER OUTPUT ####################
cc -c -O -pipe  -std=c99 -g -Wall -Wredundant-decls -Wnested-externs
-Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual
-Wundef -Wno-pointer-sign -fformat-extensions -nostdinc  -I. -I../../..
-I../../../contrib/altq -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include
opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=100
--param large-function-growth=1000  -mno-align-long-strings
-mpreferred-stack-boundary=2  -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3
-ffreestanding -fstack-protector -Werror  ../../../net/rtsock.c
../../../net/rtsock.c: In function 'route_output':
../../../net/rtsock.c:1136: error: 'rp' undeclared (first use in this function)
../../../net/rtsock.c:1136: error: (Each undeclared identifier is reported 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 'return'
../../../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

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".

______________________________________________________________________
The information contained in this message is proprietary and/or confidential. 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 aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rtmsg32.RELENG_8_1-20111017.diff
Type: application/octet-stream
Size: 8396 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-amd64/attachments/20111017/e05c27d3/rtmsg32.RELENG_8_1-20111017.obj


More information about the freebsd-amd64 mailing list