All of lore.kernel.org
 help / color / mirror / Atom feed
* socketcan and libnl3
@ 2016-05-22 10:17 Hubert Denkmair
  2016-06-14 11:05 ` ajneu
  0 siblings, 1 reply; 3+ messages in thread
From: Hubert Denkmair @ 2016-05-22 10:17 UTC (permalink / raw)
  To: linux-can

Hi there,

is anyone here using libnl3 to configure socketcan links?

I'm running into trouble and I'm wondering whether it's just me or if the 
rtnl_link_can_set_ctrlmode() and rtnl_link_can_set_restart_ms()
calls should work at all?

So, setting bitrate and sample-point via libnl works for me,
setting e.g. CAN_CTRLMODE_LISTENONLY does not.
Setting modes via iproute2 works as expected.

My code is here:
https://raw.githubusercontent.com/HubertD/cangaroo/master/canifconfig/main.c
(will gladly boil that down to a few lines if anyone is interested...)

Greetings,

Hubert

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: socketcan and libnl3
  2016-05-22 10:17 socketcan and libnl3 Hubert Denkmair
@ 2016-06-14 11:05 ` ajneu
  2016-06-14 13:57   ` Hubert Denkmair
  0 siblings, 1 reply; 3+ messages in thread
From: ajneu @ 2016-06-14 11:05 UTC (permalink / raw)
  To: linux-can

Hubert Denkmair <xor <at> xor.wtf> writes:

> 
> Hi there,
> 
> is anyone here using libnl3 to configure socketcan links?
> 
> I'm running into trouble and I'm wondering whether it's just me or if the 
> rtnl_link_can_set_ctrlmode() and rtnl_link_can_set_restart_ms()
> calls should work at all?
> 
> So, setting bitrate and sample-point via libnl works for me,
> setting e.g. CAN_CTRLMODE_LISTENONLY does not.
> Setting modes via iproute2 works as expected.
> 
> My code is here:
> https://raw.githubusercontent.com/HubertD/cangaroo/master/canifconfig/main.c
> (will gladly boil that down to a few lines if anyone is interested...)
> 
> Greetings,
> 
> Hubert
> --
> To unsubscribe from this list: send the line "unsubscribe linux-can" in
> the body of a message to majordomo <at> vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 


Hi Hubert,

I've tried your canifconfig under Debian Stretch
with the following command:

    sudo ./canifconfig -i can0 -u -b 250000

and wow that sure is one destructive command!!
Command Line shows: "Killed"

And from then on issuing command

    sudo ifconfig

hangs. I cannot even stop it with Ctrl-C.

This may be a problem with libnl, or with the Debian Testing (Strech) that
I'm running!! Completely destructive!


/var/log/messages shows

Jun 14 08:50:58 deb456 kernel: [ 2824.823991] Call Trace:
Jun 14 08:50:58 deb456 kernel: [ 2824.824001]  [<ffffffff814d9a84>] ?
rtnl_newlink+0x214/0x8a0
Jun 14 08:50:58 deb456 kernel: [ 2824.824019]  [<ffffffff8133ca63>] ?
nla_parse+0x93/0xf0
Jun 14 08:50:58 deb456 kernel: [ 2824.824034]  [<ffffffff8133cb0d>] ?
nla_strlcpy+0x4d/0x60
Jun 14 08:50:58 deb456 kernel: [ 2824.824050]  [<ffffffff814d6ec4>] ?
rtnl_link_ops_get+0x34/0x50
Jun 14 08:50:58 deb456 kernel: [ 2824.824067]  [<ffffffff814d99e6>] ?
rtnl_newlink+0x176/0x8a0
Jun 14 08:50:58 deb456 kernel: [ 2824.824084]  [<ffffffff814d8491>] ?
rtnetlink_rcv_msg+0xe1/0x230
Jun 14 08:50:58 deb456 kernel: [ 2824.824102]  [<ffffffff814d83b0>] ?
rtnetlink_rcv+0x30/0x30
Jun 14 08:50:58 deb456 kernel: [ 2824.824119]  [<ffffffff814fb5d1>] ?
netlink_rcv_skb+0xa1/0xc0
Jun 14 08:50:58 deb456 kernel: [ 2824.824135]  [<ffffffff814d83a4>] ?
rtnetlink_rcv+0x24/0x30
Jun 14 08:50:58 deb456 kernel: [ 2824.824152]  [<ffffffff814fafa2>] ?
netlink_unicast+0x172/0x220
Jun 14 08:50:58 deb456 kernel: [ 2824.824170]  [<ffffffff814fb34e>] ?
netlink_sendmsg+0x2fe/0x3b0
Jun 14 08:50:58 deb456 kernel: [ 2824.824187]  [<ffffffff814ab410>] ?
sock_sendmsg+0x30/0x40
Jun 14 08:50:58 deb456 kernel: [ 2824.824203]  [<ffffffff814abe2e>] ?
___sys_sendmsg+0x28e/0x2a0
Jun 14 08:50:58 deb456 kernel: [ 2824.824221]  [<ffffffff811ca7df>] ?
alloc_pages_vma+0xbf/0x250
Jun 14 08:50:58 deb456 kernel: [ 2824.824239]  [<ffffffff811a6602>] ?
handle_mm_fault+0x1462/0x1d00
Jun 14 08:50:58 deb456 kernel: [ 2824.824256]  [<ffffffff814aa41b>] ?
move_addr_to_user+0xab/0xc0
Jun 14 08:50:58 deb456 kernel: [ 2824.824273]  [<ffffffff814ac701>] ?
__sys_sendmsg+0x51/0x90
Jun 14 08:50:58 deb456 kernel: [ 2824.824291]  [<ffffffff815c65b6>] ?
system_call_fast_compare_end+0xc/0x96


Regards,
ajneu


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: socketcan and libnl3
  2016-06-14 11:05 ` ajneu
@ 2016-06-14 13:57   ` Hubert Denkmair
  0 siblings, 0 replies; 3+ messages in thread
From: Hubert Denkmair @ 2016-06-14 13:57 UTC (permalink / raw)
  To: ajneu; +Cc: linux-can

Greetings ajneu,

> I've tried your canifconfig under Debian Stretch
> with the following command:
> 
>     sudo ./canifconfig -i can0 -u -b 250000
seems right to me, works for me (tm) [ubuntu 16.04/pcan and candleLight 
devices]

> and wow that sure is one destructive command!!
> Command Line shows: "Killed"
> 
> And from then on issuing command
> 
>     sudo ifconfig
> 
> hangs. I cannot even stop it with Ctrl-C.
> 
> This may be a problem with libnl, or with the Debian Testing (Strech) 
> that
> I'm running!! Completely destructive!

So much wow. Glad I could help :-)

No really, i haven't seen something like that on my PC.
Haven't finished debugging the listen-only stuff, but setting bitrate 
and taking interfaces up/down has never been a problem.

Which can hardware and which kernel do you use?
I would suspect the problem is most likely in a socketcan driver?
If not (or if I can get hold of the hardware), maybe I can reproduce 
that in a VM?

Cheers,

Hubert

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-06-14 13:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-22 10:17 socketcan and libnl3 Hubert Denkmair
2016-06-14 11:05 ` ajneu
2016-06-14 13:57   ` Hubert Denkmair

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.