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 3428
 	dns_cache_flush();
3420 3429
 }
3421 3430
 
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.
3431
+/* clones an entry and extends its memory area to hold a new rr.
3432
+ * if rdata_size>0 the new dns_rr struct is initialized, but the rdata is
3433
+ * only filled with 0.
3424 3434
  */
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)
3435
+static struct dns_hash_entry *dns_cache_clone_entry(struct dns_hash_entry *e,
3436
+													int rdata_size,
3437
+													int ttl,
3438
+													struct dns_rr **_new_rr)
3427 3439
 {
3428 3440
 	struct dns_hash_entry *new;
3429 3441
 	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 3446
 	size = e->total_size;
3435 3447
 	if (rdata_size) {
3436 3448
 		/* we have to extend the entry */
3437
-		rounded_size = 	ROUND_POINTER(size); /* size may not have been rounded previously */
3449
+		rounded_size = ROUND_POINTER(size); /* size may not have been 
3450
+												rounded previously */
3438 3451
 		switch (e->type) {
3439 3452
 			case T_A:
3440 3453
 			case T_AAAA:
... ...
@@ -3448,13 +3461,13 @@ static struct dns_hash_entry *dns_cache_clone_entry(struct dns_hash_entry *e, in
3448 3461
 				rr_size = ROUND_POINTER(sizeof(struct dns_rr));
3449 3462
 				break;
3450 3463
 			default:
3451
-				LOG(L_ERR, "ERROR: dns_cache_clone_entry: type %d not supported\n",
3452
-						e->type);
3464
+				LOG(L_ERR, "ERROR: dns_cache_clone_entry: type %d not "
3465
+							"supported\n", e->type);
3453 3466
 				return NULL;
3454 3467
 		}
3455 3468
 	} else {
3456
-		rounded_size = size; /* no need to round the size, we just clone the entry
3457
-					without extending it */
3469
+		rounded_size = size; /* no need to round the size, we just clone
3470
+								the entry without extending it */
3458 3471
 		rr_size = 0;
3459 3472
 	}
3460 3473
 
... ...
@@ -3471,16 +3484,19 @@ static struct dns_hash_entry *dns_cache_clone_entry(struct dns_hash_entry *e, in
3471 3484
 #ifdef DNS_LU_LST
3472 3485
 	new->last_used_lst.next = new->last_used_lst.next = NULL;
3473 3486
 #endif
3474
-	new->rr_lst = (struct dns_rr*)translate_pointer((char*)new, (char*)e, (char*)new->rr_lst);
3487
+	new->rr_lst = (struct dns_rr*)translate_pointer((char*)new, (char*)e,
3488
+														(char*)new->rr_lst);
3475 3489
 	atomic_set(&new->refcnt, 0);
3476 3490
 	new->last_used = now;
3477 3491
 	/* expire and total_size are fixed later if needed */
3478 3492
 	/* fix the pointers inside the rr structures */
3479 3493
 	last_rr = NULL;
3480 3494
 	for (rr=new->rr_lst; rr; rr=rr->next) {
3481
-		rr->rdata = (void*)translate_pointer((char*)new, (char*)e, (char*)rr->rdata);
3495
+		rr->rdata = (void*)translate_pointer((char*)new, (char*)e, 
3496
+												(char*)rr->rdata);
3482 3497
 		if (rr->next)
3483
-			rr->next = (struct dns_rr*)translate_pointer((char*)new, (char*)e, (char*)rr->next);
3498
+			rr->next = (struct dns_rr*)translate_pointer((char*)new, (char*)e,
3499
+												(char*)rr->next);
3484 3500
 		else
3485 3501
 			last_rr = rr;
3486 3502
 
... ...
@@ -3528,6 +3544,7 @@ static struct dns_hash_entry *dns_cache_clone_entry(struct dns_hash_entry *e, in
3528 3544
 	return new;
3529 3545
 }
3530 3546
 
3547
+
3531 3548
 /* Adds a new record to the cache.
3532 3549
  * If there is an existing record with the same name and value
3533 3550
  * (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 3577
 			return;
3561 3578
 		break;
3562 3579
 	case T_SRV:
3563
-		if (rpc->scan(ctx, "SddddSd", &name, &ttl, &priority, &weight, &port, &rr_name, &flags) < 7)
3580
+		if (rpc->scan(ctx, "SddddSd", &name, &ttl, &priority, &weight, &port,
3581
+							&rr_name, &flags) < 7)
3564 3582
 			return;
3565 3583
 		break;
3566 3584
 	case T_CNAME:
... ...
@@ -3620,44 +3638,54 @@ static void dns_cache_add_record(rpc_t* rpc, void* ctx, unsigned short type)
3620 3638
 			case T_AAAA:
3621 3639
 				new = dns_cache_mk_ip_entry(&name, ip_addr);
3622 3640
 				if (!new) {
3623
-					rpc->fault(ctx, 400, "Failed to add the entry to the cache");
3641
+					rpc->fault(ctx, 400, "Failed to add the entry to"
3642
+										" the cache");
3624 3643
 					goto error;
3625 3644
 				}
3626
-				/* fix the expiration time, dns_cache_mk_ip_entry() sets it to now-1 */
3645
+				/* fix the expiration time, dns_cache_mk_ip_entry() sets it 
3646
+				 * to now-1 */
3627 3647
 				expire = get_ticks_raw() + S_TO_TICKS(ttl);
3628 3648
 				new->expire = expire;
3629 3649
 				new->rr_lst->expire = expire;
3630 3650
 				break;
3631 3651
 			case T_SRV:
3632
-				new = dns_cache_mk_srv_entry(&name, priority, weight, port, &rr_name, ttl);
3652
+				new = dns_cache_mk_srv_entry(&name, priority, weight, port,
3653
+												&rr_name, ttl);
3633 3654
 				if (!new) {
3634
-					rpc->fault(ctx, 400, "Failed to add the entry to the cache");
3655
+					rpc->fault(ctx, 400, "Failed to add the entry to"
3656
+											" the cache");
3635 3657
 					goto error;
3636 3658
 				}
3637 3659
 			}
3638 3660
 		} 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 */
3661
+			/* we must modify the entry, so better to clone it, modify the new 
3662
+			 * one, and replace the old with the new entry in the hash table,
3663
+			 * because the entry might be in use (even if the dns hash is 
3664
+			 * locked). The old entry will be removed from the hash and 
3665
+			 * automatically destroyed when its refcnt will be 0*/
3642 3666
 
3643 3667
 			/* check whether there is an rr with the same value */
3644 3668
 			for (rr=old->rr_lst; rr; rr=rr->next)
3645 3669
 				if ((((type == T_A) || (type == T_AAAA)) &&
3646
-					(memcmp(ip_addr->u.addr, ((struct a_rdata*)rr->rdata)->ip, ip_addr->len)==0))
3670
+					(memcmp(ip_addr->u.addr, ((struct a_rdata*)rr->rdata)->ip,
3671
+										ip_addr->len)==0))
3647 3672
 				|| ((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)))
3673
+					(((struct srv_rdata*)rr->rdata)->name_len == rr_name.len)&&
3674
+					(memcmp(rr_name.s, ((struct srv_rdata*)rr->rdata)->name,
3675
+										rr_name.len)==0)))
3650 3676
 				break;
3651 3677
 
3652 3678
 			if (rr) {
3653 3679
 				/* the rr was found in the list */
3654 3680
 				new = dns_cache_clone_entry(old, 0, 0, 0);
3655 3681
 				if (!new) {
3656
-					rpc->fault(ctx, 400, "Failed to add the entry to the cache");
3682
+					rpc->fault(ctx, 400, "Failed to add the entry to "
3683
+											"the cache");
3657 3684
 					goto error;
3658 3685
 				}
3659 3686
 				/* let the rr point to the new structure */
3660
-				rr = (struct dns_rr*)translate_pointer((char*)new, (char*)old, (char*)rr);
3687
+				rr = (struct dns_rr*)translate_pointer((char*)new, (char*)old,
3688
+														(char*)rr);
3661 3689
 
3662 3690
 				if (type == T_SRV) {
3663 3691
 					/* 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 3700
 				for (rr=new->rr_lst; rr; rr=rr->next)
3673 3701
 					new->expire = MAX(new->expire, rr->expire);
3674 3702
 			} else {
3675
-				/* there was no matching rr, extend the structure with a new one */
3703
+				/* there was no matching rr, extend the structure with a new
3704
+				 * one */
3676 3705
 				switch(type) {
3677 3706
 				case T_A:
3678 3707
 					size = sizeof(struct a_rdata);
... ...
@@ -3687,7 +3716,8 @@ static void dns_cache_add_record(rpc_t* rpc, void* ctx, unsigned short type)
3687 3716
 				}
3688 3717
 				new = dns_cache_clone_entry(old, size, ttl, &rr);
3689 3718
 				if (!new) {
3690
-					rpc->fault(ctx, 400, "Failed to add the entry to the cache");
3719
+					rpc->fault(ctx, 400, "Failed to add the entry to"
3720
+											" the cache");
3691 3721
 					goto error;
3692 3722
 				}
3693 3723
 
... ...
@@ -3701,9 +3731,11 @@ static void dns_cache_add_record(rpc_t* rpc, void* ctx, unsigned short type)
3701 3731
 					((struct srv_rdata*)rr->rdata)->weight = weight;
3702 3732
 					((struct srv_rdata*)rr->rdata)->port = port;
3703 3733
 					((struct srv_rdata*)rr->rdata)->name_len = rr_name.len;
3704
-					memcpy(((struct srv_rdata*)rr->rdata)->name, rr_name.s, rr_name.len);
3734
+					memcpy(((struct srv_rdata*)rr->rdata)->name, rr_name.s, 
3735
+									rr_name.len);
3705 3736
 				}
3706
-				/* maximum expire value has been already fixed by dns_cache_clone_entry() */
3737
+				/* maximum expire value has been already fixed by 
3738
+				 * dns_cache_clone_entry() */
3707 3739
 			}
