]> rtime.felk.cvut.cz Git - sojka/can-utils.git/commitdiff
cangw: add semantic check for checksum options
authorOliver Hartkopp <socketcan@hartkopp.net>
Wed, 14 Nov 2012 19:20:38 +0000 (20:20 +0100)
committerOliver Hartkopp <socketcan@hartkopp.net>
Wed, 14 Nov 2012 19:20:38 +0000 (20:20 +0100)
The options to for adding checksums (-c or -x) can only be used in conjunction
with modifications (-m) applied to the routed CAN frames.

Signed-off-by: Andre Naujoks <nautsch2@googlemail.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
cangw.c

diff --git a/cangw.c b/cangw.c
index 5c111f94f3ec6580c9de32e50189ec838f63c144..3d6a23e9573ddf2d6b783f745bcd2b6d2a3f0d41 100644 (file)
--- a/cangw.c
+++ b/cangw.c
@@ -669,6 +669,11 @@ int main(int argc, char **argv)
                exit(1);
        }
 
+       if (!modidx && (have_cs_crc8 || have_cs_xor)) {
+               printf("-c or -x can only be used in conjunction with -m\n");
+               exit(1);
+       }
+
        s = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
 
        switch (cmd) {