Giter VIP home page Giter VIP logo

socketcand's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

socketcand's Issues

Multiple connections to different CAN interfaces

My project will require data from several CAN interfaces installed on the system (can0, can1, can2). It doesn't appear I can open a single connection to socketcand to read from these devices simultaneously, but is it possible to open one connection per bus from a single client and access the data that way?

Thanks!

debian package request

Hi,

I noticed there is no debian package for socketcand. Is it correct?
If there is no package, @ukleinek, may be you can help here?

How do I forward a CAN interface over network

I hope it is ok to ask here.

Using socketcand, is there a way to set up a virtual CAN that receives data from a physical CAN over the network and behaves like the physical CAN?

Basically I have a remote device with a CAN port, and I want to connect to and read from the CAN port as if it is on my local machine.

Update on Using can-utils with OBDLink SX cable #41

Hi All,

Is there is an update on the issue referenced at:

linux-can/can-utils#41 (comment)

I have an OBDLink SX cable and would like to monitor an automobiles CAN messages. It was mentioned that the OBDLinx SX can receive raw CAN frames and send them to a virtual CAN driver (e.g. vcan0) and use can-utils on this vcan0, however, this may not work and/or may not be the best practice.

Has there been any updates on implementing a CAN driver analogue to the slcan.c driver in Linux or anything else that would help sniff using the OBDLink SX? I appreciate the good start @crossband and @hartkopp.

Thanks in advance!

$ make install - kali Linux - don't know how to proceed after running

This is more a question than an issue because everything else for the installation ran perfectly, just don't know what to do here when I run make install when this shows up, any advice?? would i just type make install=y/make install=n or is it done differently??

mkdir -p /usr/local/bin
cp ./socketcand /usr/local/bin/
cp ./socketcandcl /usr/local/bin/
mkdir -p /usr/local/share/man
cp ./socketcand.1 /usr/local/share/man/
mkdir -p /etc/
install -m 0644 ./etc/socketcand.conf /etc/
if [ yes = yes ]; then mkdir -p /etc/init.d; install --mode=755 ./init.d/socketcand /etc/init.d/socketcand; fi
if [ no = yes ]; then install --mode=755 ./rc.d/socketcand /etc/rc.d/socketcand; fi

< error unknown command >

$ ./socketcand -v -i can0 -p 29536 -l wlan0
Verbose output activated
Using network interface 'wlan0'
Listen adress is 192.168.0.59
Broadcast adress is 0.0.0.0
creating broadcast thread...
binding socket to 192.168.0.59:29536
client connected
unknown command '< send 7E5 7 10 02 55 55 55 55 55 >'.
$ nc 192.168.0.59 29536
< hi >< send 7E5 7 10 02 55 55 55 55 55 > 
< error unknown command >

build error on widnows

Trying to build this project on windows 10.
JDK version is 19.0.1 2022-10-18
Maven version is Apache Maven 3.8.6

Error message:
[ERROR] Failed to execute goal org.apache.netbeans.utilities:nbm-maven-plugin:4.2:cluster-app (default-cluster-app) on project application: Execution default-cluster-app of goal org.apache.netbeans.utilities:nbm-maven-plugin:4.2:cluster-app failed: A required class was missing while executing org.apache.netbeans.utilities:nbm-maven-plugin:4.2:cluster-app: java/util/jar/Pack200
[ERROR] -----------------------------------------------------
[ERROR] realm = extension>org.apache.netbeans.utilities:nbm-maven-plugin:4.2
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/Michael/.m2/repository/org/apache/netbeans/utilities/nbm-maven-plugin/4.2/nbm-maven-plugin-4.2.jar
[ERROR] urls[1] = file:/C:/Users/Michael/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
[ERROR] urls[2] = file:/C:/Users/Michael/.m2/repository/org/sonatype/sisu/sisu-inject-bean/2.3.0/sisu-inject-bean-2.3.0.jar
[ERROR] urls[3] = file:/C:/Users/Michael/.m2/repository/org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-3.1.0-no_aop.jar
[ERROR] urls[4] = file:/C:/Users/Michael/.m2/repository/org/sonatype/sisu/sisu-guava/0.9.9/sisu-guava-0.9.9.jar
[ERROR] urls[5] = file:/C:/Users/Michael/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[6] = file:/C:/Users/Michael/.m2/repository/org/apache/maven/plugin-tools/maven-plugin-annotations/3.5/maven-plugin-annotations-3.5.jar
[ERROR] urls[7] = file:/C:/Users/Michael/.m2/repository/org/apache/ant/ant/1.10.5/ant-1.10.5.jar
[ERROR] urls[8] = file:/C:/Users/Michael/.m2/repository/org/apache/ant/ant-launcher/1.10.5/ant-launcher-1.10.5.jar
[ERROR] urls[9] = file:/C:/Users/Michael/.m2/repository/org/codehaus/plexus/plexus-utils/3.1.0/plexus-utils-3.1.0.jar
[ERROR] urls[10] = file:/C:/Users/Michael/.m2/repository/org/codehaus/plexus/plexus-archiver/3.5/plexus-archiver-3.5.jar
[ERROR] urls[11] = file:/C:/Users/Michael/.m2/repository/org/apache/commons/commons-compress/1.14/commons-compress-1.14.jar
[ERROR] urls[12] = file:/C:/Users/Michael/.m2/repository/org/iq80/snappy/snappy/0.4/snappy-0.4.jar
[ERROR] urls[13] = file:/C:/Users/Michael/.m2/repository/org/tukaani/xz/1.6/xz-1.6.jar
[ERROR] urls[14] = file:/C:/Users/Michael/.m2/repository/org/apache/maven/shared/maven-dependency-tree/2.2/maven-dependency-tree-2.2.jar
[ERROR] urls[15] = file:/C:/Users/Michael/.m2/repository/org/eclipse/aether/aether-util/0.9.0.M2/aether-util-0.9.0.M2.jar
[ERROR] urls[16] = file:/C:/Users/Michael/.m2/repository/org/apache/maven/shared/maven-dependency-analyzer/1.11.1/maven-dependency-analyzer-1.11.1.jar
[ERROR] urls[17] = file:/C:/Users/Michael/.m2/repository/org/ow2/asm/asm/7.0/asm-7.0.jar
[ERROR] urls[18] = file:/C:/Users/Michael/.m2/repository/org/apache/xbean/xbean-reflect/3.7/xbean-reflect-3.7.jar
[ERROR] urls[19] = file:/C:/Users/Michael/.m2/repository/com/google/collections/google-collections/1.0/google-collections-1.0.jar
[ERROR] urls[20] = file:/C:/Users/Michael/.m2/repository/org/apache/maven/shared/maven-filtering/3.1.1/maven-filtering-3.1.1.jar
[ERROR] urls[21] = file:/C:/Users/Michael/.m2/repository/org/apache/maven/shared/maven-shared-utils/3.0.0/maven-shared-utils-3.0.0.jar
[ERROR] urls[22] = file:/C:/Users/Michael/.m2/repository/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar
[ERROR] urls[23] = file:/C:/Users/Michael/.m2/repository/org/sonatype/plexus/plexus-build-api/0.0.7/plexus-build-api-0.0.7.jar
[ERROR] urls[24] = file:/C:/Users/Michael/.m2/repository/org/sonatype/aether/aether-util/1.13.1/aether-util-1.13.1.jar
[ERROR] urls[25] = file:/C:/Users/Michael/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[26] = file:/C:/Users/Michael/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[27] = file:/C:/Users/Michael/.m2/repository/org/apache/netbeans/utilities/nbm-maven-harness/11.0/nbm-maven-harness-11.0.jar
[ERROR] urls[28] = file:/C:/Users/Michael/.m2/repository/org/codehaus/plexus/plexus-io/3.0.0/plexus-io-3.0.0.jar
[ERROR] urls[29] = file:/C:/Users/Michael/.m2/repository/commons-io/commons-io/2.5/commons-io-2.5.jar
[ERROR] urls[30] = file:/C:/Users/Michael/.m2/repository/org/apache/netbeans/utilities/nb-shared/1.3/nb-shared-1.3.jar
[ERROR] urls[31] = file:/C:/Users/Michael/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]

Wireshark dissector request

Wireshark already has a CAN and CANopen dissector. It would be great for protocol adoption if a mainstream packet analyzer could detect socketcand packets as well and pass their payload through to the CAN dissector.

Windows support request

Is there a way to port this code to run on Windows 10 to support SocketCAN driver with a Virtual CAN (like SavvyCAN, etc)?

Build error on opensuse

I'm getting the following error during build. I don't know if its a bug or an issue with my system. Appreceate if anyone knows how to fix it.

make
gcc -Wall -Wno-parentheses -DPF_CAN=29 -DAF_CAN=PF_CAN -DHAVE_CONFIG_H   -I . -I ./include -o socketcand ./socketcand.c ./statistics.c ./beacon.c ./state_bcm.c ./state_raw.c ./state_isotp.c ./state_control.c -lpthread 
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /tmp/ccJ8QkBR.o:(.bss+0x20): multiple definition of `ifr'; /tmp/cctNtctR.o:(.bss+0x2200): first defined here
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /tmp/ccJ8QkBR.o:(.bss+0x60): multiple definition of `readfds'; /tmp/ccETFL7Q.o:(.bss+0x0): first defined here
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /tmp/ccJ8QkBR.o:(.bss+0x180): multiple definition of `tv'; /tmp/ccETFL7Q.o:(.bss+0x80): first defined here
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /tmp/ccvecglO.o:(.bss+0x0): multiple definition of `readfds'; /tmp/ccETFL7Q.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:32: socketcand] Error 1

When I try LDFLAGS=--allow-multiple-definition it says the c++ compiler isn't working.

When I try with g++ I get this error:

./socketcand.c: In function ‘int main(int, char**)’:
./socketcand.c:208:22: error: invalid conversion from ‘void*’ to ‘char*’ [-fpermissive]
  208 |  description = malloc(sizeof(BEACON_DESCRIPTION));
      |                ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                      |
      |                      void*
./socketcand.c:210:27: error: invalid conversion from ‘void*’ to ‘char*’ [-fpermissive]
  210 |  interface_string = malloc(strlen(DEFAULT_INTERFACE)+ 1);
      |                     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                           |
      |                           void*
./socketcand.c:212:24: error: invalid conversion from ‘void*’ to ‘char*’ [-fpermissive]
  212 |  busses_string = malloc(strlen(DEFAULT_BUSNAME)+ 1);
      |                  ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                        |
      |                        void*
./socketcand.c:264:27: error: invalid conversion from ‘void*’ to ‘char*’ [-fpermissive]
  264 |    busses_string = realloc(busses_string, strlen(optarg)+1);
      |                    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                           |
      |                           void*
./socketcand.c:273:22: error: invalid conversion from ‘void*’ to ‘char*’ [-fpermissive]
  273 |    afuxname = realloc(afuxname, strlen(optarg)+1);
      |               ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                      |
      |                      void*
./socketcand.c:278:30: error: invalid conversion from ‘void*’ to ‘char*’ [-fpermissive]
  278 |    interface_string = realloc(interface_string, strlen(optarg)+1);
      |                       ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                              |
      |                              void*
./socketcand.c:319:26: error: invalid conversion from ‘void*’ to ‘char**’ [-fpermissive]
  319 |  interface_names = malloc(sizeof(char *) * interface_count);
      |                    ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                          |
      |                          void*
./socketcand.c:334:28: error: invalid conversion from ‘void (*)()’ to ‘__sighandler_t’ {aka ‘void (*)(int)’} [-fpermissive]
  334 |  signalaction.sa_handler = &childdied;
      |                            ^~~~~~~~~~
      |                            |
      |                            void (*)()
./socketcand.c:339:29: error: invalid conversion from ‘void (*)()’ to ‘__sighandler_t’ {aka ‘void (*)(int)’} [-fpermissive]
  339 |  sigint_action.sa_handler = &sigint;
      |                             ^~~~~~~
      |                             |
      |                             void (*)()
./statistics.c: In function ‘void* statistics_loop(void*)’:
./statistics.c:61:12: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
   61 |    for(;pos<strlen(name);pos++)
      |         ~~~^~~~~~~~~~~~~
./state_bcm.c: In function ‘void state_bcm()’:
./state_bcm.c:372:18: warning: comparison of integer expressions of different signedness: ‘int’ and ‘__u32’ {aka ‘unsigned int’} [-Wsign-compare]
  372 |    for (i = 0; i < muxmsg.msg_head.nframes; i++) {
      |                ~~^~~~~~~~~~~~~~~~~~~~~~~~~
./state_raw.c: In function ‘void state_raw()’:
./state_raw.c:107:10: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
  107 |   if(ret < sizeof(struct can_frame)) {
      |      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
./state_raw.c:120:13: error: expected primary-expression before ‘class’
  120 |     canid_t class = frame.can_id  & CAN_EFF_MASK;
      |             ^~~~~
./state_raw.c:121:52: error: expected primary-expression before ‘class’
  121 |     ret = sprintf(buf, "< error %03X %ld.%06ld >", class, tv.tv_sec, tv.tv_usec);
      |                                    

Edit: So I can get rid of the errors here by renaming the variable class to _class and by using -fpermissive. After that I get the same errors I was getting on gcc.

CAN FD support

Is it correct that socketcand does not support the data-communication protocol CAN FD (CAN Flexible Data Rate)? Or did I miss something?

CAN FD frames created with can-utils are not displayed in raw mode.

build failed ubuntu 18 gcc version 7.4.0

build failed @ configure phase
by checking config.log
hit
gcc: error: unrecognized command line option '-V'
and

gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
gcc: fatal error: no input files

autoconf version 2.69
gcc version 7.4.0 (Ubuntu 7.4.0-10ubuntu218.04ppa1)

logs:

  1. ./configure

$ ./configure --prefix=$HOME
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for config_init in -lconfig... no
configure: error: in /home/huide/src/socketcand': configure: error: config test failed (--without-config to disable) See config.log' for more details

  1. config.log

Thread model: posix
gcc version 7.4.0 (Ubuntu 7.4.0-10ubuntu218.04ppa1)
configure:2547: $? = 0
configure:2536: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:2547: $? = 1
configure:2536: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
gcc: fatal error: no input files
compilation terminated.
configure:2547: $? = 1
configure:2567: checking whether the C compiler works

should I have to back to use the old version GCC?

Listen and broadcast on all interfaces by default

socketcand tries to use eth0 by default. In the modern systems there is no such network interface as the new approach names the interfaces according to their bus location. Hence socketcand fails to send beacons.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.