+ switch( opt )
+ {
+ case 's':
+ src_port = atoi( optarg );
+ opt_flag |= GW_SRC_PORT_BIT;
+ break;
+ case 'd':
+ dest_port = atoi( optarg );
+ opt_flag |= GW_DEST_PORT_BIT;
+ break;
+ case 'f':
+ if( sscanf( optarg, "%x:%x", &flt.can_id,
+ &flt.can_mask ) != 2 )
+ {
+ fprintf( stderr, "error:\
+ bad filter format\n");
+ goto gw_error;
+ }
+ opt_flag |= GW_FILTER_BIT;
+ break;
+ case 'i':
+ ifr.ifr_ifindex = if_nametoindex( optarg );
+ if( ifr.ifr_ifindex == 0 )
+ {
+ fprintf( stderr, "error: if_nametoindex\n" );
+ goto gw_error;
+ }
+ opt_flag |= GW_IF_BIT;
+ break;
+ }
+ }
+
+ if( !((opt_flag & GW_SRC_PORT_BIT) && (opt_flag & GW_DEST_PORT_BIT)
+ && (opt_flag & GW_DEST_PORT_BIT)) )
+ {
+ fprintf( stdout, "bad usage, example -i vcan0 -s 10501 -d 10502 -f 007:00000007\n" );