title: Using netpoll on Kernel 3.10
body: <p>i tried to send a udp packet in Kernel 3.10, following this question:
  <a href="https://stackoverflow.com/questions/10499865/sending-udp-packets-from-the-linux-kernel">Sending UDP packets from the Linux Kernel</a></p>
  
  <p>The UDP packet should be sent from 192.168.56.2 to 192.168.56.1 (port 514)
  I checked with tcpdump on 192.168.56.2 and wireshark (+ syslog-ng on cygwin) on 192.168.56.1, but didnt see the packet(s)</p>
  
  <p>Does anyone know whats wrong?</p>
  
  <pre><code>#include &lt;linux/module.h&gt;
  #include &lt;linux/kernel.h&gt;
  #include &lt;linux/init.h&gt;
  #include &lt;linux/netpoll.h&gt;
  
  static struct netpoll* np = NULL;
  static struct netpoll np_t;
  
  //see https://stackoverflow.com/questions/10499865/sending-udp-packets-from-the-linux-kernel
  void init_netpoll(void)
  {
      np_t.name = "LRNG";
      strlcpy(np_t.dev_name, "eth0", IFNAMSIZ);
      np_t.local_ip.ip = htonl((unsigned long int)0xc0a83802); //192.168.56.2
      np_t.local_ip.in.s_addr = htonl((unsigned long int)0xc0a83802); //192.168.56.2
      np_t.remote_ip.ip = htonl((unsigned long int)0xc0a83801); //192.168.56.1
      np_t.remote_ip.in.s_addr = htonl((unsigned long int)0xc0a83801); //192.168.56.1
      np_t.ipv6 = 0;//no IPv6
      np_t.local_port = 6666;
      np_t.remote_port = 514;
      memset(np_t.remote_mac, 0xff, ETH_ALEN);
      netpoll_print_options(&amp;np_t);
      netpoll_setup(&amp;np_t);
      np = &amp;np_t;
  }
  
  void clean_netpoll(void)
  {
    //nothing
  }
  
  void sendUdp(const char* buf)
  {
      int len = strlen(buf);
      netpoll_send_udp(np,buf,len);
  }
  
  
  static int __init initmod(void)
  {
          printk(KERN_INFO "Hello world :)\n");
  
          init_netpoll();
          sendUdp("[55] testestestestestestestestest");
          sendUdp("&lt;55&gt;Mar 17 21:57:57 frodo sshd[701]: blub");
  
  
          //0 = module loaded
          return 0;
  }
  
  static void __exit cleanmod(void)
  {
          printk(KERN_INFO "Goodbye world :(\n");
  }
  
  
  
  //Makros
  module_init(initmod);
  module_exit(cleanmod);
  </code></pre>