title: SocketCAN read socket call is blocking
body: <p>I am trying to do a socket read from CAN socket. My read call is getting blocked and never returns control outside.</p>
  
  <p>Steps in my code flow:</p>
  
  <ol>
  <li>open a socket</li>
  <li>assign interface name</li>
  <li>assign CAN ID</li>
  <li>Assign CAN mask</li>
  <li>bind</li>
  <li>read/receive call to socket</li>
  </ol>
  
  <p>Here is the code:</p>
  
  <pre><code>mSock = socket(PF_CAN,SOCK_RAW,CAN_RAW);
  if(mSock &lt; 0)  {
      std::cout &lt;&lt; "failed to open socket\n" &lt;&lt; std::endl;
  }
  else  {
      std::cout &lt;&lt; "mSock = \n" &lt;&lt; mSock &lt;&lt; std::endl;
  }
  strcpy(ifr.ifr_name,"can0");
  iotlRetVal = ioctl(mSock,SIOCGIFINDEX, &amp;ifr);
  
  if(iotlRetVal &lt; 0)  {
      std::cout &lt;&lt; "failed to open socket\n" &lt;&lt; std::endl;
  }
  else  {
      std::cout &lt;&lt; "ifr.ifr_ifindex = \n" &lt;&lt; ifr.ifr_ifindex &lt;&lt; std::endl;
  }
  
  cfilter.can_id = 0xabcdef0;
  cfilter.can_mask = CAN_EFF_MASK;
  
  addr.can_family = AF_CAN;
  addr.can_ifindex = ifr.ifr_ifindex;
  
  bindRetVal = bind(mSock, (struct sockaddr *) &amp;addr, sizeof(addr));
  if(bindRetVal &lt; 0)  {
      std::cout &lt;&lt; "failed to bind socket\n" &lt;&lt; std::endl;
  }
  else  {
      std::cout &lt;&lt; "bindRetVal = \n" &lt;&lt; bindRetVal &lt;&lt; std::endl;
  }
  char buff[200];
  int len;
  int test;
  
  test = recvfrom(mSock, &amp;buff, sizeof(buff), 0,
           (struct sockaddr *) &amp;addr, (socklen_t *)&amp;len);
  printf("test:%d \t len:%d\n",test,len);
  </code></pre>
  
  <p>What I am observing is that this call is not returning at all, and is simply getting blocked.</p>
  
  <p>If I do ifconfig -a in my Linux PC, I see the following:</p>
  
  <pre><code>can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
            UP RUNNING NOARP  MTU:16  Metric:1
            RX packets:0 errors:0 dropped:0 overruns:0 frame:0
            TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
            collisions:0 txqueuelen:10 
            RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
            Interrupt:83 
  </code></pre>
  
  <p>Is it related to the 00s in the Hwaddr: 00-00-00 .....
  Does this happen when there is problem on my Can interface hardware?</p>
  
  <p>Or if it is a software issue, under what scenario would my read call get blocked?</p>