summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--trafgen.c6
-rw-r--r--trafgen_conf.h1
-rw-r--r--trafgen_lexer.l1
-rw-r--r--trafgen_parser.y5
4 files changed, 12 insertions, 1 deletions
diff --git a/trafgen.c b/trafgen.c
index d9e0e0e..e628646 100644
--- a/trafgen.c
+++ b/trafgen.c
@@ -376,6 +376,12 @@ static void apply_csum16(int id)
(packets[id].len - csum->to),
IPPROTO_TCP);
break;
+ case CSUM_ICMP6:
+ sum = p6_csum((void *) packets[id].payload + csum->from,
+ packets[id].payload + csum->to,
+ (packets[id].len - csum->to),
+ IPPROTO_ICMPV6);
+ break;
default:
bug();
break;
diff --git a/trafgen_conf.h b/trafgen_conf.h
index fcbbb17..8a6e4d6 100644
--- a/trafgen_conf.h
+++ b/trafgen_conf.h
@@ -19,6 +19,7 @@ enum csum {
CSUM_TCP,
CSUM_UDP6,
CSUM_TCP6,
+ CSUM_ICMP6,
};
struct counter {
diff --git a/trafgen_lexer.l b/trafgen_lexer.l
index da072e1..a6d12c1 100644
--- a/trafgen_lexer.l
+++ b/trafgen_lexer.l
@@ -143,6 +143,7 @@ ip6_addr ({v680}|{v67}|{v66}|{v65}|{v64}|{v63}|{v62}|{v61}|{v60})
"csumtcp" { return K_CSUMTCP; }
"csumudp6" { return K_CSUMUDP6; }
"csumtcp6" { return K_CSUMTCP6; }
+"csumicmp6" { return K_CSUMICMP6; }
"drnd" { return K_DRND; }
"dinc" { return K_DINC; }
"ddec" { return K_DDEC; }
diff --git a/trafgen_parser.y b/trafgen_parser.y
index 40aa230..7fffdd9 100644
--- a/trafgen_parser.y
+++ b/trafgen_parser.y
@@ -276,6 +276,7 @@ static inline bool is_dynamic_csum(enum csum which)
case CSUM_TCP:
case CSUM_UDP6:
case CSUM_TCP6:
+ case CSUM_ICMP6:
return true;
default:
return false;
@@ -515,7 +516,7 @@ static void proto_pop_sub_hdr(void)
}
%token K_COMMENT K_FILL K_RND K_SEQINC K_SEQDEC K_DRND K_DINC K_DDEC K_WHITE
-%token K_CPU K_CSUMIP K_CSUMUDP K_CSUMTCP K_CSUMUDP6 K_CSUMTCP6 K_CONST8 K_CONST16 K_CONST32 K_CONST64
+%token K_CPU K_CSUMIP K_CSUMUDP K_CSUMTCP K_CSUMUDP6 K_CSUMTCP6 K_CSUMICMP6 K_CONST8 K_CONST16 K_CONST32 K_CONST64
%token K_DADDR K_SADDR K_ETYPE K_TYPE
%token K_TIME K_PRIO
@@ -721,6 +722,8 @@ csum
{ set_csum16($3, $5, CSUM_TCP6); }
| K_CSUMUDP6 '(' number delimiter number ')'
{ set_csum16($3, $5, CSUM_UDP6); }
+ | K_CSUMICMP6 '(' number delimiter number ')'
+ { set_csum16($3, $5, CSUM_ICMP6); }
;
seqinc