+ if (flags & GRE_COP) {
+ int checksum, offset;
+
+ TCHECK2(*cp, 4);
+ checksum = EXTRACT_16BITS(cp);
+ offset = EXTRACT_16BITS(cp + 2);
+
+ if (flags & GRE_CP) {
+ /* Checksum present */
+
+ /* todo: check checksum */
+ if (vflag > 1)
+ printf("C:%04x ", checksum);
+ }
+ if (flags & GRE_RP) {
+ /* Offset present */
+
+ if (vflag > 1)
+ printf("O:%04x ", offset);
+ }
+ cp += 4; /* skip checksum and offset */
+ }
+ if (flags & GRE_KP) {
+ TCHECK2(*cp, 4);
+ if (ver == 1) { /* PPTP */
+ if (vflag > 1)
+ printf("PL:%u ", EXTRACT_16BITS(cp));
+ printf("ID:%04x ", EXTRACT_16BITS(cp+2));
+ }
+ else
+ printf("K:%08x ", EXTRACT_32BITS(cp));
+ cp += 4; /* skip key */
+ }
+ if (flags & GRE_SP) {
+ TCHECK2(*cp, 4);
+ printf("S:%u ", EXTRACT_32BITS(cp));
+ cp += 4; /* skip seq */
+ }
+ if (flags & GRE_AP && ver >= 1) {
+ TCHECK2(*cp, 4);
+ printf("A:%u ", EXTRACT_32BITS(cp));
+ cp += 4; /* skip ack */
+ }