Re: RTM_NEWNEIGH message for static ARP entry

2023-06-21 Thread Alexander Chernikov


On Wed, 21 Jun 2023, at 5:19 PM, Hartmut Brandt wrote:
> Hi,
> 
> when I set a static ARP entry I see an RTM_NEWNEIGH message on a netlink 
> socket as expected, but the ndm_state is NUD_INCOMPLETE. Should'nt this be 
> NUD_NOARP? At least this is what Linux returns.
Thanks for the report, I’ll take a look.
To me, NUD_REACHABLE | NUD_PERMANENT looks better suited for the particular 
case, but I’ll dive deeper tomorrow. Anyway NUD_INCOMPLETE is certainly wrong.
> 
> Cheers,
> Harti
> 
> 

/Alexander


Re: ifconfig dumps core and gdb uses an undefined symbol

2023-06-14 Thread Alexander Chernikov



> On 14 Jun 2023, at 11:35, Gary Jennejohn  wrote:
> 
> On Wed, 14 Jun 2023 11:05:31 +0100
> Alexander Chernikov  wrote:
> 
>>> On 14 Jun 2023, at 10:53, Gary Jennejohn  wrote:
>>> 
>>> On Wed, 14 Jun 2023 09:01:35 +
>>> Gary Jennejohn mailto:ga...@gmx.de>> wrote:
>>> 
>>>> On Wed, 14 Jun 2023 09:09:04 +0100
>>>> Alexander Chernikov  wrote:
>>>> 
>>>>>> On 14 Jun 2023, at 08:59, Gary Jennejohn  wrote:
>>>>> Hi Gary,
>>>>>> 
>>>>>> So, now I have a new problem with current.
>>>>>> 
>>>>>> I just now updated my current sources and ran buildworld and buildkernel,
>>>>>> since Gleb fixed the WITHOUT_PF problem.
>>>>>> 
>>>>>> After installing the new world and kernel I see that ifconfig is dumping
>>>>>> a core, apparently when it tries to show lo0, since re0 is correctly
>>>>>> shown:
>>>>>> 
>>>>>> ifconfig
>>>>>> re0: flags=8843 metric 0 mtu 
>>>>>> 4088 
>>>>>> options=82098
>>>>>> ether redacted
>>>>>> inet 192.168.178.XXX netmask 0xff00 broadcast 192.168.178.255
>>>>>> Segmentation fault (core dumped)
>>>>> Could you please try to narrow down the crashing command? e.g.
>>>>> Ifconfig lo0
>>>>> Ifconfig lo0 net
>>>>> Ifconfig lo0 inet6
>>>>> Could you try to rebuild ifconfig w/o netlink (e.g. set 
>>>>> WITHOUT_NETLINK=yes in the make.conf & make -C sbin/ifconfig clean all 
>>>>> install) and see if the new binary works?
>>>>> 
>>>> 
>>>> I already have WITHOUT_NETLINK=yes in my /etc/src.conf.
>>>> 
>>>> I didn't install ifconfig. I simply started it from the build directory.
>>>> 
>>>> ifconfig lo0 shows the settings for lo0 and then dumps core.
>>>> 
>>> 
>>> After your most recent changes "ifconfig re0" and "ifconfg lo0" don't
>>> result in any errors.  But "ifconfig" alone still results in a core
>>> dump, which per gdb is happening in the strlcpy() call at in_status_tunnel()
>>> in af_inet.c.
>> Indeed.
>> 
>> diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
>> index d30d3e1909ae..6a80ad5763b2 100644
>> --- a/sbin/ifconfig/ifconfig.c
>> +++ b/sbin/ifconfig/ifconfig.c
>> @@ -822,6 +822,7 @@ list_interfaces_ioctl(if_ctx *ctx)
>>continue;
>>if (!group_member(ifa->ifa_name, args->matchgroup, 
>> args->nogroup))
>>continue;
>> +   ctx->ifname = cp;
>>/*
>> * Are we just listing the interfaces?
>> */
>> 
>> Does this one fix the crash?
>>> 
> 
> YES!
Should be fixed by 52ff8883185a then.
Thank you for the report and sorry for the breakage!
> 
> --
> Gary Jennejohn
> 




