Browse code

- coding style (mainly identations) & some comments / spelling

Andrei Pelinescu-Onciul authored on 09/10/2007 19:56:08
Showing 4 changed files
... ...
@@ -77,7 +77,7 @@ MAIN_NAME=ser
77 77
 VERSION = 2
78 78
 PATCHLEVEL = 1
79 79
 SUBLEVEL =  0
80
-EXTRAVERSION = -dev11
80
+EXTRAVERSION = -dev12
81 81
 
82 82
 SER_VER = $(shell expr $(VERSION) \* 1000000 + $(PATCHLEVEL) \* 1000 + \
83 83
 			$(SUBLEVEL) )
... ...
@@ -424,7 +424,7 @@ DEFS+= $(extra_defs) \
424 424
 	 -DOS='$(OS)_' -DOS_QUOTED='"$(OS)"' -DCOMPILER='"$(CC_VER)"' -D__CPU_$(ARCH) -D__OS_$(OS) \
425 425
 	 -DSER_VER=$(SER_VER) \
426 426
 	 -DCFG_DIR='"$(cfg_target)"'\
427
-         -DMODS_DIR='"$(modules_target)"'\
427
+	 -DMODS_DIR='"$(modules_target)"'\
428 428
 	 -DPKG_MALLOC \
429 429
 	 -DSHM_MEM  -DSHM_MMAP \
430 430
 	 -DDNS_IP_HACK \
... ...
@@ -3316,83 +3316,92 @@ static char *print_type(unsigned short type)
3316 3316
 /* dumps the content of the cache in a human-readable format */
3317 3317
 void dns_cache_view(rpc_t* rpc, void* ctx)
