public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <antonio@meshcoding.com>
To: "The list for a Better Approach To Mobile Ad-hoc Networking"
	<b.a.t.m.a.n@lists.open-mesh.org>,
	"Linus Lüssing" <linus.luessing@web.de>
Subject: Re: [B.A.T.M.A.N.] [PATCH 3/3] batctl: add unicast/multicast address filter option for TT output
Date: Thu, 27 Feb 2014 13:24:01 +0100	[thread overview]
Message-ID: <530F2E61.5060203@meshcoding.com> (raw)
In-Reply-To: <1393215104-28184-3-git-send-email-linus.luessing@web.de>

[-- Attachment #1: Type: text/plain, Size: 2209 bytes --]

On 24/02/14 05:11, Linus Lüssing wrote:
> @@ -138,6 +143,26 @@ int handle_debug_table(char *mesh_iface, int debug_table, int argc, char **argv)
>  		case 'H':
>  			read_opt |= SKIP_HEADER;
>  			break;
> +		case 'u':
> +			if (debug_table != BATCTL_TABLE_TRANSLOCAL &&
> +			    debug_table != BATCTL_TABLE_TRANSGLOBAL) {
> +				fprintf(stderr, "Error - unrecognised option '-%c'\n", optchar);
> +				debug_table_usage(debug_table);
> +				return EXIT_FAILURE;
> +			}
> +
> +			read_opt |= UNICAST_ONLY;
> +			break;
> +		case 'm':
> +			if (debug_table != BATCTL_TABLE_TRANSLOCAL &&
> +			    debug_table != BATCTL_TABLE_TRANSGLOBAL) {
> +				fprintf(stderr, "Error - unrecognised option '-%c'\n", optchar);
> +				debug_table_usage(debug_table);
> +				return EXIT_FAILURE;
> +			}
> +
> +			read_opt |= MULTICAST_ONLY;
> +			break;

do we really want to allow the user to specify both flags? Or should we
throw an error in that case? I think the second option would be better, no?

>  		case '?':
>  			if (optopt == 't')
>  				fprintf(stderr, "Error - option '-t' needs a number as argument\n");
> diff --git a/functions.c b/functions.c
> index 36804bd..41eabb2 100644
> --- a/functions.c
> +++ b/functions.c
> @@ -224,6 +224,22 @@ read:
>  			    && (last_seen > orig_timeout))
>  				continue;
>  
> +		/* translation table: skip multicast */
> +		if (line > header_lines &&
> +		    read_opt & UNICAST_ONLY &&
> +		    strlen(line_ptr) > strlen(" * xx:xx:xx:") &&
> +		    (!strncmp(line_ptr+3, "33:33:", strlen("33:33:")) ||
> +		     !strncmp(line_ptr+3, "01:00:5e:", strlen("01:00:5e:"))))
> +			continue;
> +
> +		/* translation table: skip unicast */
> +		if (line > header_lines &&
> +		    read_opt & MULTICAST_ONLY &&
> +		    strlen(line_ptr) > strlen(" * xx:xx:xx:") &&
> +		    strncmp(line_ptr+3, "33:33:", strlen("33:33:")) &&
> +		    strncmp(line_ptr+3, "01:00:5e:", strlen("01:00:5e:")))
> +			continue;
> +

why not just converting to an integer the first octect of the MAC
address and checking for the multicast bit being set or not? Wouldn't
that be more elegant and generic?



Cheers,

-- 
Antonio Quartulli


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2014-02-27 12:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-24  4:11 [B.A.T.M.A.N.] [PATCH 1/3] batctl: fix wrong header lines number for local translation table Linus Lüssing
2014-02-24  4:11 ` [B.A.T.M.A.N.] [PATCH 2/3] batctl: add switch for setting multicast_mode Linus Lüssing
2014-02-24  4:11 ` [B.A.T.M.A.N.] [PATCH 3/3] batctl: add unicast/multicast address filter option for TT output Linus Lüssing
2014-02-27 12:24   ` Antonio Quartulli [this message]
2014-02-27 10:28 ` [B.A.T.M.A.N.] [PATCH 1/3] batctl: fix wrong header lines number for local translation table Antonio Quartulli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=530F2E61.5060203@meshcoding.com \
    --to=antonio@meshcoding.com \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=linus.luessing@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox