-/*
- * $Id$
- */
-
/*
* cangw.c - manage PF_CAN netlink gateway
*
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
- * Send feedback to <socketcan-users@lists.berlios.de>
+ * Send feedback to <linux-can@vger.kernel.org>
*
*/
ptr++;
}
- if (sscanf(++ptr, "%lx.%hhx.%16s",
- (long unsigned int *)&modmsg->cf.can_id,
+ if (sscanf(++ptr, "%x.%hhx.%16s", &modmsg->cf.can_id,
(unsigned char *)&modmsg->cf.can_dlc, hexdata) != 3)
return 5;
break;
case 'f':
- if (sscanf(optarg, "%lx:%lx",
- (long unsigned int *)&filter.can_id,
- (long unsigned int *)&filter.can_mask) == 2) {
+ if (sscanf(optarg, "%x:%x", &filter.can_id,
+ &filter.can_mask) == 2) {
have_filter = 1;
- } else if (sscanf(optarg, "%lx~%lx",
- (long unsigned int *)&filter.can_id,
- (long unsigned int *)&filter.can_mask) == 2) {
+ } else if (sscanf(optarg, "%x~%x", &filter.can_id,
+ &filter.can_mask) == 2) {
filter.can_id |= CAN_INV_FILTER;
have_filter = 1;
} else {
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) {