Re: ifconfig dumps core and gdb uses an undefined symbol

2023-06-14 Thread Alexander Chernikov


> On 14 Jun 2023, at 10:53, Gary Jennejohn  wrote:
> 
> On Wed, 14 Jun 2023 09:01:35 +
> Gary Jennejohn mailto:ga...@gmx.de>> wrote:
> 
>> On Wed, 14 Jun 2023 09:09:04 +0100
>> Alexander Chernikov  wrote:
>> 
>>>> On 14 Jun 2023, at 08:59, Gary Jennejohn  wrote:
>>> Hi Gary,
>>>> 
>>>> So, now I have a new problem with current.
>>>> 
>>>> I just now updated my current sources and ran buildworld and buildkernel,
>>>> since Gleb fixed the WITHOUT_PF problem.
>>>> 
>>>> After installing the new world and kernel I see that ifconfig is dumping
>>>> a core, apparently when it tries to show lo0, since re0 is correctly
>>>> shown:
>>>> 
>>>> ifconfig
>>>> re0: flags=8843 metric 0 mtu 4088 
>>>> options=82098
>>>>  ether redacted
>>>>  inet 192.168.178.XXX netmask 0xff00 broadcast 192.168.178.255
>>>> Segmentation fault (core dumped)
>>> Could you please try to narrow down the crashing command? e.g.
>>> Ifconfig lo0
>>> Ifconfig lo0 net
>>> Ifconfig lo0 inet6
>>> Could you try to rebuild ifconfig w/o netlink (e.g. set WITHOUT_NETLINK=yes 
>>> in the make.conf & make -C sbin/ifconfig clean all install) and see if the 
>>> new binary works?
>>> 
>> 
>> I already have WITHOUT_NETLINK=yes in my /etc/src.conf.
>> 
>> I didn't install ifconfig. I simply started it from the build directory.
>> 
>> ifconfig lo0 shows the settings for lo0 and then dumps core.
>> 
> 
> After your most recent changes "ifconfig re0" and "ifconfg lo0" don't
> result in any errors.  But "ifconfig" alone still results in a core
> dump, which per gdb is happening in the strlcpy() call at in_status_tunnel()
> in af_inet.c.
Indeed.

diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index d30d3e1909ae..6a80ad5763b2 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -822,6 +822,7 @@ list_interfaces_ioctl(if_ctx *ctx)
continue;
if (!group_member(ifa->ifa_name, args->matchgroup, 
args->nogroup))
continue;
+   ctx->ifname = cp;
/*
 * Are we just listing the interfaces?
 */

Does this one fix the crash?
> 
> --
> Gary Jennejohn



Re: ifconfig dumps core and gdb uses an undefined symbol

2023-06-14 Thread Alexander Chernikov


> On 14 Jun 2023, at 10:01, Gary Jennejohn  wrote:
> 
> On Wed, 14 Jun 2023 09:09:04 +0100
> Alexander Chernikov mailto:melif...@freebsd.org>> 
> wrote:
> 
>>> On 14 Jun 2023, at 08:59, Gary Jennejohn  wrote:
>> Hi Gary,
>>> 
>>> So, now I have a new problem with current.
>>> 
>>> I just now updated my current sources and ran buildworld and buildkernel,
>>> since Gleb fixed the WITHOUT_PF problem.
>>> 
>>> After installing the new world and kernel I see that ifconfig is dumping
>>> a core, apparently when it tries to show lo0, since re0 is correctly
>>> shown:
>>> 
>>> ifconfig
>>> re0: flags=8843 metric 0 mtu 4088 
>>> options=82098
>>>  ether redacted
>>>  inet 192.168.178.XXX netmask 0xff00 broadcast 192.168.178.255
>>> Segmentation fault (core dumped)
>> Could you please try to narrow down the crashing command? e.g.
>> Ifconfig lo0
>> Ifconfig lo0 net
>> Ifconfig lo0 inet6
>> Could you try to rebuild ifconfig w/o netlink (e.g. set WITHOUT_NETLINK=yes 
>> in the make.conf & make -C sbin/ifconfig clean all install) and see if the 
>> new binary works?
>> 
> 
> I already have WITHOUT_NETLINK=yes in my /etc/src.conf.
> 
> I didn't install ifconfig. I simply started it from the build directory.
> 
> ifconfig lo0 shows the settings for lo0 and then dumps core.
> 
>>> 
>>> Unfortunately, I see this error message when I try to look at the core
>>> file with gdb:
>>> 
>>> gdb /sbin/ifconfig ifconfig.core
>>> ld-elf.so.1: Undefined symbol "rl_eof_found" referenced from COPY
>>> relocation in /usr/local/bin/gdb
>> Not a specialist here, but if you could build the binary with debug
>> (make DEBUG_FLAGS=-O0 -g3 sbin/ifconfig clean all install) & share the
>> binary & core with me, I could take a look on what?s happening.
>>> 
> 
> I compiled gbd under /usr/ports and it now works, although it's emitting
> some weird errors.
> 
> -O0 -g3 removes too much and gdb shows no useful information.
> 
> With just -g3 I get this output from gdb after running the newly compiled
> ifconfig:
> 
> Program terminated with signal SIGSEGV, Segmentation fault
> warning: Section `.reg-xstate/100294' in core file too small.
> #0  lagg_status (ctx=0x2f051660ba00) at /usr/src/sbin/ifconfig/iflagg.c:223
> 223 const int verbose = ctx->args->verbose;
> (gdb) bt
> #0  lagg_status (ctx=0x2f051660ba00) at /usr/src/sbin/ifconfig/iflagg.c:223
> #1  0x2efcf610ea55 in af_other_status (ctx=0x2f051660ba00)
>at /usr/src/sbin/ifconfig/ifconfig.c:964
> #2  status (args=0x2f051660ba70, ifa=0x2f051a2f2000, sdl=)
>at /usr/src/sbin/ifconfig/ifconfig.c:1788
> #3  list_interfaces_ioctl (args=0x2f051660ba70)
>at /usr/src/sbin/ifconfig/ifconfig.c:845
> #4  list_interfaces (args=0x2f051660ba70)
>at /usr/src/sbin/ifconfig/ifconfig.c:428
> #5  main (ac=, av=)
>at /usr/src/sbin/ifconfig/ifconfig.c:724
> (gdb)
> 
> I looked at ctx:
> 
> (gdb) p ctx
> $1 = (if_ctx *) 0x2f051660ba00
> (gdb) p/x *0x2f051660ba00
> $2 = 0x0 <==
> (gdb)
> 
> So, looks like the problem is in iflagg and ctx is NULL.
Ack. Does bbad5525fabf fix the issue?
> 
> --
> Gary Jennejohn



Re: ifconfig dumps core and gdb uses an undefined symbol

2023-06-14 Thread Alexander Chernikov


> On 14 Jun 2023, at 08:59, Gary Jennejohn  wrote:
Hi Gary,
> 
> So, now I have a new problem with current.
> 
> I just now updated my current sources and ran buildworld and buildkernel,
> since Gleb fixed the WITHOUT_PF problem.
> 
> After installing the new world and kernel I see that ifconfig is dumping
> a core, apparently when it tries to show lo0, since re0 is correctly
> shown:
> 
> ifconfig
> re0: flags=8843 metric 0 mtu 4088 
> options=82098
>   ether redacted
>   inet 192.168.178.XXX netmask 0xff00 broadcast 192.168.178.255
> Segmentation fault (core dumped)
Could you please try to narrow down the crashing command? e.g.
Ifconfig lo0
Ifconfig lo0 net
Ifconfig lo0 inet6
Could you try to rebuild ifconfig w/o netlink (e.g. set WITHOUT_NETLINK=yes in 
the make.conf & make -C sbin/ifconfig clean all install) and see if the new 
binary works?

> 
> Unfortunately, I see this error message when I try to look at the core
> file with gdb:
> 
> gdb /sbin/ifconfig ifconfig.core
> ld-elf.so.1: Undefined symbol "rl_eof_found" referenced from COPY
> relocation in /usr/local/bin/gdb
Not a specialist here, but if you could build the binary with debug (make 
DEBUG_FLAGS=“-O0 -g3” sbin/ifconfig clean all install) & share the binary & 
core with me, I could take a look on what’s happening.
> 
> pkg claims that my packages are all up to date.
> 
> Not exactly a fatal error, but still rather surprising.
> 
> --
> Gary Jennejohn
> 




Re: Error building kernel in current

2023-06-02 Thread Alexander Chernikov

On Fri, 2 Jun 2023, at 4:30 PM, Gary Jennejohn wrote:
> On Fri, 2 Jun 2023 09:59:40 +
> Gary Jennejohn  wrote:
> 
> > On Fri, 2 Jun 2023 09:56:44 +
> > Gary Jennejohn  wrote:
> >
> > > Error building kernel in current:
> > >
> > > --
> > > >>> stage 3.1: building everything
> > > --
> > > /usr/src/sys/netlink/route/iface.c:1315:22: error: use of undeclared
> > > identifier 'if_flags'
> > > if (error == 0 && !(if_flags & IFF_UP) && (if_getflags(ifp) & 
> > > IFF_UP))
> > > ^
> > > 1 error generated.
> > > --- iface.o ---
> > > *** [iface.o] Error code 1
Sorry for the breakage, I’ll fix it in a couple of hours.
> > >
> > > My source tree was updated just a few minutes ago and I didn't see any
> > > recent changes to iface.c.
> > >
> > > I have WITHOUT_NETLINK_SUPPORT= in my src.conf.
> > >
> >
> > Ah, my error.  The failure occurs while building the kernel, so I fixed
> > Subject accordingly.
> >
> 
> OK, this is another INET6 error.  I don't have INET6 enabled.
> 
> At line 1280 we have:
> #ifdef INET6
> int if_flags = if_getflags(ifp);
> #endif
> 
> and if_flags is used at line 1315 without checking whether INET6 is
> defined.
> 
> if_flags seems to be totally redundant, since the code at line 1315 will
> invoke if_getflags(ifp) if !(if_flags & IFF_UP) is true.
I wish it was true. The case here is that interface flags can change after 
adding the address, as many interface drivers silently bring the interface up 
upon the first address addition. Please see 
https://cgit.freebsd.org/src/commit/sys/netinet6?id=a77facd27368f618520d25391cfce11149879a41
 description for a more detailed explanation.
> 
> --
> Gary Jennejohn
> 
> 

/Alexander


Re: builworld fails due to error in af_inet.c

2023-05-22 Thread Alexander Chernikov
Sorry for the breakage (and thanks for markj@ for the prompt fix)

> On 22 May 2023, at 16:00, Gary Jennejohn  wrote:
> 
> I just ran buildworld using the latest current source.
> 
> It dies due to this error in line 385 of /usr/src/sbin/ifconfig/af_inet.c:
> 
> static void
> warn_nomask(ifflags)
> 
> The compiler really doesn't like not seeing a type for ifflags and bails
> out as the result.
> 
> Strangely enough, in_proc() a few lines later clearly has int ifflags in
> its list of variables.
> 
> Setting ifflags to int in warn_nomask() fixes the build.
> 
> Wasn't this compile tested before it was committed?
It was & it didn’t yell on my setup.
> 
> --
> Gary Jennejohn
> 




Re: /usr/src/sys/netlink/route/iface.c:738:1: warning: unused function

2023-04-08 Thread Alexander Chernikov



> On 8 Apr 2023, at 20:21, Gary Jennejohn  wrote:
> 
> This isn't a fatal error, but it would be easy to fix:
> 
> /usr/src/sys/netlink/route/iface.c:738:1: warning: unused function 
> 'inet6_get_plen' [-Wunused-function]
> inet6_get_plen(const struct in6_addr *addr)
> ^
> 1 warning generated.
> 
> This function is called in get_sa_plen(const struct sockaddr *sa) and the
> call is done inside #ifdef INET6...#endif, whereas the implementation is
> NOT inside #ifdef INET6...#endif, as it should be.
Thanks for the report, should be fixed by 39c0036d881b.
> 
> I do not have INET6 in my kernel config file.
> 
> --
> Gary Jennejohn
>