3318 3318
 {
3319
-  int h;
3320
-  struct dns_hash_entry* e;
3321
-  struct dns_rr* rr;
3322
-  struct ip_addr ip;
3323
-  ticks_t now;
3324
-  str s;
3325
-
3326
-  now=get_ticks_raw();
3327
-  LOCK_DNS_HASH();
3328
-  for (h=0; h<DNS_HASH_SIZE; h++){
3329
-    clist_foreach(&dns_hash[h], e, next){
3330
-      rpc->printf(ctx, "{\n%sname: %s", SPACE_FORMAT, e->name);
3331
-      rpc->printf(ctx, "%stype: %s", SPACE_FORMAT, print_type(e->type));
3332
-      rpc->printf(ctx, "%ssize (bytes): %d", SPACE_FORMAT, e->total_size);
3333
-      rpc->printf(ctx, "%sreference counter: %d", SPACE_FORMAT, e->refcnt.val);
3334
-      rpc->printf(ctx, "%sexpires in (s): %d", SPACE_FORMAT,
3335
-                   (s_ticks_t)(e->expire-now)<0?-1: TICKS_TO_S(e->expire-now));
3336
-      rpc->printf(ctx, "%slast used (s): %d", SPACE_FORMAT, TICKS_TO_S(now-e->last_used));
3337
-      rpc->printf(ctx, "%serror flags: %d", SPACE_FORMAT, e->err_flags);
3338
-
3339
-      for (rr=e->rr_lst; rr; rr=rr->next) {
3340
-        switch(e->type) {
3341
-          case T_A:
3342
-          case T_AAAA:
3343
-            if (dns_rr2ip(e->type, rr, &ip)==0){
3344
-              rpc->printf(ctx, "%srr ip: %s", SPACE_FORMAT, ip_addr2a(&ip) );
3345
-            }else{
3346
-              rpc->printf(ctx, "%srr ip: <error: bad rr>", SPACE_FORMAT);
3347
-            }
3348
-            break;
3349
-          case T_SRV:
3350
-            rpc->printf(ctx, "%srr name: %s", SPACE_FORMAT,
3351
-                                ((struct srv_rdata*)(rr->rdata))->name);
3352
-            rpc->printf(ctx, "%srr port: %d", SPACE_FORMAT,
3353
-                                ((struct srv_rdata*)(rr->rdata))->port);
3354
-            rpc->printf(ctx, "%srr priority: %d", SPACE_FORMAT,
3355
-                                ((struct srv_rdata*)(rr->rdata))->priority);
3356
-            rpc->printf(ctx, "%srr weight: %d", SPACE_FORMAT,
3357
-                                ((struct srv_rdata*)(rr->rdata))->weight);
3358
-            break;
3359
-          case T_NAPTR:
3360
-            rpc->printf(ctx, "%srr order: %d", SPACE_FORMAT,
3361
-                                ((struct naptr_rdata*)(rr->rdata))->order);
3362
-            rpc->printf(ctx, "%srr preference: %d", SPACE_FORMAT,
3363
-                                ((struct naptr_rdata*)(rr->rdata))->pref);
3364
-
3365
-            s.s = ((struct naptr_rdata*)(rr->rdata))->flags;
3366
-            s.len = ((struct naptr_rdata*)(rr->rdata))->flags_len;
3367
-            rpc->printf(ctx, "%srr flags: %.*s", SPACE_FORMAT, s.len, s.s);
3368
-
3369
-            s.s = ((struct naptr_rdata*)(rr->rdata))->services;
3370
-            s.len = ((struct naptr_rdata*)(rr->rdata))->services_len;
3371
-            rpc->printf(ctx, "%srr service: %.*s", SPACE_FORMAT, s.len, s.s);
3372
-
3373
-            s.s = ((struct naptr_rdata*)(rr->rdata))->regexp;
3374
-            s.len = ((struct naptr_rdata*)(rr->rdata))->regexp_len;
3375
-            rpc->printf(ctx, "%srr regexp: %.*s", SPACE_FORMAT, s.len, s.s);
3376
-
3377
-            s.s = ((struct naptr_rdata*)(rr->rdata))->repl;
3378
-            s.len = ((struct naptr_rdata*)(rr->rdata))->repl_len;
3379
-            rpc->printf(ctx, "%srr replacement: %.*s", SPACE_FORMAT, s.len, s.s);
3380
-            break;
3381
-          case T_CNAME:
3382
-            rpc->printf(ctx, "%srr name: %s", SPACE_FORMAT,
3383
-                              ((struct cname_rdata*)(rr->rdata))->name);
3384
-            break;
3385
-          default:
3386
-            rpc->printf(ctx, "%sresource record: unknown", SPACE_FORMAT);
3387
-        }
3388
-        rpc->printf(ctx, "%srr expires in (s): %d", SPACE_FORMAT,
3389
-                (s_ticks_t)(rr->expire-now)<0?-1 : TICKS_TO_S(rr->expire-now));
3390
-        rpc->printf(ctx, "%srr error flags: %d", SPACE_FORMAT, rr->err_flags);
3391
-      }
3392
-      rpc->printf(ctx, "}");
3393
-    }
3394
-  }
3395
-  UNLOCK_DNS_HASH();
3319
+	int h;
3320
+	struct dns_hash_entry* e;
3321
+	struct dns_rr* rr;
3322
+	struct ip_addr ip;
3323
+	ticks_t now;
3324
+	str s;
3325
+
3326
+	now=get_ticks_raw();
3327
+	LOCK_DNS_HASH();
3328
+	for (h=0; h<DNS_HASH_SIZE; h++){
3329
+		clist_foreach(&dns_hash[h], e, next){
3330
+			rpc->printf(ctx, "{\n%sname: %s", SPACE_FORMAT, e->name);
3331
+			rpc->printf(ctx, "%stype: %s", SPACE_FORMAT, print_type(e->type));
3332
+			rpc->printf(ctx, "%ssize (bytes): %d", SPACE_FORMAT,
3333
+								e->total_size);
3334
+			rpc->printf(ctx, "%sreference counter: %d", SPACE_FORMAT,
3335
+								e->refcnt.val);
3336
+			rpc->printf(ctx, "%sexpires in (s): %d", SPACE_FORMAT,
3337
+								(s_ticks_t)(e->expire-now)<0?-1:
3338
+								TICKS_TO_S(e->expire-now));
3339
+			rpc->printf(ctx, "%slast used (s): %d", SPACE_FORMAT,
3340
+								TICKS_TO_S(now-e->last_used));
3341
+			rpc->printf(ctx, "%serror flags: %d", SPACE_FORMAT, e->err_flags);
3342
+			
3343
+			for (rr=e->rr_lst; rr; rr=rr->next) {
3344
+				switch(e->type) {
3345
+					case T_A:
3346
+					case T_AAAA:
3347
+						if (dns_rr2ip(e->type, rr, &ip)==0){
3348
+						  rpc->printf(ctx, "%srr ip: %s", SPACE_FORMAT,
3349
+								  			ip_addr2a(&ip) );
3350
+						}else{
3351
+						  rpc->printf(ctx, "%srr ip: <error: bad rr>", 
3352
+								  			SPACE_FORMAT);
3353
+						}
3354
+						break;
3355
+					case T_SRV:
3356
+						rpc->printf(ctx, "%srr name: %s", SPACE_FORMAT,
3357
+									((struct srv_rdata*)(rr->rdata))->name);
3358
+						rpc->printf(ctx, "%srr port: %d", SPACE_FORMAT,
3359
+									((struct srv_rdata*)(rr->rdata))->port);
3360
+						rpc->printf(ctx, "%srr priority: %d", SPACE_FORMAT,
3361
+								((struct srv_rdata*)(rr->rdata))->priority);
3362
+						rpc->printf(ctx, "%srr weight: %d", SPACE_FORMAT,
3363
+									((struct srv_rdata*)(rr->rdata))->weight);
3364
+						break;
3365
+					case T_NAPTR:
3366
+						rpc->printf(ctx, "%srr order: %d", SPACE_FORMAT,
3367
+									((struct naptr_rdata*)(rr->rdata))->order);
3368
+						rpc->printf(ctx, "%srr preference: %d", SPACE_FORMAT,
3369
+									((struct naptr_rdata*)(rr->rdata))->pref);
3370
+						s.s = ((struct naptr_rdata*)(rr->rdata))->flags;
3371
+						s.len = ((struct naptr_rdata*)(rr->rdata))->flags_len;
3372
+						rpc->printf(ctx, "%srr flags: %.*s", SPACE_FORMAT,
3373
+											s.len, s.s);
3374
+						s.s=((struct naptr_rdata*)(rr->rdata))->services;
3375
+						s.len=((struct naptr_rdata*)(rr->rdata))->services_len;
3376
+						rpc->printf(ctx, "%srr service: %.*s", SPACE_FORMAT,
3377
+											s.len, s.s);
3378
+						s.s = ((struct naptr_rdata*)(rr->rdata))->regexp;
3379
+						s.len = ((struct naptr_rdata*)(rr->rdata))->regexp_len;
3380
+						rpc->printf(ctx, "%srr regexp: %.*s", SPACE_FORMAT,
3381
+											s.len, s.s);
3382
+						s.s = ((struct naptr_rdata*)(rr->rdata))->repl;
3383
+						s.len = ((struct naptr_rdata*)(rr->rdata))->repl_len;
3384
+						rpc->printf(ctx, "%srr replacement: %.*s", 
3385
+											SPACE_FORMAT, s.len, s.s);
3386
+						break;
3387
+					case T_CNAME:
3388
+						rpc->printf(ctx, "%srr name: %s", SPACE_FORMAT,
3389
+									((struct cname_rdata*)(rr->rdata))->name);
3390
+						break;
3391
+					default:
3392
+						rpc->printf(ctx, "%sresource record: unknown",
3393
+											SPACE_FORMAT);
3394
+				}
3395
+				rpc->printf(ctx, "%srr expires in (s): %d", SPACE_FORMAT,
3396
+								(s_ticks_t)(rr->expire-now)<0?-1 : 
3397
+								TICKS_TO_S(rr->expire-now));
3398
+				rpc->printf(ctx, "%srr error flags: %d", SPACE_FORMAT, 
3399
+								rr->err_flags);
3400
+			}
3401
+			rpc->printf(ctx, "}");
3402
+		}
3403
+	}
3404
+	UNLOCK_DNS_HASH();
3396 3405
 }
3397 3406
 
3398 3407
 
... ...
@@ -3419,11 +3428,14 @@ void dns_cache_delete_all(rpc_t* rpc, void* ctx)
3419 3419
 	dns_cache_flush();
3420 3420
 }
3421 3421
 
3422
-/* clons an entry and extends the memory area of it for a new rr if rdata_size>0
3423
- * the new dns_rr struct is initialized, but the rdata is only filled with 0.
3422
+/* clones an entry and extends its memory area to hold a new rr.
3423
+ * if rdata_size>0 the new dns_rr struct is initialized, but the rdata is
3424
+ * only filled with 0.
3424 3425
  */
3425
-static struct dns_hash_entry *dns_cache_clone_entry(struct dns_hash_entry *e, int rdata_size, int ttl,
3426
-							struct dns_rr **_new_rr)
3426
+static struct dns_hash_entry *dns_cache_clone_entry(struct dns_hash_entry *e,
3427
+													int rdata_size,
3428
+													int ttl,
3429
+													struct dns_rr **_new_rr)
3427 3430
 {
3428 3431
 	struct dns_hash_entry *new;
3429 3432
 	struct dns_rr *rr, *last_rr, *new_rr;
... ...
@@ -3434,7 +3446,8 @@ static struct dns_hash_entry *dns_cache_clone_entry(struct dns_hash_entry *e, in
3434 3434
 	size = e->total_size;
3435 3435
 	if (rdata_size) {
3436 3436
 		/* we have to extend the entry */
3437
-		rounded_size = 	ROUND_POINTER(size); /* size may not have been rounded previously */
3437
+		rounded_size = ROUND_POINTER(size); /* size may not have been 
3438
+												rounded previously */
3438 3439
 		switch (e->type) {
3439 3440
 			case T_A:
3440 3441
 			case T_AAAA:
... ...
@@ -3448,13 +3461,13 @@ static struct dns_hash_entry *dns_cache_clone_entry(struct dns_hash_entry *e, in
3448 3448
 				rr_size = ROUND_POINTER(sizeof(struct dns_rr));
3449 3449
 				break;
3450 3450
 			default:
3451
-				LOG(L_ERR, "ERROR: dns_cache_clone_entry: type %d not supported\n",
3452
-						e->type);
3451
+				LOG(L_ERR, "ERROR: dns_cache_clone_entry: type %d not "
3452
+							"supported\n", e->type);
3453 3453
 				return NULL;
3454 3454
 		}
3455 3455
 	} else {
3456
-		rounded_size = size; /* no need to round the size, we just clone the entry
3457
-					without extending it */
3456
+		rounded_size = size; /* no need to round the size, we just clone
3457
+								the entry without extending it */
3458 3458
 		rr_size = 0;
3459 3459
 	}
3460 3460
 
... ...
@@ -3471,16 +3484,19 @@ static struct dns_hash_entry *dns_cache_clone_entry(struct dns_hash_entry *e, in
3471 3471
 #ifdef DNS_LU_LST
3472 3472
 	new->last_used_lst.next = new->last_used_lst.next = NULL;
3473 3473
 #endif
3474
-	new->rr_lst = (struct dns_rr*)translate_pointer((char*)new, (char*)e, (char*)new->rr_lst);
3474
+	new->rr_lst = (struct dns_rr*)translate_pointer((char*)new, (char*)e,
3475
+														(char*)new->rr_lst);
3475 3476
 	atomic_set(&new->refcnt, 0);
3476 3477
 	new->last_used = now;
3477 3478
 	/* expire and total_size are fixed later if needed */
3478 3479
 	/* fix the pointers inside the rr structures */
3479 3480
 	last_rr = NULL;
3480 3481
 	for (rr=new->rr_lst; rr; rr=rr->next) {
3481
-		rr->rdata = (void*)translate_pointer((char*)new, (char*)e, (char*)rr->rdata);
3482
+		rr->rdata = (void*)translate_pointer((char*)new, (char*)e, 
3483
+												(char*)rr->rdata);
3482 3484
 		if (rr->next)
3483
-			rr->next = (struct dns_rr*)translate_pointer((char*)new, (char*)e, (char*)rr->next);
3485
+			rr->next = (struct dns_rr*)translate_pointer((char*)new, (char*)e,
3486
+												(char*)rr->next);
3484 3487
 		else
3485 3488
 			last_rr = rr;
3486 3489
 
... ...
@@ -3528,6 +3544,7 @@ static struct dns_hash_entry *dns_cache_clone_entry(struct dns_hash_entry *e, in
3528 3528
 	return new;
3529 3529
 }
3530 3530
 
3531
+
3531 3532
 /* Adds a new record to the cache.
3532 3533
  * If there is an existing record with the same name and value
3533 3534
  * (ip address in case of A/AAAA record, name in case of SRV record)
... ...
@@ -3560,7 +3577,8 @@ static void dns_cache_add_record(rpc_t* rpc, void* ctx, unsigned short type)
3560 3560
 			return;
3561 3561
 		break;
3562 3562
 	case T_SRV:
3563
-		if (rpc->scan(ctx, "SddddSd", &name, &ttl, &priority, &weight, &port, &rr_name, &flags) < 7)
3563
+		if (rpc->scan(ctx, "SddddSd", &name, &ttl, &priority, &weight, &port,
3564
+							&rr_name, &flags) < 7)
3564 3565
 			return;
3565 3566
 		break;
3566 3567
 	case T_CNAME:
... ...
@@ -3620,44 +3638,54 @@ static void dns_cache_add_record(rpc_t* rpc, void* ctx, unsigned short type)
3620 3620
 			case T_AAAA:
3621 3621
 				new = dns_cache_mk_ip_entry(&name, ip_addr);
3622 3622
 				if (!new) {
3623
-					rpc->fault(ctx, 400, "Failed to add the entry to the cache");
3623
+					rpc->fault(ctx, 400, "Failed to add the entry to"
3624
+										" the cache");
3624 3625
 					goto error;
3625 3626
 				}
3626
-				/* fix the expiration time, dns_cache_mk_ip_entry() sets it to now-1 */
3627
+				/* fix the expiration time, dns_cache_mk_ip_entry() sets it 
3628
+				 * to now-1 */
3627 3629
 				expire = get_ticks_raw() + S_TO_TICKS(ttl);
3628 3630
 				new->expire = expire;
3629 3631
 				new->rr_lst->expire = expire;
3630 3632
 				break;
3631 3633
 			case T_SRV:
3632
-				new = dns_cache_mk_srv_entry(&name, priority, weight, port, &rr_name, ttl);
3634
+				new = dns_cache_mk_srv_entry(&name, priority, weight, port,
3635
+												&rr_name, ttl);
3633 3636
 				if (!new) {
3634
-					rpc->fault(ctx, 400, "Failed to add the entry to the cache");
3637
+					rpc->fault(ctx, 400, "Failed to add the entry to"
3638
+											" the cache");
3635 3639
 					goto error;
3636 3640
 				}
3637 3641
 			}
3638 3642
 		} else {
3639
-			/* we must modify the entry, so better to clone it, modify the new one,
3640
-			and replace the old with the new entry in the hash table, because the
3641
-			entry is not always locked */
3643
+			/* we must modify the entry, so better to clone it, modify the new 
3644
+			 * one, and replace the old with the new entry in the hash table,
3645
+			 * because the entry might be in use (even if the dns hash is 
3646
+			 * locked). The old entry will be removed from the hash and 
3647
+			 * automatically destroyed when its refcnt will be 0*/
3642 3648
 
3643 3649
 			/* check whether there is an rr with the same value */
3644 3650
 			for (rr=old->rr_lst; rr; rr=rr->next)
3645 3651
 				if ((((type == T_A) || (type == T_AAAA)) &&
3646
-					(memcmp(ip_addr->u.addr, ((struct a_rdata*)rr->rdata)->ip, ip_addr->len)==0))
3652
+					(memcmp(ip_addr->u.addr, ((struct a_rdata*)rr->rdata)->ip,
3653
+										ip_addr->len)==0))
3647 3654
 				|| ((type == T_SRV) &&
3648
-					(((struct srv_rdata*)rr->rdata)->name_len == rr_name.len) &&
3649
-					(memcmp(rr_name.s, ((struct srv_rdata*)rr->rdata)->name, rr_name.len)==0)))
3655
+					(((struct srv_rdata*)rr->rdata)->name_len == rr_name.len)&&
3656
+					(memcmp(rr_name.s, ((struct srv_rdata*)rr->rdata)->name,
3657
+										rr_name.len)==0)))
3650 3658
 				break;
3651 3659
 
3652 3660
 			if (rr) {
3653 3661
 				/* the rr was found in the list */
3654 3662
 				new = dns_cache_clone_entry(old, 0, 0, 0);
3655 3663
 				if (!new) {
3656
-					rpc->fault(ctx, 400, "Failed to add the entry to the cache");
3664
+					rpc->fault(ctx, 400, "Failed to add the entry to "
3665
+											"the cache");
3657 3666
 					goto error;
3658 3667
 				}
3659 3668
 				/* let the rr point to the new structure */
3660
-				rr = (struct dns_rr*)translate_pointer((char*)new, (char*)old, (char*)rr);
3669
+				rr = (struct dns_rr*)translate_pointer((char*)new, (char*)old,
3670
+														(char*)rr);
3661 3671
 
3662 3672
 				if (type == T_SRV) {
3663 3673
 					/* fix the priority, weight, and port */
... ...
@@ -3672,7 +3700,8 @@ static void dns_cache_add_record(rpc_t* rpc, void* ctx, unsigned short type)
3672 3672
 				for (rr=new->rr_lst; rr; rr=rr->next)
3673 3673
 					new->expire = MAX(new->expire, rr->expire);
3674 3674
 			} else {
3675
-				/* there was no matching rr, extend the structure with a new one */
3675
+				/* there was no matching rr, extend the structure with a new
3676
+				 * one */
3676 3677
 				switch(type) {
3677 3678
 				case T_A:
3678 3679
 					size = sizeof(struct a_rdata);
... ...
@@ -3687,7 +3716,8 @@ static void dns_cache_add_record(rpc_t* rpc, void* ctx, unsigned short type)
3687 3687
 				}
3688 3688
 				new = dns_cache_clone_entry(old, size, ttl, &rr);
3689 3689
 				if (!new) {
3690
-					rpc->fault(ctx, 400, "Failed to add the entry to the cache");
3690
+					rpc->fault(ctx, 400, "Failed to add the entry to"
3691
+											" the cache");
3691 3692
 					goto error;
3692 3693
 				}
3693 3694
 
... ...
@@ -3701,9 +3731,11 @@ static void dns_cache_add_record(rpc_t* rpc, void* ctx, unsigned short type)
3701 3701
 					((struct srv_rdata*)rr->rdata)->weight = weight;
3702 3702
 					((struct srv_rdata*)rr->rdata)->port = port;
3703 3703
 					((struct srv_rdata*)rr->rdata)->name_len = rr_name.len;
3704
-					memcpy(((struct srv_rdata*)rr->rdata)->name, rr_name.s, rr_name.len);
3704
+					memcpy(((struct srv_rdata*)rr->rdata)->name, rr_name.s, 
3705
+									rr_name.len);
3705 3706
 				}
3706
-				/* maximum expire value has been already fixed by dns_cache_clone_entry() */
3707
+				/* maximum expire value has been already fixed by 
3708
+				 * dns_cache_clone_entry() */
3707 3709
 			}
3708 3710
 		}
3709 3711
 	}
... ...
@@ -3732,6 +3764,7 @@ error:
3732 3732
 		dns_destroy_entry(new);
3733 3733
 }
3734 3734
 
3735
+
3735 3736
 /* deletes a record from the cache */
3736 3737
 static void dns_cache_delete_record(rpc_t* rpc, void* ctx, unsigned short type)
3737 3738
 {
... ...
@@ -3756,32 +3789,38 @@ static void dns_cache_delete_record(rpc_t* rpc, void* ctx, unsigned short type)
3756 3756
 		rpc->fault(ctx, 400, "Not found");
3757 3757
 }
3758 3758
 
3759
+
3759 3760
 /* wrapper functions for adding and deleting records */
3760 3761
 void dns_cache_add_a(rpc_t* rpc, void* ctx)
3761 3762
 {
3762 3763
 	dns_cache_add_record(rpc, ctx, T_A);
3763 3764
 }
3764 3765
 
3766
+
3765 3767
 void dns_cache_add_aaaa(rpc_t* rpc, void* ctx)
3766 3768
 {
3767 3769
 	dns_cache_add_record(rpc, ctx, T_AAAA);
3768 3770
 }
3769 3771
 
3772
+
3770 3773
 void dns_cache_add_srv(rpc_t* rpc, void* ctx)
3771 3774
 {
3772 3775
 	dns_cache_add_record(rpc, ctx, T_SRV);
3773 3776
 }
3774 3777
 
3778
+
3775 3779
 void dns_cache_delete_a(rpc_t* rpc, void* ctx)
3776 3780
 {
3777 3781
 	dns_cache_delete_record(rpc, ctx, T_A);
3778 3782
 }
3779 3783
 
3784
+
3780 3785
 void dns_cache_delete_aaaa(rpc_t* rpc, void* ctx)
3781 3786
 {
3782 3787
 	dns_cache_delete_record(rpc, ctx, T_AAAA);
3783 3788
 }
3784 3789
 
3790
+
3785 3791
 void dns_cache_delete_srv(rpc_t* rpc, void* ctx)
3786 3792
 {
3787 3793
 	dns_cache_delete_record(rpc, ctx, T_SRV);
... ...
@@ -970,27 +970,30 @@ void dst_blst_hash_stats(rpc_t* rpc, void* ctx)
970 970
 /* dumps the content of the blacklist in a human-readable format */
971 971
 void dst_blst_view(rpc_t* rpc, void* ctx)
972 972
 {
973
-int h;
974
-  struct dst_blst_entry* e;
975
-  ticks_t now;
976
-  struct ip_addr ip;
977
-
978
-  now=get_ticks_raw();
979
-  for(h=0; h<DST_BLST_HASH_SIZE; h++) {
980
-    LOCK_BLST(h);
981
-    for(e=dst_blst_hash[h].first; e; e=e->next) {
982
-      dst_blst_entry2ip(&ip, e);
983
-      rpc->printf(ctx, "{\n    protocol: %s", get_proto_name(e->proto));
984
-      rpc->printf(ctx, "    ip: %s", ip_addr2a(&ip));
985
-      rpc->printf(ctx, "    port: %d", e->port);
986
-      rpc->printf(ctx, "    expires in (s): %d", (s_ticks_t)(now-e->expire)<=0?
987
-                       TICKS_TO_S(e->expire-now): -TICKS_TO_S(now-e->expire));
988
-      rpc->printf(ctx, "    flags: %d\n}", e->flags);
989
-    }
990
-    UNLOCK_BLST(h);
991
-  }
973
+	int h;
974
+	struct dst_blst_entry* e;
975
+	ticks_t now;
976
+	struct ip_addr ip;
977
+
978
+	now=get_ticks_raw();
979
+	for(h=0; h<DST_BLST_HASH_SIZE; h++) {
980
+		LOCK_BLST(h);
981
+		for(e=dst_blst_hash[h].first; e; e=e->next) {
982
+			dst_blst_entry2ip(&ip, e);
983
+			rpc->printf(ctx, "{\n    protocol: %s", get_proto_name(e->proto));
984
+			rpc->printf(ctx, "    ip: %s", ip_addr2a(&ip));
985
+			rpc->printf(ctx, "    port: %d", e->port);
986
+			rpc->printf(ctx, "    expires in (s): %d", 
987
+							(s_ticks_t)(now-e->expire)<=0?
988
+								TICKS_TO_S(e->expire-now):
989
+								-TICKS_TO_S(now-e->expire));
990
+			rpc->printf(ctx, "    flags: %d\n}", e->flags);
991
+		}
992
+		UNLOCK_BLST(h);
993
+	}
992 994
 }
993 995
 
996
+
994 997
 /* deletes all the entries from the blacklist except the permanent ones
995 998
  * (which are marked with BLST_PERMANENT)
996 999
  */
... ...
@@ -184,20 +184,21 @@ Options:\n\
184 184
     -L dir       Modules directory (default: " MODS_DIR ")\n\
185 185
     -c           Check configuration file for errors\n\
186 186
     -l address   Listen on the specified address/interface (multiple -l\n\
187
-		  mean listening on more addresses).  The address format is\n\
188
-		  [proto:]addr[:port], where proto=udp|tcp and \n\
189
-		  addr= host|ip_address|interface_name. E.g: -l locahost, \n\
190
-		  -l udp:127.0.0.1:5080, -l eth0:5062 The default behavior\n\
191
-		  is to listen on all the interfaces.\n\
187
+                  mean listening on more addresses).  The address format is\n\
188
+                  [proto:]addr[:port], where proto=udp|tcp and \n\
189
+                  addr= host|ip_address|interface_name. E.g: -l locahost, \n\
190
+                  -l udp:127.0.0.1:5080, -l eth0:5062 The default behavior\n\
191
+                  is to listen on all the interfaces.\n\
192 192
     -n processes Number of child processes to fork per interface\n\
