[systemd-devel] [PATCH 06/11] test-icmp6-rs: Add trivial test case for a MTU that is not present

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Tue Jan 13 16:16:47 PST 2015


On Tue, Jan 13, 2015 at 02:02:16PM +0200, Patrik Flykt wrote:
> ---
>  src/libsystemd-network/test-icmp6-rs.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/src/libsystemd-network/test-icmp6-rs.c b/src/libsystemd-network/test-icmp6-rs.c
> index be64d33..8a42a34 100644
> --- a/src/libsystemd-network/test-icmp6-rs.c
> +++ b/src/libsystemd-network/test-icmp6-rs.c
> @@ -30,7 +30,7 @@ static struct ether_addr mac_addr = {
>          .ether_addr_octet = {'A', 'B', 'C', '1', '2', '3'}
>  };
>  
> -static bool verbose = false;
> +static bool verbose = true;
Is this indended? If yes, the maybe remove the switch altogether?

>  static sd_event_source *test_hangcheck;
>  static int test_fd[2];
>  
> @@ -93,6 +93,8 @@ static void test_rs_done(sd_icmp6_nd *nd, int event, void *userdata) {
>                  { ND_RA_FLAG_OTHER, ICMP6_EVENT_ROUTER_ADVERTISMENT_OTHER },
>                  { ND_RA_FLAG_MANAGED, ICMP6_EVENT_ROUTER_ADVERTISMENT_MANAGED }
>          };
> +        uint32_t mtu;
> +
>          assert_se(nd);
>  
>          assert_se(event == flag_event[idx].event);
> @@ -101,10 +103,14 @@ static void test_rs_done(sd_icmp6_nd *nd, int event, void *userdata) {
>          if (verbose)
>                  printf("  got event %d\n", event);
>  
> -        if (idx < 3)
> +        if (idx < 3) {
>                  send_ra(flag_event[idx].flag);
> -        else
> -                sd_event_exit(e, 0);
> +                return;
> +        }
> +
> +        assert_se(sd_icmp6_ra_get_mtu(nd, &mtu) == -ENOMSG);
> +
> +        sd_event_exit(e, 0);
>  }

Zbyszek


More information about the systemd-devel mailing list