Revision bce8a34b proto/rip/rip.c

View differences:

proto/rip/rip.c
96 96
      ipa_hton( packet->block[i].netmask );
97 97
      ipa_hton( packet->block[i].nexthop );
98 98

  
99
      if (i++ == 25) {
99
      if (i++ == ((P_CF->authtype == AT_MD5) ? PACKET_MD5_MAX : PACKET_MAX)) {
100 100
	FIB_ITERATE_PUT(&c->iter, z);
101 101
	goto break_loop;
102 102
      }
......
263 263

  
264 264
  switch( packet->heading.command ) {
265 265
  case RIPCMD_REQUEST: DBG( "Asked to send my routing table\n" ); 
266
    /* FIXME: should have configurable: ignore always, honour to neighbours, honour always. FIXME: use one global socket for these. FIXME: synchronization - if two ask me at same time */
267
    	  rip_sendto( p, whotoldme, port, NULL ); /* no broadcast */
266
	  if (P_CF->honour == HO_NEVER) {
267
	    log( L_WARN "They asked me to send routing table, but I was told not to do it\n" );
268
	    return 0;
269
	  }
270
	  if ((P_CF->honour == HO_NEIGHBOUR) && (!neigh_find( p, &whotoldme, 0 ))) {
271
	    log( L_WARN "They asked me to send routing table, but he is not my neighbour\n" );
272
	    return 0;
273
	  }
274
    	  rip_sendto( p, whotoldme, port, HEAD(P->interfaces) ); /* no broadcast */
268 275
          break;
269 276
  case RIPCMD_RESPONSE: DBG( "*** Rtable from %I\n", whotoldme ); 
270 277
          if (port != P_CF->port) {
......
281 288
	    return 0;
282 289
	  }
283 290

  
284
	  /* FIXME: Should check if it is not my own packet */
285

  
286 291
          for (i=0; i<num; i++) {
287 292
	    struct rip_block *block = &packet->block[i];
288 293
	    if (block->family == 0xffff)
......
487 492
  rif->sock->err_hook = rip_tx_err;
488 493
  rif->sock->daddr = IPA_NONE;
489 494
  rif->sock->dport = P_CF->port;
490
  rif->sock->ttl = 1; /* FIXME: care must be taken not to send requested responses from this socket */
495
  if (new)
496
    rif->sock->ttl = 1;
497
  else
498
    rif->sock->ttl = 30;
491 499
  rif->sock->tos = IP_PREC_INTERNET_CONTROL;
492 500

  
493 501
  if (flags & IF_BROADCAST)
......
504 512
  } else
505 513
    if (!(rif->patt->mode & IM_NOLISTEN))
506 514
      if (sk_open(rif->sock)<0) {
507
	log( L_WARN "RIP/%s: could not listen on %s", P_NAME, rif->iface ? rif->iface->name : "(dummy)" );
508
	/* FIXME: Don't try to transmit into this one */
515
	log( L_ERR "RIP/%s: could not listen on %s", P_NAME, rif->iface ? rif->iface->name : "(dummy)" );
516
	/* Don't try to transmit into this one? Well, why not? This should not happen, anyway :-) */
509 517
      }
510 518

  
511 519
  log( L_DEBUG "RIP/%s: listening on %s, port %d, mode %s", P_NAME, rif->iface ? rif->iface->name : "(dummy)", P_CF->port, want_multicast ? "multicast" : "broadcast" );

Also available in: Unified diff