193
-		  (default: 8)\n\
193
+                  (default: 8)\n\
194 194
     -r           Use dns to check if is necessary to add a \"received=\"\n\
195
-		  field to a via\n\
195
+                  field to a via\n\
196 196
     -R           Same as `-r` but use reverse dns;\n\
197
-		  (to use both use `-rR`)\n\
197
+                  (to use both use `-rR`)\n\
198 198
     -v           Turn on \"via:\" host checking when forwarding replies\n\
199 199
     -d           Debugging mode (multiple -d increase the level)\n\
200
-    -D           1..do not fork (almost) anyway, 2..do not daemonize creator, 3..daemonize (default)\n\
200
+    -D no        1..do not fork (almost) anyway, 2..do not daemonize creator\n\
201
+                  3..daemonize (default)\n\
201 202
     -E           Log to stderr\n"
202 203
 #ifdef USE_TCP
203 204
 "    -T           Disable tcp\n\
... ...
@@ -207,7 +208,7 @@ Options:\n\
207 207
 "    -V           Version number\n\
208 208
     -h           This help message\n\
209 209
     -b nr        Maximum receive buffer size which will not be exceeded by\n\
210
-		  auto-probing procedure even if  OS allows\n\
210
+                  auto-probing procedure even if  OS allows\n\
211 211
     -m nr        Size of shared memory allocated in Megabytes\n\
