Merge branch 'master' into security
Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
		
						commit
						ad58db0721
					
				
					 158 changed files with 6915 additions and 3361 deletions
				
			
		| 
						 | 
				
			
			@ -969,18 +969,24 @@ static void maybe_send_new_ping (dds_time_t tnow, dds_time_t *tnextping)
 | 
			
		|||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static uint32_t subthread_waitset (void *varg)
 | 
			
		||||
static dds_entity_t make_reader_waitset (dds_entity_t rd)
 | 
			
		||||
{
 | 
			
		||||
  struct subthread_arg * const arg = varg;
 | 
			
		||||
  dds_entity_t ws;
 | 
			
		||||
  int32_t rc;
 | 
			
		||||
  ws = dds_create_waitset (dp);
 | 
			
		||||
  if ((rc = dds_waitset_attach (ws, termcond, 0)) < 0)
 | 
			
		||||
    error2 ("dds_waitset_attach (termcond, 0): %d\n", (int) rc);
 | 
			
		||||
  if ((rc = dds_set_status_mask (rd_data, DDS_DATA_AVAILABLE_STATUS)) < 0)
 | 
			
		||||
    error2 ("dds_set_status_mask (rd_data, DDS_DATA_AVAILABLE_STATUS): %d\n", (int) rc);
 | 
			
		||||
  if ((rc = dds_waitset_attach (ws, rd_data, 1)) < 0)
 | 
			
		||||
    error2 ("dds_waitset_attach (ws, rd_data, 1): %d\n", (int) rc);
 | 
			
		||||
  if ((rc = dds_set_status_mask (rd, DDS_DATA_AVAILABLE_STATUS | DDS_SUBSCRIPTION_MATCHED_STATUS)) < 0)
 | 
			
		||||
    error2 ("dds_set_status_mask (rd, DDS_DATA_AVAILABLE_STATUS | DDS_SUBSCRIPTION_MATCHED_STATUS): %d\n", (int) rc);
 | 
			
		||||
  if ((rc = dds_waitset_attach (ws, rd, 1)) < 0)
 | 
			
		||||
    error2 ("dds_waitset_attach (ws, rd, 1): %d\n", (int) rc);
 | 
			
		||||
  return ws;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static uint32_t subthread_waitset (void *varg)
 | 
			
		||||
{
 | 
			
		||||
  struct subthread_arg * const arg = varg;
 | 
			
		||||
  dds_entity_t ws = make_reader_waitset (rd_data);
 | 
			
		||||
  while (!ddsrt_atomic_ld32 (&termflag))
 | 
			
		||||
  {
 | 
			
		||||
    if (!process_data (rd_data, arg))
 | 
			
		||||
| 
						 | 
				
			
			@ -998,15 +1004,7 @@ static uint32_t subthread_waitset (void *varg)
 | 
			
		|||
static uint32_t subpingthread_waitset (void *varg)
 | 
			
		||||
{
 | 
			
		||||
  struct subthread_arg * const arg = varg;
 | 
			
		||||
  dds_entity_t ws;
 | 
			
		||||
  int32_t rc;
 | 
			
		||||
  ws = dds_create_waitset (dp);
 | 
			
		||||
  if ((rc = dds_waitset_attach (ws, termcond, 0)) < 0)
 | 
			
		||||
    error2 ("dds_waitset_attach (termcond, 0): %d\n", (int) rc);
 | 
			
		||||
  if ((rc = dds_set_status_mask (rd_ping, DDS_DATA_AVAILABLE_STATUS)) < 0)
 | 
			
		||||
    error2 ("dds_set_status_mask (rd_ping, DDS_DATA_AVAILABLE_STATUS): %d\n", (int) rc);
 | 
			
		||||
  if ((rc = dds_waitset_attach (ws, rd_ping, 1)) < 0)
 | 
			
		||||
    error2 ("dds_waitset_attach (ws, rd_ping, 1): %d\n", (int) rc);
 | 
			
		||||
  dds_entity_t ws = make_reader_waitset (rd_ping);
 | 
			
		||||
  while (!ddsrt_atomic_ld32 (&termflag))
 | 
			
		||||
  {
 | 
			
		||||
    int32_t nxs;
 | 
			
		||||
| 
						 | 
				
			
			@ -1020,15 +1018,7 @@ static uint32_t subpingthread_waitset (void *varg)
 | 
			
		|||
static uint32_t subpongthread_waitset (void *varg)
 | 
			
		||||
{
 | 
			
		||||
  struct subthread_arg * const arg = varg;
 | 
			
		||||
  dds_entity_t ws;
 | 
			
		||||
  int32_t rc;
 | 
			
		||||
  ws = dds_create_waitset (dp);
 | 
			
		||||
  if ((rc = dds_waitset_attach (ws, termcond, 0)) < 0)
 | 
			
		||||
    error2 ("dds_waitset_attach (termcond, 0): %d\n", (int) rc);
 | 
			
		||||
  if ((rc = dds_set_status_mask (rd_pong, DDS_DATA_AVAILABLE_STATUS)) < 0)
 | 
			
		||||
    error2 ("dds_set_status_mask (rd_pong, DDS_DATA_AVAILABLE_STATUS): %d\n", (int) rc);
 | 
			
		||||
  if ((rc = dds_waitset_attach (ws, rd_pong, 1)) < 0)
 | 
			
		||||
    error2 ("dds_waitset_attach (ws, rd_pong, 1): %d\n", (int) rc);
 | 
			
		||||
  dds_entity_t ws = make_reader_waitset (rd_pong);
 | 
			
		||||
  while (!ddsrt_atomic_ld32 (&termflag))
 | 
			
		||||
  {
 | 
			
		||||
    int32_t nxs;
 | 
			
		||||
| 
						 | 
				
			
			@ -1101,7 +1091,7 @@ static dds_entity_t create_pong_writer (dds_instance_handle_t pphandle, const st
 | 
			
		|||
  return wr_pong;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void delete_pong_writer (dds_instance_handle_t pphandle)
 | 
			
		||||
static dds_entity_t delete_pong_writer (dds_instance_handle_t pphandle)
 | 
			
		||||
{
 | 
			
		||||
  uint32_t i = 0;
 | 
			
		||||
  dds_entity_t wr_pong = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -1118,8 +1108,7 @@ static void delete_pong_writer (dds_instance_handle_t pphandle)
 | 
			
		|||
    }
 | 
			
		||||
  }
 | 
			
		||||
  ddsrt_mutex_unlock (&pongwr_lock);
 | 
			
		||||
  if (wr_pong)
 | 
			
		||||
    dds_delete (wr_pong);
 | 
			
		||||
  return wr_pong;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void free_ppant (void *vpp)
 | 
			
		||||
| 
						 | 
				
			
			@ -1143,6 +1132,7 @@ static void participant_data_listener (dds_entity_t rd, void *arg)
 | 
			
		|||
    if (info.instance_state != DDS_ALIVE_INSTANCE_STATE)
 | 
			
		||||
    {
 | 
			
		||||
      ddsrt_avl_dpath_t dpath;
 | 
			
		||||
      dds_entity_t pong_wr_to_del = 0;
 | 
			
		||||
      ddsrt_mutex_lock (&disc_lock);
 | 
			
		||||
      if ((pp = ddsrt_avl_lookup_dpath (&ppants_td, &ppants, &info.instance_handle, &dpath)) != NULL)
 | 
			
		||||
      {
 | 
			
		||||
| 
						 | 
				
			
			@ -1151,7 +1141,7 @@ static void participant_data_listener (dds_entity_t rd, void *arg)
 | 
			
		|||
 | 
			
		||||
        if (pp->handle != dp_handle || ignorelocal == DDS_IGNORELOCAL_NONE)
 | 
			
		||||
        {
 | 
			
		||||
          delete_pong_writer (pp->handle);
 | 
			
		||||
          pong_wr_to_del = delete_pong_writer (pp->handle);
 | 
			
		||||
          n_pong_expected_delta--;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1161,6 +1151,7 @@ static void participant_data_listener (dds_entity_t rd, void *arg)
 | 
			
		|||
        free_ppant (pp);
 | 
			
		||||
      }
 | 
			
		||||
      ddsrt_mutex_unlock (&disc_lock);
 | 
			
		||||
      dds_delete (pong_wr_to_del);
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			@ -1171,6 +1162,7 @@ static void participant_data_listener (dds_entity_t rd, void *arg)
 | 
			
		|||
      /* only add unknown participants with the magic user_data value: DDSPerf:X:HOSTNAME, where X is decimal  */
 | 
			
		||||
      if (dds_qget_userdata (sample->qos, &vudata, &usz) && usz > 0)
 | 
			
		||||
      {
 | 
			
		||||
        bool make_pongwr = false;
 | 
			
		||||
        const char *udata = vudata;
 | 
			
		||||
        int has_reader, pos;
 | 
			
		||||
        long pid;
 | 
			
		||||
| 
						 | 
				
			
			@ -1199,15 +1191,17 @@ static void participant_data_listener (dds_entity_t rd, void *arg)
 | 
			
		|||
            ddsrt_fibheap_insert (&ppants_to_match_fhd, &ppants_to_match, pp);
 | 
			
		||||
            ddsrt_avl_insert_ipath (&ppants_td, &ppants, pp, &ipath);
 | 
			
		||||
 | 
			
		||||
            if (pp->handle != dp_handle || ignorelocal == DDS_IGNORELOCAL_NONE)
 | 
			
		||||
            {
 | 
			
		||||
              struct guidstr guidstr;
 | 
			
		||||
              make_guidstr (&guidstr, &sample->key);
 | 
			
		||||
              create_pong_writer (pp->handle, &guidstr);
 | 
			
		||||
              n_pong_expected_delta++;
 | 
			
		||||
            }
 | 
			
		||||
            make_pongwr = (pp->handle != dp_handle || ignorelocal == DDS_IGNORELOCAL_NONE);
 | 
			
		||||
          }
 | 
			
		||||
          ddsrt_mutex_unlock (&disc_lock);
 | 
			
		||||
 | 
			
		||||
          if (make_pongwr)
 | 
			
		||||
          {
 | 
			
		||||
            struct guidstr guidstr;
 | 
			
		||||
            make_guidstr (&guidstr, &sample->key);
 | 
			
		||||
            create_pong_writer (pp->handle, &guidstr);
 | 
			
		||||
            n_pong_expected_delta++;
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        dds_free (vudata);
 | 
			
		||||
      }
 | 
			
		||||
| 
						 | 
				
			
			@ -1312,8 +1306,8 @@ static void subscription_matched_listener (dds_entity_t rd, const dds_subscripti
 | 
			
		|||
static void publication_matched_listener (dds_entity_t wr, const dds_publication_matched_status_t status, void *arg)
 | 
			
		||||
{
 | 
			
		||||
  /* this only works because the listener is called for every match; but I don't think that is something the
 | 
			
		||||
   spec guarantees, and I don't think Cyclone should guarantee that either -- and if it isn't guaranteed
 | 
			
		||||
   _really_ needs the get_matched_... interfaces to not have to implement the matching logic ... */
 | 
			
		||||
     spec guarantees, and I don't think Cyclone should guarantee that either -- and if it isn't guaranteed
 | 
			
		||||
     _really_ needs the get_matched_... interfaces to not have to implement the matching logic ... */
 | 
			
		||||
  (void) wr;
 | 
			
		||||
  if (status.current_count_change > 0)
 | 
			
		||||
  {
 | 
			
		||||
| 
						 | 
				
			
			@ -1326,8 +1320,8 @@ static void publication_matched_listener (dds_entity_t wr, const dds_publication
 | 
			
		|||
static void set_data_available_listener (dds_entity_t rd, const char *rd_name, dds_on_data_available_fn fn, void *arg)
 | 
			
		||||
{
 | 
			
		||||
  /* This convoluted code is so that we leave all listeners unchanged, except the
 | 
			
		||||
   data_available one.  There is no real need for these complications, but it is
 | 
			
		||||
   a nice exercise. */
 | 
			
		||||
     data_available one.  There is no real need for these complications, but it is
 | 
			
		||||
     a nice exercise. */
 | 
			
		||||
  dds_listener_t *listener = dds_create_listener (arg);
 | 
			
		||||
  dds_return_t rc;
 | 
			
		||||
  dds_lset_data_available (listener, fn);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,6 +36,7 @@ for (@showopts) {
 | 
			
		|||
my $topfmt = "%${topcolwidth}.${topcolwidth}s";
 | 
			
		||||
my $guidre = "[0-9a-f]+(?::[0-9a-f]+){3}";
 | 
			
		||||
my $gidre = "[0-9a-f]+(?::[0-9a-f]+){2}";
 | 
			
		||||
my $leasere = "(?:L\\((?:[a-z]+ )?[0-9a-f:]+\\s+[0-9.]+\\)\\s*)+";
 | 
			
		||||
my %opstr = ("00" => "R  ", "01" => "W  ", # index by $stinfo.$dflag
 | 
			
		||||
             "10" => " D ", "11" => "WD ",
 | 
			
		||||
             "20" => "  U", "21" => "W U",
 | 
			
		||||
| 
						 | 
				
			
			@ -258,7 +259,7 @@ while(<>) {
 | 
			
		|||
  # decent proxy for that.
 | 
			
		||||
  #
 | 
			
		||||
  # FIXME: find a way of dealing with decimal representation ...
 | 
			
		||||
  if (/: ACKNACK\(F?#\d+:(\d+)\/(\d+):[01]* (?:L\([0-9a-f:]+\s+[0-9.]+\)\s*)?([0-9a-f]+(?::[0-9a-f]+){2}:[234]c7) -\> ([0-9a-f]+(?::[0-9a-f]+){2}:[234]c2) .*?(happy-now)?/) {
 | 
			
		||||
  if (/: ACKNACK\(F?#\d+:(\d+)\/(\d+):[01]* (?:$leasere)?([0-9a-f]+(?::[0-9a-f]+){2}:[234]c7) -\> ([0-9a-f]+(?::[0-9a-f]+){2}:[234]c2) .*?(happy-now)?/) {
 | 
			
		||||
    if (defined $5 || ($1 > 1 && $2 == 0 && version_at_least(6,6,4))) {
 | 
			
		||||
      # happy-now should be enough, but historically DDSI2 advertised only data present in the WHC,
 | 
			
		||||
      # which caused happy-now to not show up if the historical data ended on an unregister, because
 | 
			
		||||
| 
						 | 
				
			
			@ -266,7 +267,7 @@ while(<>) {
 | 
			
		|||
      # last one written (that is, unregistered) (fixed in 6.6.4)
 | 
			
		||||
      check_disccomplete("A", $3);
 | 
			
		||||
    }
 | 
			
		||||
  } elsif (/: HEARTBEAT\(F?#\d+:(\d+)\.\.(\d+)\s+(?:L\([0-9a-f:]+\s+[0-9.]+\)\s*)?([0-9a-f]+(?::[0-9a-f]+){2}:[234]c2)/) {
 | 
			
		||||
  } elsif (/: HEARTBEAT\(F?L?#\d+:(\d+)\.\.(\d+)\s+(?:$leasere)?([0-9a-f]+(?::[0-9a-f]+){2}:[234]c2)/) {
 | 
			
		||||
    check_disccomplete("H", $3);
 | 
			
		||||
    # if there is no data and final is set there might be no ACK
 | 
			
		||||
    check_disccomplete("B", $3) if $2 < $1;
 | 
			
		||||
| 
						 | 
				
			
			@ -351,8 +352,10 @@ while(<>) {
 | 
			
		|||
    $rwguid{$tid} = $guid; # if $is_cyclone;
 | 
			
		||||
    die "$guid $rwguid{$tid}" unless $guid eq $rwguid{$tid};
 | 
			
		||||
    my $topic; my $type; my $groupcoh; my $partitions; my $keepall;
 | 
			
		||||
    if ($3 =~ /topic=([^,]+?),type=([^,]+?).*?,presentation=(\d:\d):\d,partition=\{([^}]*?)\}.*?,history=([01]):/) {
 | 
			
		||||
      $topic = $1; $type = $2; $groupcoh = ($3 eq "2:1"); $partitions = $4; $keepall = $5;
 | 
			
		||||
    if ($qos =~ /topic(?:_name)?=([^,]+?),type(?:_name)=([^,]+?).*?,partition=\{([^}]*?)\}/) {
 | 
			
		||||
      $topic = $1; $type = $2; $partitions = $3;
 | 
			
		||||
      die unless $qos =~ /,history=([01]):/; $keepall = $1;
 | 
			
		||||
      die unless $qos =~ /,presentation=(\d:\d):\d/; $groupcoh = ($1 eq "2:1");
 | 
			
		||||
      unless (defined $rwguid{$tid} && ($ftrflag{$tid} || (defined $psgid{$tid} && defined $psguid{$tid} && defined $rwgid{$tid})) || 1) { # $is_cyclone
 | 
			
		||||
        die;
 | 
			
		||||
      }
 | 
			
		||||
| 
						 | 
				
			
			@ -622,15 +625,14 @@ while(<>) {
 | 
			
		|||
    my $h = ($kind eq "READER") ? \%prd : \%pwr;
 | 
			
		||||
    my $hk = ($kind eq "READER") ? "prd" : "pwr";
 | 
			
		||||
    my $qos = $3;
 | 
			
		||||
    unless ($3 =~ /topic=([^,]+?),type=([^,]+?),presentation=(\d+):\d+:\d+,partition=\{([^}]*?)\}.*?,durability=(\d+)/) {
 | 
			
		||||
    unless ($3 =~ /topic(?:_name)?=([^,]+?),type(?:_name)?=([^,]+?),(?:.+?,)?partition=\{([^}]*?)\}/) {
 | 
			
		||||
      die unless $prwguid =~ /[4c][27]$/;
 | 
			
		||||
    }
 | 
			
		||||
    my $topic = $1; my $type = $2; my $access_scope = $3; my $partitions = $4; my $durkind = $5;
 | 
			
		||||
    my $topic = $1; my $type = $2; my $partitions = $3;
 | 
			
		||||
    (my $ppguid = $prwguid) =~ s/:[0-9a-f]+$/:1c1/;
 | 
			
		||||
    die unless exists $proxypp{$ppguid} && !defined $proxypp{$ppguid}->{tdel};
 | 
			
		||||
    my @ps = split ',', $partitions;
 | 
			
		||||
    my $stopic = make_stopic($partitions, $topic);
 | 
			
		||||
    #print "$kind $topic\n" if $durkind >= 2 && ($kind eq "READER" || $access_scope >= 2);
 | 
			
		||||
    my $prw = { guid => $prwguid, ppguid => $ppguid,
 | 
			
		||||
                topic => $topic, stopic => $stopic, type => $type, partition => \@ps,
 | 
			
		||||
                matches => {}, checklost => 0, suppressbegin => 0, tcreate => $ts, tstamps => {} };
 | 
			
		||||
| 
						 | 
				
			
			@ -745,7 +747,7 @@ while(<>) {
 | 
			
		|||
        if $nlost > 0 && $shows{rematch};
 | 
			
		||||
      delete $prd->{matches}->{$wrguid}->{seqp1del};
 | 
			
		||||
    }
 | 
			
		||||
  } elsif (/ACKNACK\(F?#\d+:(\d+)\/\d+:([01]*) (?:L\(:1c1 [0-9.]+\) )?($guidre) -> ($guidre)(\??)/o) {
 | 
			
		||||
  } elsif (/ACKNACK\(F?#\d+:(\d+)\/\d+:([01]*) (?:$leasere)?($guidre) -> ($guidre)(\??)/o) {
 | 
			
		||||
    my $seqp1 = $1; my $nackset = $2; my $prdguid = hexify($3); my $wrguid = hexify($4); my $wrknown = ($5 eq "");
 | 
			
		||||
    my $wr = $wr{$wrguid};
 | 
			
		||||
    my $cnt = ($nackset =~ y/1//);
 | 
			
		||||
| 
						 | 
				
			
			@ -904,7 +906,7 @@ while(<>) {
 | 
			
		|||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  } elsif (/HEARTBEAT\(F?#\d+:(\d+)\.\.(\d+) ($guidre)/o) {
 | 
			
		||||
  } elsif (/HEARTBEAT\(F?L?#\d+:(\d+)\.\.(\d+) ($guidre)/o) {
 | 
			
		||||
    my $prdguid = hexify($3);
 | 
			
		||||
    (my $ppguid = $prdguid) =~ s/:[0-9a-f]+$/:1c1/;
 | 
			
		||||
    $proxypp{$ppguid}->{non_spdp_seen} = 1 if exists $proxypp{$ppguid} && !defined $proxypp{$ppguid}->{tdel};
 | 
			
		||||
| 
						 | 
				
			
			@ -1475,7 +1477,7 @@ not necessarily the 4th field in, say, AWK):
 | 
			
		|||
EOT
 | 
			
		||||
    ;
 | 
			
		||||
  exit 1;
 | 
			
		||||
  return; 
 | 
			
		||||
  return;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub fmtblurb {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue