From 8d913bf8e8c483e4cbe97d7dd329f3e1b06dcded Mon Sep 17 00:00:00 2001
From: Gleb Smirnoff <glebius@FreeBSD.org>
Date: Wed, 23 Nov 2011 18:38:08 +0000
Subject: [PATCH] Fix parsing of redirect_addr argument.

PR:		kern/162739
MFC after:	3 days
---
 sbin/ipfw/nat.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sbin/ipfw/nat.c b/sbin/ipfw/nat.c
index c95a625d5e9b..6bec36c27396 100644
--- a/sbin/ipfw/nat.c
+++ b/sbin/ipfw/nat.c
@@ -345,11 +345,12 @@ setup_redir_addr(char *buf, int *ac, char ***av)
 	space = sizeof(struct cfg_redir);
 
 	/* Extract local address. */
-	if ((sep = strtok(**av, ",")) != NULL) {
+	if (strchr(**av, ',') != NULL) {
 		struct cfg_spool *spool;
 
 		/* Setup LSNAT server pool. */
 		r->laddr.s_addr = INADDR_NONE;
+		sep = strtok(**av, ",");
 		while (sep != NULL) {
 			spool = (struct cfg_spool *)buf;
 			space += sizeof(struct cfg_spool);