212 212
     -w dir       Change the working directory to \"dir\" (default: \"/\")\n\
213 213
     -t dir       Chroot to \"dir\"\n\
... ...
@@ -349,7 +350,7 @@ int mlock_pages=0; /* default off, try to disable swapping */
349 349
 
350 350
 /* real time options */
351 351
 int real_time=0; /* default off, flags: 1 on only timer, 2  slow timer,
352
-							    4 all procs (7=all) */
352
+										4 all procs (7=all) */
353 353
 int rt_prio=0;
354 354
 int rt_policy=0; /* SCHED_OTHER */
355 355
 int rt_timer1_prio=0;  /* "fast" timer */
... ...
@@ -1317,14 +1318,17 @@ int main(int argc, char** argv)
1317 1317
 					break;
1318 1318
 			case '?':
1319 1319
 					if (isprint(optopt)) {
1320
-						fprintf(stderr, "Unknown option `-%c'. Use -h for help.\n", optopt);
1320
+						fprintf(stderr, "Unknown option `-%c'."
1321
+										" Use -h for help.\n", optopt);
1321 1322
 					} else {
1322
-						fprintf(stderr, "Unknown option character `\\x%x'. Use -h for help.\n",
1323
+						fprintf(stderr, "Unknown option character `\\x%x'."
1324
+										" Use -h for help.\n",
1323 1325
 							optopt);
1324 1326
 					}
1325 1327
 					goto error;
1326 1328
 			case ':':
1327
-					fprintf(stderr, "Option `-%c' requires an argument. Use -h for help.\n",
1329
+					fprintf(stderr, "Option `-%c' requires an argument."
1330
+									" Use -h for help.\n",
1328 1331
 						optopt);
1329 1332
 					goto error;
1330 1333
 			default: