From: Oliver Hartkopp Date: Wed, 14 Nov 2012 19:20:38 +0000 (+0100) Subject: cangw: add semantic check for checksum options X-Git-Url: https://rtime.felk.cvut.cz/gitweb/sojka/can-utils.git/commitdiff_plain/f123d73d9a23c9c101ee1a48b1f117e69f95dea0?hp=d166ecc8a36759ca05aeb2d4e2eec744c9dfb886 cangw: add semantic check for checksum options 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 Signed-off-by: Oliver Hartkopp --- diff --git a/cangw.c b/cangw.c index 5c111f9..3d6a23e 100644 --- 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) {