Skip to content

Commit a56f063

Browse files
samuelbrianJassob
authored andcommitted
feat: support vxcan with candevice
Only the type check needs to be updated to allow the candevice module to support VXCAN devices.
1 parent 7324c6c commit a56f063

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/candevice/device_linux.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ import (
1313
)
1414

1515
const (
16-
CanLinkType = "can"
17-
VcanLinkType = "vcan"
16+
CanLinkType = "can"
17+
VcanLinkType = "vcan"
18+
VxcanLinkType = "vxcan"
1819
)
1920

2021
const (
@@ -545,7 +546,7 @@ func (li *linkInfoMsg) decode(nad *netlink.AttributeDecoder) error {
545546
switch nad.Type() {
546547
case unix.IFLA_INFO_KIND:
547548
li.linkType = nad.String()
548-
if (li.linkType != CanLinkType) && (li.linkType != VcanLinkType) {
549+
if (li.linkType != CanLinkType) && (li.linkType != VcanLinkType) && (li.linkType != VxcanLinkType) {
549550
return fmt.Errorf("not a CAN interface")
550551
}
551552
case unix.IFLA_INFO_DATA:

0 commit comments

Comments
 (0)