summaryrefslogtreecommitdiffstats
path: root/src/scripts/vnet/arp4-mpls
blob: d3d39f3b9216016fc9e25a0709b81b289c73917c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
packet-generator new {
  name x
  limit 1
  node ip4-input
  size 64-64
  no-recycle
  data {
    ICMP: 1.0.0.2 -> 2.2.2.2
    ICMP echo_request
    incrementing 100
  }
}

loop create
loop create
set int state loop0 up
set int state loop1 up

set int ip address loop0 1.0.0.1/24
set int ip address loop1 2.0.0.1/24

ip route add 2.2.2.2/32 via 2.0.0.2 loop1 out-label 33

trace add pg-input 100
ariable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*
 * Copyright (c) 2015 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
  Copyright (c) 2005 Eliot Dresselhaus

  Permission is hereby granted, free of charge, to any person obtaining
  a copy of this software and associated documentation files (the
  "Software"), to deal in the Software without restriction, including
  without limitation the rights to use, copy, modify, merge, publish,
  distribute, sublicense, and/or sell copies of the Software, and to
  permit persons to whom the Software is furnished to do so, subject to
  the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#include <vppinfra/random_buffer.h>

/* Fill random buffer. */
void
clib_random_buffer_fill (clib_random_buffer_t * b, uword n_words)
{
  uword *w, n = n_words;

  if (n < 256)
    n = 256;

  n = round_pow2 (n, 2 << ISAAC_LOG2_SIZE);

  vec_add2 (b->buffer, w, n);
  do
    {
      isaac2 (b->ctx, w);
      w += 2 * ISAAC_SIZE;
      n -= 2 * ISAAC_SIZE;
    }
  while (n > 0);
}

void
clib_random_buffer_init (clib_random_buffer_t * b, uword seed)
{
  uword i, j;

  clib_memset (b, 0, sizeof (b[0]));

  /* Seed ISAAC. */
  for (i = 0; i < ARRAY_LEN (b->ctx); i++)
    {
      uword s[ISAAC_SIZE];

      for (j = 0; j < ARRAY_LEN (s); j++)
	s[j] = ARRAY_LEN (b->ctx) * (seed + j) + i;

      isaac_init (&b->ctx[i], s);
    }
}

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */