alandtsang/mydpdkdns

seem like syntax errors in decoder.cpp files?

Closed this issue · 2 comments

root@dns-primary:/data/mydpdkdns/tools# ./start.sh
/data/mydpdkdns
-- RTE_SDK path:/data/f-stack/dpdk
-- RTE_TARGET path:config
-- RTE_SDK include path:/data/f-stack/dpdk/include
-- RTE_SDK library path:/data/f-stack/dpdk/lib
-- Configuring done
-- Generating done
-- Build files have been written to: /data/mydpdkdns/build
Scanning dependencies of target dserver
[ 14%] Building CXX object CMakeFiles/dserver.dir/src/config.cpp.o
[ 28%] Building CXX object CMakeFiles/dserver.dir/src/decoder.cpp.o
/data/mydpdkdns/src/decoder.cpp: In member function ‘void Decoder::swap_addr(eth
/data/mydpdkdns/src/decoder.cpp:35:21: error: aggregate ‘ether_addr temp’ has ind
   35 |   struct ether_addr temp;
      |                     ^~~~
/data/mydpdkdns/src/decoder.cpp:37:3: error: invalid use of incomplete type ‘str
   37 |   *src = *dst;
      |   ^~~~
In file included from /data/mydpdkdns/src/decoder.cpp:5:
/data/mydpdkdns/include/decoder.h:32:32: note: forward declaration of ‘struct et
   32 |   inline void swap_addr(struct ether_addr *src, struct ether_addr *dst);
      |                                ^~~~~~~~~~
/data/mydpdkdns/src/decoder.cpp: In member function ‘unsigned int Decoder::proce
/data/mydpdkdns/src/decoder.cpp:63:11: error: invalid use of incomplete type ‘st
   63 |   if (ehdr->ether_type != rte_cpu_to_be_16(ETHER_TYPE_IPv4)) {
      |           ^~
In file included from /data/mydpdkdns/src/decoder.cpp:5:
/data/mydpdkdns/include/decoder.h:37:10: note: forward declaration of ‘struct et
   37 |   struct ether_hdr *ehdr;
      |          ^~~~~~~~~
In file included from /usr/local/include/rte_mbuf.h:42,
                 from /usr/local/include/rte_ether.h:23,
                 from /data/mydpdkdns/src/decoder.cpp:3:
/data/mydpdkdns/src/decoder.cpp:63:44: error: ‘ETHER_TYPE_IPv4’ was not declaredETHER_TYPE_IPV4’?
   63 |   if (ehdr->ether_type != rte_cpu_to_be_16(ETHER_TYPE_IPv4)) {
      |                                            ^~~~~~~~~~~~~~~
In file included from /usr/local/include/rte_mbuf.h:44,
                 from /usr/local/include/rte_ether.h:23,
                 from /data/mydpdkdns/src/decoder.cpp:3:
/data/mydpdkdns/src/decoder.cpp:67:83: error: invalid application of ‘sizeof’ to
   67 |   ip_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, sizeof(struct
      |
/data/mydpdkdns/src/decoder.cpp:68:13: error: invalid use of incomplete type ‘st
   68 |   if (ip_hdr->dst_addr != localIP)
      |             ^~
In file included from /data/mydpdkdns/src/decoder.cpp:5:
/data/mydpdkdns/include/decoder.h:38:10: note: forward declaration of ‘struct ip
   38 |   struct ipv4_hdr *ip_hdr;
      |          ^~~~~~~~
/data/mydpdkdns/src/decoder.cpp:71:17: error: invalid use of incomplete type ‘st
   71 |   switch (ip_hdr->next_proto_id) {
      |                 ^~
In file included from /data/mydpdkdns/src/decoder.cpp:5:
/data/mydpdkdns/include/decoder.h:38:10: note: forward declaration of ‘struct ip
   38 |   struct ipv4_hdr *ip_hdr;
      |          ^~~~~~~~
/data/mydpdkdns/src/decoder.cpp:73:86: error: invalid application of ‘sizeof’ to
   73 |       udp_hdr = (struct udp_hdr *) ((unsigned char *) ip_hdr + sizeof(st
      |
In file included from /usr/local/include/rte_mbuf.h:42,
                 from /usr/local/include/rte_ether.h:23,
                 from /data/mydpdkdns/src/decoder.cpp:3:
/data/mydpdkdns/src/decoder.cpp:74:42: error: invalid use of incomplete type ‘st
   74 |       port_dst = rte_be_to_cpu_16(udp_hdr->dst_port);
      |                                          ^~
In file included from /data/mydpdkdns/src/decoder.cpp:5:
/data/mydpdkdns/include/decoder.h:39:10: note: forward declaration of ‘struct ud
   39 |   struct udp_hdr *udp_hdr;
      |          ^~~~~~~
In file included from /usr/local/include/rte_mbuf.h:42,
                 from /usr/local/include/rte_ether.h:23,
                 from /data/mydpdkdns/src/decoder.cpp:3:
/data/mydpdkdns/src/decoder.cpp:74:42: error: invalid use of incomplete type ‘st
   74 |       port_dst = rte_be_to_cpu_16(udp_hdr->dst_port);
      |                                          ^~
In file included from /data/mydpdkdns/src/decoder.cpp:5:
/data/mydpdkdns/include/decoder.h:39:10: note: forward declaration of ‘struct ud
   39 |   struct udp_hdr *udp_hdr;
      |          ^~~~~~~
In file included from /usr/local/include/rte_mbuf.h:42,
                 from /usr/local/include/rte_ether.h:23,
                 from /data/mydpdkdns/src/decoder.cpp:3:
/data/mydpdkdns/src/decoder.cpp:74:42: error: invalid use of incomplete type ‘st
   74 |       port_dst = rte_be_to_cpu_16(udp_hdr->dst_port);
      |                                          ^~
In file included from /data/mydpdkdns/src/decoder.cpp:5:
/data/mydpdkdns/include/decoder.h:39:10: note: forward declaration of ‘struct ud
   39 |   struct udp_hdr *udp_hdr;
      |          ^~~~~~~
/data/mydpdkdns/src/decoder.cpp:79:54: error: invalid application of ‘sizeof’ to
   79 |       buff = (char *) udp_hdr + sizeof(struct udp_hdr);
      |                                                      ^
/data/mydpdkdns/src/decoder.cpp:90:35: error: invalid use of incomplete type ‘st
   90 |         inet_ntop(AF_INET, &ip_hdr->src_addr, ip, 16);
      |                                   ^~
In file included from /data/mydpdkdns/src/decoder.cpp:5:
/data/mydpdkdns/include/decoder.h:38:10: note: forward declaration of ‘struct ip
   38 |   struct ipv4_hdr *ip_hdr;
      |          ^~~~~~~~
/data/mydpdkdns/src/decoder.cpp:103:22: error: invalid use of incomplete type ‘s
  103 |       swap_addr(&ehdr->s_addr, &ehdr->d_addr);
      |                      ^~
In file included from /data/mydpdkdns/src/decoder.cpp:5:
/data/mydpdkdns/include/decoder.h:37:10: note: forward declaration of ‘struct et
   37 |   struct ether_hdr *ehdr;
      |          ^~~~~~~~~
/data/mydpdkdns/src/decoder.cpp:103:37: error: invalid use of incomplete type ‘s
  103 |       swap_addr(&ehdr->s_addr, &ehdr->d_addr);
      |                                     ^~
In file included from /data/mydpdkdns/src/decoder.cpp:5:
/data/mydpdkdns/include/decoder.h:37:10: note: forward declaration of ‘struct et
   37 |   struct ether_hdr *ehdr;
      |          ^~~~~~~~~
/data/mydpdkdns/src/decoder.cpp:106:13: error: invalid use of incomplete type ‘s
  106 |       ip_hdr->hdr_checksum = 0;
      |             ^~
In file included from /data/mydpdkdns/src/decoder.cpp:5:
/data/mydpdkdns/include/decoder.h:38:10: note: forward declaration of ‘struct ip
   38 |   struct ipv4_hdr *ip_hdr;
      |          ^~~~~~~~
/data/mydpdkdns/src/decoder.cpp:107:26: error: invalid use of incomplete type ‘s
  107 |       swap_ipaddr(&ip_hdr->src_addr, &ip_hdr->dst_addr);
      |                          ^~
In file included from /data/mydpdkdns/src/decoder.cpp:5:
/data/mydpdkdns/include/decoder.h:38:10: note: forward declaration of ‘struct ip
   38 |   struct ipv4_hdr *ip_hdr;
      |          ^~~~~~~~
/data/mydpdkdns/src/decoder.cpp:107:45: error: invalid use of incomplete type ‘s
  107 |       swap_ipaddr(&ip_hdr->src_addr, &ip_hdr->dst_addr);
      |                                             ^~
In file included from /data/mydpdkdns/src/decoder.cpp:5:
/data/mydpdkdns/include/decoder.h:38:10: note: forward declaration of ‘struct ip
   38 |   struct ipv4_hdr *ip_hdr;
      |          ^~~~~~~~
/data/mydpdkdns/src/decoder.cpp:110:25: error: invalid use of incomplete type ‘s
  110 |       swap_port(&udp_hdr->src_port, &udp_hdr->dst_port);
      |                         ^~
In file included from /data/mydpdkdns/src/decoder.cpp:5:
/data/mydpdkdns/include/decoder.h:39:10: note: forward declaration of ‘struct ud
   39 |   struct udp_hdr *udp_hdr;
      |          ^~~~~~~
/data/mydpdkdns/src/decoder.cpp:110:45: error: invalid use of incomplete type ‘s
  110 |       swap_port(&udp_hdr->src_port, &udp_hdr->dst_port);
      |                                             ^~
In file included from /data/mydpdkdns/src/decoder.cpp:5:
/data/mydpdkdns/include/decoder.h:39:10: note: forward declaration of ‘struct ud
   39 |   struct udp_hdr *udp_hdr;
      |          ^~~~~~~
/data/mydpdkdns/src/decoder.cpp:111:14: error: invalid use of incomplete type ‘s
  111 |       udp_hdr->dgram_cksum = 0; /* No UDP checksum. */
      |              ^~
In file included from /data/mydpdkdns/src/decoder.cpp:5:
/data/mydpdkdns/include/decoder.h:39:10: note: forward declaration of ‘struct ud
   39 |   struct udp_hdr *udp_hdr;
      |          ^~~~~~~
/data/mydpdkdns/src/decoder.cpp:118:13: error: invalid use of incomplete type ‘s
  118 |       ip_hdr->total_length = RTE_CPU_TO_BE_16(pkt->pkt_len - sizeof(*ehd
      |             ^~
In file included from /data/mydpdkdns/src/decoder.cpp:5:
/data/mydpdkdns/include/decoder.h:38:10: note: forward declaration of ‘struct ip
   38 |   struct ipv4_hdr *ip_hdr;
      |          ^~~~~~~~
/data/mydpdkdns/src/decoder.cpp:118:74: error: invalid application of ‘sizeof’ t
  118 |       ip_hdr->total_length = RTE_CPU_TO_BE_16(pkt->pkt_len - sizeof(*ehd
      |
/data/mydpdkdns/src/decoder.cpp:12:20: note: in definition of macro ‘RTE_CPU_TO_
   12 |     (uint16_t) ((((cpu_16_v) & 0xFF) << 8) | ((cpu_16_v) >> 8))
      |                    ^~~~~~~~
/data/mydpdkdns/src/decoder.cpp:118:74: error: invalid application of ‘sizeof’ t
  118 |       ip_hdr->total_length = RTE_CPU_TO_BE_16(pkt->pkt_len - sizeof(*ehd
      |
/data/mydpdkdns/src/decoder.cpp:12:48: note: in definition of macro ‘RTE_CPU_TO_
   12 |     (uint16_t) ((((cpu_16_v) & 0xFF) << 8) | ((cpu_16_v) >> 8))
      |                                                ^~~~~~~~
/data/mydpdkdns/src/decoder.cpp:119:13: error: invalid use of incomplete type ‘s
  119 |       ip_hdr->hdr_checksum = ip_sum((unaligned_uint16_t *) ip_hdr, sizeo
      |             ^~
In file included from /data/mydpdkdns/src/decoder.cpp:5:
/data/mydpdkdns/include/decoder.h:38:10: note: forward declaration of ‘struct ip
   38 |   struct ipv4_hdr *ip_hdr;
      |          ^~~~~~~~
/data/mydpdkdns/src/decoder.cpp:119:82: error: invalid application of ‘sizeof’ t
  119 |       ip_hdr->hdr_checksum = ip_sum((unaligned_uint16_t *) ip_hdr, sizeo
      |
/data/mydpdkdns/src/decoder.cpp:120:14: error: invalid use of incomplete type ‘s
  120 |       udp_hdr->dgram_len = RTE_CPU_TO_BE_16(pkt->pkt_len - sizeof(*ehdr)
      |              ^~
In file included from /data/mydpdkdns/src/decoder.cpp:5:
/data/mydpdkdns/include/decoder.h:39:10: note: forward declaration of ‘struct ud
   39 |   struct udp_hdr *udp_hdr;
      |          ^~~~~~~
/data/mydpdkdns/src/decoder.cpp:120:72: error: invalid application of ‘sizeof’ t
  120 |       udp_hdr->dgram_len = RTE_CPU_TO_BE_16(pkt->pkt_len - sizeof(*ehdr)
      |                                                                        ^
/data/mydpdkdns/src/decoder.cpp:12:20: note: in definition of macro ‘RTE_CPU_TO_
   12 |     (uint16_t) ((((cpu_16_v) & 0xFF) << 8) | ((cpu_16_v) >> 8))
      |                    ^~~~~~~~
/data/mydpdkdns/src/decoder.cpp:120:90: error: invalid application of ‘sizeof’ t
  120 |       udp_hdr->dgram_len = RTE_CPU_TO_BE_16(pkt->pkt_len - sizeof(*ehdr)
      |
/data/mydpdkdns/src/decoder.cpp:12:20: note: in definition of macro ‘RTE_CPU_TO_
   12 |     (uint16_t) ((((cpu_16_v) & 0xFF) << 8) | ((cpu_16_v) >> 8))
      |                    ^~~~~~~~
/data/mydpdkdns/src/decoder.cpp:120:72: error: invalid application of ‘sizeof’ t
  120 |       udp_hdr->dgram_len = RTE_CPU_TO_BE_16(pkt->pkt_len - sizeof(*ehdr)
      |                                                                        ^
/data/mydpdkdns/src/decoder.cpp:12:48: note: in definition of macro ‘RTE_CPU_TO_
   12 |     (uint16_t) ((((cpu_16_v) & 0xFF) << 8) | ((cpu_16_v) >> 8))
      |                                                ^~~~~~~~
/data/mydpdkdns/src/decoder.cpp:120:90: error: invalid application of ‘sizeof’ t
  120 |       udp_hdr->dgram_len = RTE_CPU_TO_BE_16(pkt->pkt_len - sizeof(*ehdr)
      |
/data/mydpdkdns/src/decoder.cpp:12:48: note: in definition of macro ‘RTE_CPU_TO_
   12 |     (uint16_t) ((((cpu_16_v) & 0xFF) << 8) | ((cpu_16_v) >> 8))
      |                                                ^~~~~~~~
/data/mydpdkdns/src/decoder.cpp:60:8: warning: control reaches end of non-void f
   60 |   ehdr = rte_pktmbuf_mtod(pkt, struct ether_hdr*);
      |        ^
make[2]: *** [CMakeFiles/dserver.dir/build.make:76: CMakeFiles/dserver.dir/src/d
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/dserver.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
root@dns-primary:/data/mydpdkdns/tools# ./start.sh: line 27: ./bin/dserver: No s



All syntax errors are due to incompatibility with newer versions of dpdk

All syntax errors are due to incompatibility with newer versions of dpdk

The environment of this project was dpdk 17.02 and the operating system was Ubuntu 16.04. The new version of dpdk should have compatibility problems