3708 3740
 		}
3709 3741
 	}
... ...
@@ -3732,6 +3764,7 @@ error:
3732 3764
 		dns_destroy_entry(new);
3733 3765
 }
3734 3766
 
3767
+
3735 3768
 /* deletes a record from the cache */
3736 3769
 static void dns_cache_delete_record(rpc_t* rpc, void* ctx, unsigned short type)
3737 3770
 {
... ...
@@ -3756,32 +3789,38 @@ static void dns_cache_delete_record(rpc_t* rpc, void* ctx, unsigned short type)
3756 3789
 		rpc->fault(ctx, 400, "Not found");
3757 3790
 }
3758 3791
 
3792
+
3759 3793
 /* wrapper functions for adding and deleting records */
3760 3794
 void dns_cache_add_a(rpc_t* rpc, void* ctx)
3761 3795
 {
3762 3796
 	dns_cache_add_record(rpc, ctx, T_A);
3763 3797
 }
3764 3798
 
3799
+
3765 3800
 void dns_cache_add_aaaa(rpc_t* rpc, void* ctx)
3766 3801
 {
3767 3802
 	dns_cache_add_record(rpc, ctx, T_AAAA);
3768 3803
 }
3769 3804
 
3805
+
3770 3806
 void dns_cache_add_srv(rpc_t* rpc, void* ctx)
3771 3807
 {
3772 3808
 	dns_cache_add_record(rpc, ctx, T_SRV);
3773 3809
 }
3774 3810
 
3811
+
3775 3812
 void dns_cache_delete_a(rpc_t* rpc, void* ctx)
3776 3813
 {
3777 3814
 	dns_cache_delete_record(rpc, ctx, T_A);
3778 3815
 }
3779 3816
 
3817
+
3780 3818
 void dns_cache_delete_aaaa(rpc_t* rpc, void* ctx)
3781 3819
 {
3782 3820
 	dns_cache_delete_record(rpc, ctx, T_AAAA);
3783 3821
 }
3784 3822
 
3823
+
3785 3824
 void dns_cache_delete_srv(rpc_t* rpc, void* ctx)
3786 3825
 {
3787 3826
 	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 208
 "    -V           Version number\n\
208 209
     -h           This help message\n\
209 210
     -b nr        Maximum receive buffer size which will not be exceeded by\n\
210
-		  auto-probing procedure even if  OS allows\n\
211
+                  auto-probing procedure even if  OS allows\n\
211 212
     -m nr        Size of shared memory allocated in Megabytes\n\
212 213
     -w dir       Change the working directory to \"dir\" (default: \"/\")\n\
213 214
     -t dir       Chroot to \"dir\"\n\
... ...
@@ -349,7 +350,7 @@ int mlock_pages=0; /* default off, try to disable swapping */
349 350
 
350 351
 /* real time options */
351 352
 int real_time=0; /* default off, flags: 1 on only timer, 2  slow timer,
352
-							    4 all procs (7=all) */
353
+										4 all procs (7=all) */
353 354
 int rt_prio=0;
354 355
 int rt_policy=0; /* SCHED_OTHER */
355 356
 int rt_timer1_prio=0;  /* "fast" timer */
... ...
@@ -1317,14 +1318,17 @@ int main(int argc, char** argv)
1317 1318
 					break;
1318 1319
 			case '?':
1319 1320
 					if (isprint(optopt)) {
1320
-						fprintf(stderr, "Unknown option `-%c'. Use -h for help.\n", optopt);
1321
+						fprintf(stderr, "Unknown option `-%c'."
1322
+										" Use -h for help.\n", optopt);
1321 1323
 					} else {
1322
-						fprintf(stderr, "Unknown option character `\\x%x'. Use -h for help.\n",
1324
+						fprintf(stderr, "Unknown option character `\\x%x'."
1325
+										" Use -h for help.\n",
1323 1326
 							optopt);
1324 1327
 					}
1325 1328
 					goto error;
1326 1329
 			case ':':
1327
-					fprintf(stderr, "Option `-%c' requires an argument. Use -h for help.\n",
1330
+					fprintf(stderr, "Option `-%c' requires an argument."
1331
+									" Use -h for help.\n",
1328 1332
 						optopt);
1329 1333
 					goto error;
1330 1334
 			default: