about summary refs log tree commit diff
path: root/inet/tst-inet6_rth.c
blob: 454a13f6b64c2ebe1eacc8b5b1834a27182fefd6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <stdio.h>
#include <netinet/ip6.h>

static int
do_test (void)
{
  int res = 0;
  char buf[1000];
  void *p = inet6_rth_init (buf, 24, IPV6_RTHDR_TYPE_0, 0);
  if (p == NULL)
    {
      puts ("first inet6_rth_init failed");
      res = 1;
    }
  else if (inet6_rth_add (p, &in6addr_any) == 0)
    {
      puts ("first inet6_rth_add succeeded");
      res = 1;
    }

  p = inet6_rth_init (buf, 24, IPV6_RTHDR_TYPE_0, 1);
  if (p == NULL)
    {
      puts ("second inet6_rth_init failed");
      res = 1;
    }
  else if (inet6_rth_add (p, &in6addr_any) != 0)
    {
      puts ("second inet6_rth_add failed");
      res = 1;
    }
  return res;
}

#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"