linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* programatically determine netlink-type: can or vcan ...
@ 2016-06-21 14:40 ajneu
  2016-06-21 15:26 ` ajneu
  0 siblings, 1 reply; 5+ messages in thread
From: ajneu @ 2016-06-21 14:40 UTC (permalink / raw)
  To: linux-can

Hi,

how can one determine the netlink-type (can or vcan, ...) of an
interface-name (e.g. can1), from a C program?

It would be great if I can e.g. get that from /sys/class/net/can1 somehow.

What would work, but is NOT nice (because of portability problems), is to
use the C-function system:

if (system("test \"$(ip link show can1 type vcan)\" !=  \"\"")) {
   printf("can1 is not vcan\n");
} else {
   printf("can1 is vcan\n");
}

Thanks.
ajneu




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

end of thread, other threads:[~2016-07-19 14:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-21 14:40 programatically determine netlink-type: can or vcan ajneu
2016-06-21 15:26 ` ajneu
2016-06-21 20:48   ` ajneu
2016-06-23  7:09     ` ajneu
2016-07-19 14:57       ` @Marc Kleine-Budde ajneu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).