diff -rupN keepalived-1.2.7/.git/config keepalived-1.2.7-unicast/.git/config
--- keepalived-1.2.7/.git/config	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/.git/config	2013-05-24 10:12:36.390154700 +0200
@@ -0,0 +1,12 @@
+[core]
+	repositoryformatversion = 0
+	filemode = true
+	bare = false
+	logallrefupdates = true
+	ignorecase = true
+[remote "origin"]
+	fetch = +refs/heads/*:refs/remotes/origin/*
+	url = https://github.com/rohara/keepalived.git
+[branch "master"]
+	remote = origin
+	merge = refs/heads/master
diff -rupN keepalived-1.2.7/.git/description keepalived-1.2.7-unicast/.git/description
--- keepalived-1.2.7/.git/description	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/.git/description	2013-05-24 10:12:29.386754200 +0200
@@ -0,0 +1 @@
+Unnamed repository; edit this file 'description' to name the repository.
diff -rupN keepalived-1.2.7/.git/HEAD keepalived-1.2.7-unicast/.git/HEAD
--- keepalived-1.2.7/.git/HEAD	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/.git/HEAD	2013-05-24 10:12:36.373153800 +0200
@@ -0,0 +1 @@
+ref: refs/heads/master
diff -rupN keepalived-1.2.7/.git/hooks/applypatch-msg.sample keepalived-1.2.7-unicast/.git/hooks/applypatch-msg.sample
--- keepalived-1.2.7/.git/hooks/applypatch-msg.sample	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/.git/hooks/applypatch-msg.sample	2013-05-24 10:12:29.388754300 +0200
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# An example hook script to check the commit log message taken by
+# applypatch from an e-mail message.
+#
+# The hook should exit with non-zero status after issuing an
+# appropriate message if it wants to stop the commit.  The hook is
+# allowed to edit the commit message file.
+#
+# To enable this hook, rename this file to "applypatch-msg".
+
+. git-sh-setup
+test -x "$GIT_DIR/hooks/commit-msg" &&
+	exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
+:
diff -rupN keepalived-1.2.7/.git/hooks/commit-msg.sample keepalived-1.2.7-unicast/.git/hooks/commit-msg.sample
--- keepalived-1.2.7/.git/hooks/commit-msg.sample	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/.git/hooks/commit-msg.sample	2013-05-24 10:12:29.389754300 +0200
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# An example hook script to check the commit log message.
+# Called by "git commit" with one argument, the name of the file
+# that has the commit message.  The hook should exit with non-zero
+# status after issuing an appropriate message if it wants to stop the
+# commit.  The hook is allowed to edit the commit message file.
+#
+# To enable this hook, rename this file to "commit-msg".
+
+# Uncomment the below to add a Signed-off-by line to the message.
+# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
+# hook is more suited to it.
+#
+# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
+# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
+
+# This example catches duplicate Signed-off-by lines.
+
+test "" = "$(grep '^Signed-off-by: ' "$1" |
+	 sort | uniq -c | sed -e '/^[ 	]*1[ 	]/d')" || {
+	echo >&2 Duplicate Signed-off-by lines.
+	exit 1
+}
diff -rupN keepalived-1.2.7/.git/hooks/post-update.sample keepalived-1.2.7-unicast/.git/hooks/post-update.sample
--- keepalived-1.2.7/.git/hooks/post-update.sample	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/.git/hooks/post-update.sample	2013-05-24 10:12:29.391754500 +0200
@@ -0,0 +1,8 @@
+#!/bin/sh
+#
+# An example hook script to prepare a packed repository for use over
+# dumb transports.
+#
+# To enable this hook, rename this file to "post-update".
+
+exec git update-server-info
diff -rupN keepalived-1.2.7/.git/hooks/pre-applypatch.sample keepalived-1.2.7-unicast/.git/hooks/pre-applypatch.sample
--- keepalived-1.2.7/.git/hooks/pre-applypatch.sample	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/.git/hooks/pre-applypatch.sample	2013-05-24 10:12:29.393754600 +0200
@@ -0,0 +1,14 @@
+#!/bin/sh
+#
+# An example hook script to verify what is about to be committed
+# by applypatch from an e-mail message.
+#
+# The hook should exit with non-zero status after issuing an
+# appropriate message if it wants to stop the commit.
+#
+# To enable this hook, rename this file to "pre-applypatch".
+
+. git-sh-setup
+test -x "$GIT_DIR/hooks/pre-commit" &&
+	exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"}
+:
diff -rupN keepalived-1.2.7/.git/hooks/pre-commit.sample keepalived-1.2.7-unicast/.git/hooks/pre-commit.sample
--- keepalived-1.2.7/.git/hooks/pre-commit.sample	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/.git/hooks/pre-commit.sample	2013-05-24 10:12:29.394754600 +0200
@@ -0,0 +1,50 @@
+#!/bin/sh
+#
+# An example hook script to verify what is about to be committed.
+# Called by "git commit" with no arguments.  The hook should
+# exit with non-zero status after issuing an appropriate message if
+# it wants to stop the commit.
+#
+# To enable this hook, rename this file to "pre-commit".
+
+if git rev-parse --verify HEAD >/dev/null 2>&1
+then
+	against=HEAD
+else
+	# Initial commit: diff against an empty tree object
+	against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
+fi
+
+# If you want to allow non-ascii filenames set this variable to true.
+allownonascii=$(git config hooks.allownonascii)
+
+# Redirect output to stderr.
+exec 1>&2
+
+# Cross platform projects tend to avoid non-ascii filenames; prevent
+# them from being added to the repository. We exploit the fact that the
+# printable range starts at the space character and ends with tilde.
+if [ "$allownonascii" != "true" ] &&
+	# Note that the use of brackets around a tr range is ok here, (it's
+	# even required, for portability to Solaris 10's /usr/bin/tr), since
+	# the square bracket bytes happen to fall in the designated range.
+	test $(git diff --cached --name-only --diff-filter=A -z $against |
+	  LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
+then
+	echo "Error: Attempt to add a non-ascii file name."
+	echo
+	echo "This can cause problems if you want to work"
+	echo "with people on other platforms."
+	echo
+	echo "To be portable it is advisable to rename the file ..."
+	echo
+	echo "If you know what you are doing you can disable this"
+	echo "check using:"
+	echo
+	echo "  git config hooks.allownonascii true"
+	echo
+	exit 1
+fi
+
+# If there are whitespace errors, print the offending file names and fail.
+exec git diff-index --check --cached $against --
diff -rupN keepalived-1.2.7/.git/hooks/prepare-commit-msg.sample keepalived-1.2.7-unicast/.git/hooks/prepare-commit-msg.sample
--- keepalived-1.2.7/.git/hooks/prepare-commit-msg.sample	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/.git/hooks/prepare-commit-msg.sample	2013-05-24 10:12:29.397754800 +0200
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# An example hook script to prepare the commit log message.
+# Called by "git commit" with the name of the file that has the
+# commit message, followed by the description of the commit
+# message's source.  The hook's purpose is to edit the commit
+# message file.  If the hook fails with a non-zero status,
+# the commit is aborted.
+#
+# To enable this hook, rename this file to "prepare-commit-msg".
+
+# This hook includes three examples.  The first comments out the
+# "Conflicts:" part of a merge commit.
+#
+# The second includes the output of "git diff --name-status -r"
+# into the message, just before the "git status" output.  It is
+# commented because it doesn't cope with --amend or with squashed
+# commits.
+#
+# The third example adds a Signed-off-by line to the message, that can
+# still be edited.  This is rarely a good idea.
+
+case "$2,$3" in
+  merge,)
+    /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
+
+# ,|template,)
+#   /usr/bin/perl -i.bak -pe '
+#      print "\n" . `git diff --cached --name-status -r`
+#	 if /^#/ && $first++ == 0' "$1" ;;
+
+  *) ;;
+esac
+
+# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
+# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
diff -rupN keepalived-1.2.7/.git/hooks/pre-rebase.sample keepalived-1.2.7-unicast/.git/hooks/pre-rebase.sample
--- keepalived-1.2.7/.git/hooks/pre-rebase.sample	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/.git/hooks/pre-rebase.sample	2013-05-24 10:12:29.396754700 +0200
@@ -0,0 +1,169 @@
+#!/bin/sh
+#
+# Copyright (c) 2006, 2008 Junio C Hamano
+#
+# The "pre-rebase" hook is run just before "git rebase" starts doing
+# its job, and can prevent the command from running by exiting with
+# non-zero status.
+#
+# The hook is called with the following parameters:
+#
+# $1 -- the upstream the series was forked from.
+# $2 -- the branch being rebased (or empty when rebasing the current branch).
+#
+# This sample shows how to prevent topic branches that are already
+# merged to 'next' branch from getting rebased, because allowing it
+# would result in rebasing already published history.
+
+publish=next
+basebranch="$1"
+if test "$#" = 2
+then
+	topic="refs/heads/$2"
+else
+	topic=`git symbolic-ref HEAD` ||
+	exit 0 ;# we do not interrupt rebasing detached HEAD
+fi
+
+case "$topic" in
+refs/heads/??/*)
+	;;
+*)
+	exit 0 ;# we do not interrupt others.
+	;;
+esac
+
+# Now we are dealing with a topic branch being rebased
+# on top of master.  Is it OK to rebase it?
+
+# Does the topic really exist?
+git show-ref -q "$topic" || {
+	echo >&2 "No such branch $topic"
+	exit 1
+}
+
+# Is topic fully merged to master?
+not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
+if test -z "$not_in_master"
+then
+	echo >&2 "$topic is fully merged to master; better remove it."
+	exit 1 ;# we could allow it, but there is no point.
+fi
+
+# Is topic ever merged to next?  If so you should not be rebasing it.
+only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
+only_next_2=`git rev-list ^master           ${publish} | sort`
+if test "$only_next_1" = "$only_next_2"
+then
+	not_in_topic=`git rev-list "^$topic" master`
+	if test -z "$not_in_topic"
+	then
+		echo >&2 "$topic is already up-to-date with master"
+		exit 1 ;# we could allow it, but there is no point.
+	else
+		exit 0
+	fi
+else
+	not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
+	/usr/bin/perl -e '
+		my $topic = $ARGV[0];
+		my $msg = "* $topic has commits already merged to public branch:\n";
+		my (%not_in_next) = map {
+			/^([0-9a-f]+) /;
+			($1 => 1);
+		} split(/\n/, $ARGV[1]);
+		for my $elem (map {
+				/^([0-9a-f]+) (.*)$/;
+				[$1 => $2];
+			} split(/\n/, $ARGV[2])) {
+			if (!exists $not_in_next{$elem->[0]}) {
+				if ($msg) {
+					print STDERR $msg;
+					undef $msg;
+				}
+				print STDERR " $elem->[1]\n";
+			}
+		}
+	' "$topic" "$not_in_next" "$not_in_master"
+	exit 1
+fi
+
+exit 0
+
+################################################################
+
+This sample hook safeguards topic branches that have been
+published from being rewound.
+
+The workflow assumed here is:
+
+ * Once a topic branch forks from "master", "master" is never
+   merged into it again (either directly or indirectly).
+
+ * Once a topic branch is fully cooked and merged into "master",
+   it is deleted.  If you need to build on top of it to correct
+   earlier mistakes, a new topic branch is created by forking at
+   the tip of the "master".  This is not strictly necessary, but
+   it makes it easier to keep your history simple.
+
+ * Whenever you need to test or publish your changes to topic
+   branches, merge them into "next" branch.
+
+The script, being an example, hardcodes the publish branch name
+to be "next", but it is trivial to make it configurable via
+$GIT_DIR/config mechanism.
+
+With this workflow, you would want to know:
+
+(1) ... if a topic branch has ever been merged to "next".  Young
+    topic branches can have stupid mistakes you would rather
+    clean up before publishing, and things that have not been
+    merged into other branches can be easily rebased without
+    affecting other people.  But once it is published, you would
+    not want to rewind it.
+
+(2) ... if a topic branch has been fully merged to "master".
+    Then you can delete it.  More importantly, you should not
+    build on top of it -- other people may already want to
+    change things related to the topic as patches against your
+    "master", so if you need further changes, it is better to
+    fork the topic (perhaps with the same name) afresh from the
+    tip of "master".
+
+Let's look at this example:
+
+		   o---o---o---o---o---o---o---o---o---o "next"
+		  /       /           /           /
+		 /   a---a---b A     /           /
+		/   /               /           /
+	       /   /   c---c---c---c B         /
+	      /   /   /             \         /
+	     /   /   /   b---b C     \       /
+	    /   /   /   /             \     /
+    ---o---o---o---o---o---o---o---o---o---o---o "master"
+
+
+A, B and C are topic branches.
+
+ * A has one fix since it was merged up to "next".
+
+ * B has finished.  It has been fully merged up to "master" and "next",
+   and is ready to be deleted.
+
+ * C has not merged to "next" at all.
+
+We would want to allow C to be rebased, refuse A, and encourage
+B to be deleted.
+
+To compute (1):
+
+	git rev-list ^master ^topic next
+	git rev-list ^master        next
+
+	if these match, topic has not merged in next at all.
+
+To compute (2):
+
+	git rev-list master..topic
+
+	if this is empty, it is fully merged to "master".
diff -rupN keepalived-1.2.7/.git/hooks/update.sample keepalived-1.2.7-unicast/.git/hooks/update.sample
--- keepalived-1.2.7/.git/hooks/update.sample	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/.git/hooks/update.sample	2013-05-24 10:12:29.399754900 +0200
@@ -0,0 +1,128 @@
+#!/bin/sh
+#
+# An example hook script to blocks unannotated tags from entering.
+# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
+#
+# To enable this hook, rename this file to "update".
+#
+# Config
+# ------
+# hooks.allowunannotated
+#   This boolean sets whether unannotated tags will be allowed into the
+#   repository.  By default they won't be.
+# hooks.allowdeletetag
+#   This boolean sets whether deleting tags will be allowed in the
+#   repository.  By default they won't be.
+# hooks.allowmodifytag
+#   This boolean sets whether a tag may be modified after creation. By default
+#   it won't be.
+# hooks.allowdeletebranch
+#   This boolean sets whether deleting branches will be allowed in the
+#   repository.  By default they won't be.
+# hooks.denycreatebranch
+#   This boolean sets whether remotely creating branches will be denied
+#   in the repository.  By default this is allowed.
+#
+
+# --- Command line
+refname="$1"
+oldrev="$2"
+newrev="$3"
+
+# --- Safety check
+if [ -z "$GIT_DIR" ]; then
+	echo "Don't run this script from the command line." >&2
+	echo " (if you want, you could supply GIT_DIR then run" >&2
+	echo "  $0 <ref> <oldrev> <newrev>)" >&2
+	exit 1
+fi
+
+if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
+	echo "Usage: $0 <ref> <oldrev> <newrev>" >&2
+	exit 1
+fi
+
+# --- Config
+allowunannotated=$(git config --bool hooks.allowunannotated)
+allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
+denycreatebranch=$(git config --bool hooks.denycreatebranch)
+allowdeletetag=$(git config --bool hooks.allowdeletetag)
+allowmodifytag=$(git config --bool hooks.allowmodifytag)
+
+# check for no description
+projectdesc=$(sed -e '1q' "$GIT_DIR/description")
+case "$projectdesc" in
+"Unnamed repository"* | "")
+	echo "*** Project description file hasn't been set" >&2
+	exit 1
+	;;
+esac
+
+# --- Check types
+# if $newrev is 0000...0000, it's a commit to delete a ref.
+zero="0000000000000000000000000000000000000000"
+if [ "$newrev" = "$zero" ]; then
+	newrev_type=delete
+else
+	newrev_type=$(git cat-file -t $newrev)
+fi
+
+case "$refname","$newrev_type" in
+	refs/tags/*,commit)
+		# un-annotated tag
+		short_refname=${refname##refs/tags/}
+		if [ "$allowunannotated" != "true" ]; then
+			echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
+			echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
+			exit 1
+		fi
+		;;
+	refs/tags/*,delete)
+		# delete tag
+		if [ "$allowdeletetag" != "true" ]; then
+			echo "*** Deleting a tag is not allowed in this repository" >&2
+			exit 1
+		fi
+		;;
+	refs/tags/*,tag)
+		# annotated tag
+		if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
+		then
+			echo "*** Tag '$refname' already exists." >&2
+			echo "*** Modifying a tag is not allowed in this repository." >&2
+			exit 1
+		fi
+		;;
+	refs/heads/*,commit)
+		# branch
+		if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
+			echo "*** Creating a branch is not allowed in this repository" >&2
+			exit 1
+		fi
+		;;
+	refs/heads/*,delete)
+		# delete branch
+		if [ "$allowdeletebranch" != "true" ]; then
+			echo "*** Deleting a branch is not allowed in this repository" >&2
+			exit 1
+		fi
+		;;
+	refs/remotes/*,commit)
+		# tracking branch
+		;;
+	refs/remotes/*,delete)
+		# delete tracking branch
+		if [ "$allowdeletebranch" != "true" ]; then
+			echo "*** Deleting a tracking branch is not allowed in this repository" >&2
+			exit 1
+		fi
+		;;
+	*)
+		# Anything else (is there anything else?)
+		echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
+		exit 1
+		;;
+esac
+
+# --- Finished
+exit 0
Binärdateien keepalived-1.2.7/.git/index and keepalived-1.2.7-unicast/.git/index sind verschieden.
diff -rupN keepalived-1.2.7/.git/info/exclude keepalived-1.2.7-unicast/.git/info/exclude
--- keepalived-1.2.7/.git/info/exclude	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/.git/info/exclude	2013-05-24 10:12:29.401755000 +0200
@@ -0,0 +1,6 @@
+# git ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~
diff -rupN keepalived-1.2.7/.git/logs/HEAD keepalived-1.2.7-unicast/.git/logs/HEAD
--- keepalived-1.2.7/.git/logs/HEAD	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/.git/logs/HEAD	2013-05-24 10:12:36.385154500 +0200
@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 82d4f61ee319ab69d94b479c6be8a7c5ed30a1f7 U-arrakis\jg <jg@arrakis.(none)> 1369383156 +0200	clone: from https://github.com/rohara/keepalived.git
diff -rupN keepalived-1.2.7/.git/logs/refs/heads/master keepalived-1.2.7-unicast/.git/logs/refs/heads/master
--- keepalived-1.2.7/.git/logs/refs/heads/master	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/.git/logs/refs/heads/master	2013-05-24 10:12:36.384154400 +0200
@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 82d4f61ee319ab69d94b479c6be8a7c5ed30a1f7 U-arrakis\jg <jg@arrakis.(none)> 1369383156 +0200	clone: from https://github.com/rohara/keepalived.git
Binärdateien keepalived-1.2.7/.git/objects/pack/pack-80ca1c787744856a202f4a72abd2b97e7e41b57b.idx and keepalived-1.2.7-unicast/.git/objects/pack/pack-80ca1c787744856a202f4a72abd2b97e7e41b57b.idx sind verschieden.
Binärdateien keepalived-1.2.7/.git/objects/pack/pack-80ca1c787744856a202f4a72abd2b97e7e41b57b.pack and keepalived-1.2.7-unicast/.git/objects/pack/pack-80ca1c787744856a202f4a72abd2b97e7e41b57b.pack sind verschieden.
diff -rupN keepalived-1.2.7/.git/packed-refs keepalived-1.2.7-unicast/.git/packed-refs
--- keepalived-1.2.7/.git/packed-refs	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/.git/packed-refs	2013-05-24 10:12:36.367153400 +0200
@@ -0,0 +1,120 @@
+# pack-refs with: peeled 
+415c72bb9c5fc5f0d1b4ec74a19553dbb2d64773 refs/remotes/origin/1.1.0
+681e73431e0b7772d3428a0cf5fb376786a2a249 refs/remotes/origin/devel
+82d4f61ee319ab69d94b479c6be8a7c5ed30a1f7 refs/remotes/origin/master
+4f8e63b03eb3e360ea94142023dd9055517ce6fb refs/remotes/origin/vrrp_unicast
+29513a1230cc1a83e27ccc6768f8b6afea579edb refs/tags/show
+1966075338f6181579953a60d98b1b0e51a77317 refs/tags/v0.2.1
+^8c603ddac5bfdb3a45296764703846ffb78fa2b6
+d2d1ffdd2db6e01775dae62a0183e2f566e01ea7 refs/tags/v0.2.3
+^88e231ef0227ea2f8c11e9c911fba98833c4aeae
+560b65d217a25ec34eb588dbbf9cbe3635b57ad7 refs/tags/v0.2.6
+^f23b3fbbcf6f4fc9ee97400bc465b06a658b23e7
+53115a7014b5f1460c3edb4e0eccec70568a0aa4 refs/tags/v0.2.7
+^afdd60d85c212c9c332651d4b63a2142a844ef99
+5ad5f3983722643bf16e4fa2655980cc3ab11d8d refs/tags/v0.3.5
+^d41fdfbeed1c87cae77cef78b44b72396bb3f329
+191c0182bdb3053211442473ec2aa27482a6826d refs/tags/v0.3.6
+^99169f8b7302b1bab74889f30ca2786fef9c9c86
+feb511ee71c3a51b4765f44ee2bd5edcbb8187c6 refs/tags/v0.3.7
+^4b97c33819536a0631dd1153b80b1469a71d63da
+07ea4093e6196d1c83e68dcd47cea196787b1b0f refs/tags/v0.3.8
+^b9a4794565aec694b56181b8f27c3e3a2f276e43
+bd608a8e464672f32986aaebf1a2d29739aaf9ec refs/tags/v0.4.0
+^9cb8783b23ea00b32d4e30a343b5207831e26ddb
+8dc06d56ba479be809dc0fbaac40f6de06d388f2 refs/tags/v0.4.1
+^5fa8aaf845a80f183a7a39b496154054c8f04063
+49a0616c965171a09bac18eafd85bedd61605d1a refs/tags/v0.4.8
+^64b059dd27a5bd8539084f43b8194af9332e0551
+f15031651d2230f453508addee378df70c944c29 refs/tags/v0.4.9
+^2ef6faba91d43f6d7079de93d02b23bdfcde1b2b
+ec8930b7d8f6e0f073ca474248c752af313d81d0 refs/tags/v0.4.9a
+^76dd618149a3b8ab45895a92ac9f868cb6bdf0a3
+8c125258fc4560068abd03401a9fff5fdb6320c6 refs/tags/v0.5.3
+^c2a37a4e0e126f40fc12a4da4d6100e45476117c
+bdd654b9ef8ddef8db7b5fb7a254968eea9f6332 refs/tags/v0.5.5
+^0577afcf66b696c70d7e773a02040dbaa6f5eec6
+305f7ab0bd4dd94bbf4e8d773edc3408095c5134 refs/tags/v0.5.6
+^6b16c70c039098ad597f23a3009749ff5d58d451
+dd63eb0b34df1d6a9938978701fa74fcdf7298ed refs/tags/v0.5.7
+^ab59e5d0933521031124eeafa185cd16257b60fa
+72d42f93dbefe38cf2a3ffed40c79fccbb92ad9d refs/tags/v0.5.8
+^1cfb6e163dc116d55e05f5a263b3a84c78f073eb
+36be640ed31437a9ebadd8d96b67e40602d99bb3 refs/tags/v0.5.9
+^f1b2903b50013fe486f691b6699e7e691ce8d069
+0902922e6c054c0a65aedd8af0a1c3802d3248f7 refs/tags/v0.6.1
+^d436dec6f22e603652e142649eac1cfb4ac0106a
+457c17e05e9a932035364f2422db2a057320535b refs/tags/v0.6.10
+^05ff3a74ddd7e5628546a68ef072b926d9972937
+1d4bd10742899627ad557a58b1f69d70225026c9 refs/tags/v0.6.2
+^c2a7b13f32e4b3ba1873c5bb228f369df4c0f282
+50aae386bf7df617586c83fcaa4725269fa181a9 refs/tags/v0.6.3
+^994babf6cf7855423364d03126d5a62cc613707c
+524164707007a91c3d84eaa50936149a7fd34e2b refs/tags/v0.6.4
+^a5dfa8033937148658412f292bf770cfab0c7c49
+07ab65c2ccd1a9abea89d20b69c7793adc7127a4 refs/tags/v0.6.6
+^80c700f9ce90cb17d11d5ece752316f91a22ea36
+ec36678151d77808d89e7e4ab06fed5aaadfd6e0 refs/tags/v0.6.8
+^2aa0b585bd48da95d50d00edc2f601344306c09d
+341492886d8db3b06d56c6cb4342c09f424f3b30 refs/tags/v0.6.9
+^7ff20127850d914d08e111c5b31290beaf5acea2
+e6bbfbdae144dee1470e2f512de71de1a9194eec refs/tags/v0.7.1
+^a39923bbd0e41dcaf878872b009e7d4c485cb4aa
+3422cd9758bfb0b6b519a581269e5deb4c7cf3d8 refs/tags/v0.7.6
+^33a4dd3613a3ad7717a5faa8f0840817f2070914
+f4cc2c3eacce40d41f0181d023112945dbad4c9d refs/tags/v1.0.0
+^d20999c393058e95e9544a81988fcec2f70cafcc
+4d54268b38d684d40bfd13717610df04a5e6308f refs/tags/v1.0.1
+^560fc127af2eb94066a1071ac6ac125a0d14c278
+a9719dc00f43c095133b48ca20b711e44c34723f refs/tags/v1.0.2
+^681972a544d72221dc6025e45cf02944fcadd3e7
+d62aa3082b5ec9f67cbd94c114554c9a9fa34a8c refs/tags/v1.0.3
+^f8952886fea4e53a2b73fe68b63cea0850858a07
+782467286b601ef6ad863ffebc358ed7ea3a3767 refs/tags/v1.1.0
+^ccd28c6bd4275e175107a275464f3d53920d545e
+2f7e0c9f3845c3e31bf4ee56631f091fe143eeb1 refs/tags/v1.1.1
+^5de330adc929952673dd20733da8b06ea3d5c1df
+df367db31a07af3a9bd4f5f4cae5903927964351 refs/tags/v1.1.10
+^c11785398fcb5e5312d960e0c0832bd0e19c3a20
+264b5fca4daa6f51e58a8f65510133a38f95e4a5 refs/tags/v1.1.11
+^4d19940fef438342f1df674da633bf37bd8d8e8f
+1f81a745a8ebfa6d736b7c1f93c18eff92f51ee6 refs/tags/v1.1.12
+^fd91a82f99ceeff8fdbbfe066f5d14939f236d9f
+eb26f9c4893063b909e4ef0863e493c30c0d40ba refs/tags/v1.1.13
+^835e57d94db506071d2203a20b7c006a5c4a1b26
+0be25e7da3aa9f479b670773eab6a1b9624ca226 refs/tags/v1.1.14
+^d2150d381906920b92c110f50bf8d8665a65c03f
+d2181d7cdf861b0695223c320d596c2d5225fa9f refs/tags/v1.1.15
+^d49c7c88a1645254f542487fec3eca693c37dec4
+0613fa78db56397af2ac77d597abe247d7634a43 refs/tags/v1.1.16
+^cd66882ea964c6e1af7452d90d165808973e1b68
+6354cc65ddd16b282946b67238c726281cceeb1d refs/tags/v1.1.17
+^240ce7daa4a7adac9252adad11607146cbef3812
+e942710e19a7419be666864420e96dab76cde4c4 refs/tags/v1.1.18
+^a267bd54237116614615e1b8cdb66f5664647c46
+340fed096cd793a61552491fbb7d6601f4478929 refs/tags/v1.1.19
+^553ee4f1bb334f0903fe757e3415a03c84f273c5
+94a2c0a6e47b38f283b582649343b8f6bf0eba87 refs/tags/v1.1.2
+^6b2cf7c20e09a5b99252249acd03a74895bd7b29
+475eada593d5d0841dff27e273f6708d20c21313 refs/tags/v1.1.3
+^c2f69b09c2d15186db57c74f8f84de2f92bf4c14
+88929259fc54d4ab7f3db676c622275f692e9a1d refs/tags/v1.1.4
+^4d6ffa1c10079cc7dc81a7d927f536889ad210e8
+8026337e8b0d0c3eca8a0fe879927fc08d44c547 refs/tags/v1.1.5
+^d7bbdd2afa684dda0ef7d3440539f27ff087ea60
+d4fff7d04360cad971f6f66bd3bd943755ba002d refs/tags/v1.1.6
+^1e4ff55178a13ce7af0b496ab1984b59ebcf1ca9
+c3a1adddc97e64fe178cf847d1db5329c3ecc9dd refs/tags/v1.1.7
+^850ee085c09b27bd765d9ea9d10843f0fb3aabd0
+2bbeefef9b2a46662093e68d446885fa25b0146f refs/tags/v1.1.8
+^20056cc285e399208b3b87b46417408260d4fc93
+bddc647ecf44d5b03c94a6c35827a43b0a953aba refs/tags/v1.1.9
+^2d3f0067e18d9eaea61e96e429a0338d07a564c5
+0cf8e41f1f3f993446d6791bd49844b729cedbf6 refs/tags/v1.2.1
+a1359020c5688230d2bb26f58997ccd91c31caee refs/tags/v1.2.2
+^a6bc0b0c36a4a43c7693da2d1f6386ab62ccaab1
+322a02e27edc0ac3f3735d9db3bf487e92419b2f refs/tags/v1.2.3
+29513a1230cc1a83e27ccc6768f8b6afea579edb refs/tags/v1.2.4
+d0946ab3be2c20a69fd7b07c3d9b2f3f7a8718fa refs/tags/v1.2.5
+6dcb0c5732cf71943578b8591f7742f90879b701 refs/tags/v1.2.6
+6b561589e5c4b662c4e71bd859db145796f91544 refs/tags/v1.2.7
diff -rupN keepalived-1.2.7/.git/refs/heads/master keepalived-1.2.7-unicast/.git/refs/heads/master
--- keepalived-1.2.7/.git/refs/heads/master	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/.git/refs/heads/master	2013-05-24 10:12:36.377154000 +0200
@@ -0,0 +1 @@
+82d4f61ee319ab69d94b479c6be8a7c5ed30a1f7
diff -rupN keepalived-1.2.7/.git/refs/remotes/origin/HEAD keepalived-1.2.7-unicast/.git/refs/remotes/origin/HEAD
--- keepalived-1.2.7/.git/refs/remotes/origin/HEAD	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/.git/refs/remotes/origin/HEAD	2013-05-24 10:12:36.371153700 +0200
@@ -0,0 +1 @@
+ref: refs/remotes/origin/master
diff -rupN keepalived-1.2.7/.gitignore keepalived-1.2.7-unicast/.gitignore
--- keepalived-1.2.7/.gitignore	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/.gitignore	2013-05-24 10:12:36.405155600 +0200
@@ -0,0 +1,10 @@
+*.orig
+*.o
+*.a
+Makefile
+bin/*
+config.log
+config.status
+keepalived.spec
+keepalived/include/config.h
+
diff -rupN keepalived-1.2.7/.indent.pro keepalived-1.2.7-unicast/.indent.pro
--- keepalived-1.2.7/.indent.pro	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/.indent.pro	2013-05-24 10:12:36.407155700 +0200
@@ -0,0 +1,8 @@
+-kr
+-i8
+-ts8
+-sob
+-l80
+-ss
+-bs
+-psl
diff -rupN keepalived-1.2.7/configure keepalived-1.2.7-unicast/configure
--- keepalived-1.2.7/configure	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/configure	2013-05-24 10:12:36.438157500 +0200
@@ -2181,7 +2181,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 VERSION=`cat VERSION`
 VERSION_DATE=`date +%m/%d,20%y`
-OUTPUT_TARGET="Makefile genhash/Makefile keepalived/core/Makefile keepalived/include/config.h keepalived.spec"
+OUTPUT_TARGET="Makefile genhash/Makefile keepalived/core/Makefile lib/config.h keepalived.spec"
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
diff -rupN keepalived-1.2.7/configure.in keepalived-1.2.7-unicast/configure.in
--- keepalived-1.2.7/configure.in	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/configure.in	2013-05-24 10:12:36.440157600 +0200
@@ -10,7 +10,7 @@ dnl ----[ Process this file with autocon
 AC_INIT(keepalived/core/main.c)
 VERSION=`cat VERSION`
 VERSION_DATE=`date +%m/%d,20%y`
-OUTPUT_TARGET="Makefile genhash/Makefile keepalived/core/Makefile keepalived/include/config.h keepalived.spec"
+OUTPUT_TARGET="Makefile genhash/Makefile keepalived/core/Makefile lib/config.h keepalived.spec"
 
 dnl ----[ Checks for programs ]----
 AC_PROG_CC
diff -rupN keepalived-1.2.7/doc/keepalived.conf.SYNOPSIS keepalived-1.2.7-unicast/doc/keepalived.conf.SYNOPSIS
--- keepalived-1.2.7/doc/keepalived.conf.SYNOPSIS	2012-07-18 21:59:40.000000000 +0200
+++ keepalived-1.2.7-unicast/doc/keepalived.conf.SYNOPSIS	2013-05-24 10:12:36.447158000 +0200
@@ -121,12 +121,13 @@ vrrp_sync_group <STRING> {	# VRRP sync g
 }
 
 (1) The "notify" script is called AFTER the corresponding notify_* script has
-    been called, and is given exactly 3 arguments (the whole string is interpreted
+    been called, and is given exactly 4 arguments (the whole string is interpreted
     as a litteral filename so don't add parameters!):
 
     $1 = A string indicating whether it's a "GROUP" or an "INSTANCE"
     $2 = The name of said group or instance
     $3 = The state it's transitioning to ("MASTER", "BACKUP" or "FAULT")
+    $4 = The priority value
 
     $1 and $3 are ALWAYS sent in uppercase, and the possible strings sent are the
     same ones listed above ("GROUP"/"INSTANCE", "MASTER"/"BACKUP"/"FAULT").
diff -rupN keepalived-1.2.7/goodies/arpreset.pl keepalived-1.2.7-unicast/goodies/arpreset.pl
--- keepalived-1.2.7/goodies/arpreset.pl	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/goodies/arpreset.pl	2013-05-24 10:12:36.495160800 +0200
@@ -0,0 +1,97 @@
+#!/usr/bin/perl -w
+
+###################################################################
+# arpreset 0.2
+# Copyright (C) 2005  Steve Milton (milton AT isomedia.com)
+#
+# Utility for deleting a single ARP entry from a cisco router.
+# Script adapted from description on Cisco tech article.
+#   http://www.cisco.com/warp/public/477/SNMP/clear_arp.shtml
+#
+# The Cisco router needs to have a read/write community setup
+# for the utility to work.  I recommend using the following
+# IOS commands to setup a restricted community that can only
+# work with the MAC table.  You will need ENABLE level access
+# to the router to execute these commands.
+#
+#    access-list 50 permit 123.123.123.123
+#    access-list 50 permit 123.123.123.124
+#    access-list 50 deny any
+#    snmp-server view arpchange ipNetToMediaEntry.4 included
+#    snmp-server community blahblah view arpchange RW 50
+#
+# Set the access-list permit to the IP addresses of the systems
+# you want to be able to make changes to the MAC table.  Set 
+# the community name (above blahblah) to something random and 
+# password-like.
+###################################################################
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  
+# 02110-1301, USA.
+###################################################################
+
+use strict;
+use Getopt::Long;
+&Getopt::Long::config('auto_abbrev');
+
+my ($router,$community,$address,$help,$check);
+$router=$community=$address=$help=$check="";
+
+my $status = GetOptions("router:s" => \$router,
+                        "community:s" => \$community,
+                        "address:s" => \$address,
+			"help" => \$help,
+			"check" => \$check);
+
+if (($status == 0) or $help) {
+    &PrintUsage;
+    exit 1;
+}
+
+if (!$router or !$community or !$address) {
+    &PrintUsage;
+    exit 1;
+}
+
+# OID for the ARP table entries
+my $ciscoOID = ".1.3.6.1.2.1.4.22.1.4";
+my $target = "";
+
+# Walk the SNMP ARP table on the router to locate the target address
+open(GET, "/usr/bin/snmpwalk -v1 -c $community $router $ciscoOID |");
+while(<GET>) {
+    if (/^(.*?\.$address)\s/) {
+	$target = $1;
+	print $_;
+    }
+}
+close(GET);
+if ($target and !$check) {
+    print "-- changed to --\n";
+    # set the target address to "invalid"
+    system("/usr/bin/snmpset -v1 -c $community $router $target i 2");
+} elsif (!$check) {
+    print "No target OID located.";
+    exit 1;
+}
+exit;
+
+sub PrintUsage {
+    print "arpreset 0.2\nCopyright (c) 2005 by Steve Milton\narpreset comes with ABSOLUTELY NO WARRANTY\n\n";
+    print "Usage: arpreset --router=routeraddress --community=rwcommunity --address=ipaddress\n";
+    print "       arpreset --help\n";
+    print "\nWhere ipaddress is the IP address in the Cisco router that you want to invalidate\nfrom the MAC address cache.\n";
+    print "\nYou can add --check to the command to make it NOT update the router, but check for\nthe entry only.\n";
+    exit;
+}
diff -rupN keepalived-1.2.7/keepalived/check/check_api.c keepalived-1.2.7-unicast/keepalived/check/check_api.c
--- keepalived-1.2.7/keepalived/check/check_api.c	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/check/check_api.c	2013-05-24 10:12:36.502161200 +0200
@@ -64,8 +64,8 @@ queue_checker(void (*free_func) (void *)
 	      , int (*launch) (thread_t *)
 	      , void *data)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
-	real_server *rs = LIST_TAIL_DATA(vs->rs);
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
+	real_server_t *rs = LIST_TAIL_DATA(vs->rs);
 	checker_t *checker = (checker_t *) MALLOC(sizeof (checker_t));
 
 	checker->free_func = free_func;
@@ -96,8 +96,8 @@ queue_checker(void (*free_func) (void *)
 void
 checker_set_dst(struct sockaddr_storage *dst)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
-	real_server *rs = LIST_TAIL_DATA(vs->rs);
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
+	real_server_t *rs = LIST_TAIL_DATA(vs->rs);
 
 	*dst = rs->addr;
 }
diff -rupN keepalived-1.2.7/keepalived/check/check_data.c keepalived-1.2.7-unicast/keepalived/check/check_data.c
--- keepalived-1.2.7/keepalived/check/check_data.c	2012-08-29 00:05:12.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/check/check_data.c	2013-05-24 10:12:36.505161300 +0200
@@ -29,8 +29,8 @@
 #include "ipwrapper.h"
 
 /* global vars */
-check_conf_data *check_data = NULL;
-check_conf_data *old_check_data = NULL;
+check_data_t *check_data = NULL;
+check_data_t *old_check_data = NULL;
 
 /* SSL facility functions */
 ssl_data_t *
@@ -73,7 +73,7 @@ dump_ssl(void)
 static void
 free_vsg(void *data)
 {
-	virtual_server_group *vsg = data;
+	virtual_server_group_t *vsg = data;
 	FREE_PTR(vsg->gname);
 	free_list(vsg->addr_ip);
 	free_list(vsg->range);
@@ -83,7 +83,7 @@ free_vsg(void *data)
 static void
 dump_vsg(void *data)
 {
-	virtual_server_group *vsg = data;
+	virtual_server_group_t *vsg = data;
 
 	log_message(LOG_INFO, " Virtual Server Group = %s", vsg->gname);
 	dump_list(vsg->addr_ip);
@@ -98,7 +98,7 @@ free_vsg_entry(void *data)
 static void
 dump_vsg_entry(void *data)
 {
-	virtual_server_group_entry *vsg_entry = data;
+	virtual_server_group_entry_t *vsg_entry = data;
 
 	if (vsg_entry->vfwmark)
 		log_message(LOG_INFO, "   FWMARK = %d", vsg_entry->vfwmark);
@@ -116,9 +116,9 @@ void
 alloc_vsg(char *gname)
 {
 	int size = strlen(gname);
-	virtual_server_group *new;
+	virtual_server_group_t *new;
 
-	new = (virtual_server_group *) MALLOC(sizeof (virtual_server_group));
+	new = (virtual_server_group_t *) MALLOC(sizeof(virtual_server_group_t));
 	new->gname = (char *) MALLOC(size + 1);
 	memcpy(new->gname, gname, size);
 	new->addr_ip = alloc_list(free_vsg_entry, dump_vsg_entry);
@@ -130,10 +130,10 @@ alloc_vsg(char *gname)
 void
 alloc_vsg_entry(vector_t *strvec)
 {
-	virtual_server_group *vsg = LIST_TAIL_DATA(check_data->vs_group);
-	virtual_server_group_entry *new;
+	virtual_server_group_t *vsg = LIST_TAIL_DATA(check_data->vs_group);
+	virtual_server_group_entry_t *new;
 
-	new = (virtual_server_group_entry *) MALLOC(sizeof (virtual_server_group_entry));
+	new = (virtual_server_group_entry_t *) MALLOC(sizeof(virtual_server_group_entry_t));
 
 	if (!strcmp(vector_slot(strvec, 0), "fwmark")) {
 		new->vfwmark = atoi(vector_slot(strvec, 1));
@@ -152,7 +152,7 @@ alloc_vsg_entry(vector_t *strvec)
 static void
 free_vs(void *data)
 {
-	virtual_server *vs = data;
+	virtual_server_t *vs = data;
 	FREE_PTR(vs->vsgname);
 	FREE_PTR(vs->virtualhost);
 	FREE_PTR(vs->s_svr);
@@ -164,7 +164,7 @@ free_vs(void *data)
 static void
 dump_vs(void *data)
 {
-	virtual_server *vs = data;
+	virtual_server_t *vs = data;
 
 	if (vs->vsgname)
 		log_message(LOG_INFO, " VS GROUP = %s", vs->vsgname);
@@ -226,9 +226,9 @@ void
 alloc_vs(char *ip, char *port)
 {
 	int size = strlen(port);
-	virtual_server *new;
+	virtual_server_t *new;
 
-	new = (virtual_server *) MALLOC(sizeof (virtual_server));
+	new = (virtual_server_t *) MALLOC(sizeof(virtual_server_t));
 
 	if (!strcmp(ip, "group")) {
 		new->vsgname = (char *) MALLOC(size + 1);
@@ -257,9 +257,9 @@ alloc_vs(char *ip, char *port)
 void
 alloc_ssvr(char *ip, char *port)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
 
-	vs->s_svr = (real_server *) MALLOC(sizeof (real_server));
+	vs->s_svr = (real_server_t *) MALLOC(sizeof(real_server_t));
 	vs->s_svr->weight = 1;
 	vs->s_svr->iweight = 1;
 	inet_stosockaddr(ip, port, &vs->s_svr->addr);
@@ -269,7 +269,7 @@ alloc_ssvr(char *ip, char *port)
 static void
 free_rs(void *data)
 {
-	real_server *rs = data;
+	real_server_t *rs = data;
 	FREE_PTR(rs->notify_up);
 	FREE_PTR(rs->notify_down);
 	free_list(rs->failed_checkers);
@@ -278,7 +278,7 @@ free_rs(void *data)
 static void
 dump_rs(void *data)
 {
-	real_server *rs = data;
+	real_server_t *rs = data;
 
 	log_message(LOG_INFO, "   RIP = %s, RPORT = %d, WEIGHT = %d"
 			    , inet_sockaddrtos(&rs->addr)
@@ -303,10 +303,10 @@ free_failed_checkers(void *data)
 void
 alloc_rs(char *ip, char *port)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
-	real_server *new;
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
+	real_server_t *new;
 
-	new = (real_server *) MALLOC(sizeof (real_server));
+	new = (real_server_t *) MALLOC(sizeof(real_server_t));
 	inet_stosockaddr(ip, port, &new->addr);
 
 	new->weight = 1;
@@ -319,12 +319,12 @@ alloc_rs(char *ip, char *port)
 }
 
 /* data facility functions */
-check_conf_data *
+check_data_t *
 alloc_check_data(void)
 {
-	check_conf_data *new;
+	check_data_t *new;
 
-	new = (check_conf_data *) MALLOC(sizeof (check_conf_data));
+	new = (check_data_t *) MALLOC(sizeof(check_data_t));
 	new->vs = alloc_list(free_vs, dump_vs);
 	new->vs_group = alloc_list(free_vsg, dump_vsg);
 
@@ -332,7 +332,7 @@ alloc_check_data(void)
 }
 
 void
-free_check_data(check_conf_data *data)
+free_check_data(check_data_t *data)
 {
 	free_list(data->vs);
 	free_list(data->vs_group);
@@ -340,7 +340,7 @@ free_check_data(check_conf_data *data)
 }
 
 void
-dump_check_data(check_conf_data *data)
+dump_check_data(check_data_t *data)
 {
 	if (data->ssl) {
 		log_message(LOG_INFO, "------< SSL definitions >------");
diff -rupN keepalived-1.2.7/keepalived/check/check_http.c keepalived-1.2.7-unicast/keepalived/check/check_http.c
--- keepalived-1.2.7/keepalived/check/check_http.c	2012-08-29 00:05:12.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/check/check_http.c	2013-05-24 10:12:36.507161400 +0200
@@ -92,7 +92,7 @@ alloc_http_get(char *proto)
 	http_checker_t *http_get_chk;
 
 	http_get_chk = (http_checker_t *) MALLOC(sizeof (http_checker_t));
-	http_get_chk->arg = (http_arg_t *) MALLOC(sizeof (http_arg_t));
+	http_get_chk->arg = (http_t *) MALLOC(sizeof (http_t));
 	http_get_chk->proto =
 	    (!strcmp(proto, "HTTP_GET")) ? PROTO_HTTP : PROTO_SSL;
 	http_get_chk->url = alloc_list(free_url, dump_url);
@@ -270,13 +270,13 @@ epilog(thread_t * thread, int method, in
 {
 	checker_t *checker = THREAD_ARG(thread);
 	http_checker_t *http_get_check = CHECKER_ARG(checker);
-	http_arg_t *http_arg = HTTP_ARG(http_get_check);
-	request_t *req = HTTP_REQ(http_arg);
+	http_t *http = HTTP_ARG(http_get_check);
+	request_t *req = HTTP_REQ(http);
 	long delay = 0;
 
 	if (method) {
-		http_arg->url_it += t ? t : -http_arg->url_it;
-		http_arg->retry_it += c ? c : -http_arg->retry_it;
+		http->url_it += t ? t : -http->url_it;
+		http->retry_it += c ? c : -http->retry_it;
 	}
 
 	/*
@@ -285,11 +285,11 @@ epilog(thread_t * thread, int method, in
 	 * html buffer. This is sometime needed with some applications
 	 * servers.
 	 */
-	if (http_arg->retry_it > http_get_check->nb_get_retry-1) {
+	if (http->retry_it > http_get_check->nb_get_retry-1) {
 		if (svr_checker_up(checker->id, checker->rs)) {
 			log_message(LOG_INFO, "Check on service [%s]:%d failed after %d retry."
 			       , inet_sockaddrtos(&http_get_check->dst)
-			       , ntohs(inet_sockaddrport(&http_get_check->dst)), http_arg->retry_it);
+			       , ntohs(inet_sockaddrport(&http_get_check->dst)), http->retry_it);
 			smtp_alert(checker->rs, NULL, NULL,
 				   "DOWN",
 				   "=> CHECK failed on service"
@@ -300,8 +300,8 @@ epilog(thread_t * thread, int method, in
 		}
 
 		/* Reset it counters */
-		http_arg->url_it = 0;
-		http_arg->retry_it = 0;
+		http->url_it = 0;
+		http->retry_it = 0;
 	}
 
 	/* register next timer thread */
@@ -314,7 +314,7 @@ epilog(thread_t * thread, int method, in
 			    http_get_check->delay_before_retry;
 		break;
 	case 2:
-		if (http_arg->url_it == 0 && http_arg->retry_it == 0)
+		if (http->url_it == 0 && http->retry_it == 0)
 			delay = checker->vs->delay_loop;
 		else
 			delay = http_get_check->delay_before_retry;
@@ -328,7 +328,7 @@ epilog(thread_t * thread, int method, in
 		if (req->buffer)
 			FREE(req->buffer);
 		FREE(req);
-		http_arg->req = NULL;
+		http->req = NULL;
 		close(thread->u.fd);
 	}
 
@@ -364,9 +364,9 @@ timeout_epilog(thread_t * thread, char *
 url_t *
 fetch_next_url(http_checker_t * http_get_check)
 {
-	http_arg_t *http_arg = HTTP_ARG(http_get_check);
+	http_t *http = HTTP_ARG(http_get_check);
 
-	return list_element(http_get_check->url, http_arg->url_it);
+	return list_element(http_get_check->url, http->url_it);
 }
 
 /* Handle response */
@@ -376,8 +376,8 @@ http_handle_response(thread_t * thread,
 {
 	checker_t *checker = THREAD_ARG(thread);
 	http_checker_t *http_get_check = CHECKER_ARG(checker);
-	http_arg_t *http_arg = HTTP_ARG(http_get_check);
-	request_t *req = HTTP_REQ(http_arg);
+	http_t *http = HTTP_ARG(http_get_check);
+	request_t *req = HTTP_REQ(http);
 	int r, di = 0;
 	char *digest_tmp;
 	url_t *fetched_url = fetch_next_url(http_get_check);
@@ -411,13 +411,13 @@ http_handle_response(thread_t * thread,
 				DBG("HTTP Status_code to [%s]:%d url(%d) = [%d]."
 				    , inet_sockaddrtos(&http_get_check->dst)
 				    , ntohs(inet_sockaddrport(&http_get_check->dst))
-				    , http_arg->url_it + 1
+				    , http->url_it + 1
 				    , req->status_code);
 				/*
 				 * We set retry iterator to max value to not retry
 				 * when service is already know as die.
 				 */
-				http_arg->retry_it = http_get_check->nb_get_retry;
+				http->retry_it = http_get_check->nb_get_retry;
 			}
 			return epilog(thread, 2, 0, 1);
 		} else {
@@ -426,7 +426,7 @@ http_handle_response(thread_t * thread,
 				       "HTTP status code success to [%s]:%d url(%d)."
 				       , inet_sockaddrtos(&http_get_check->dst)
 				       , ntohs(inet_sockaddrport(&http_get_check->dst))
-				       , http_arg->url_it + 1);
+				       , http->url_it + 1);
 			return epilog(thread, 1, 1, 0) + 1;
 		}
 	}
@@ -461,13 +461,13 @@ http_handle_response(thread_t * thread,
 				DBG("MD5SUM to [%s]:%d url(%d) = [%s]."
 				    , inet_sockaddrtos(&http_get_check->dst)
 				    , ntohs(inet_sockaddrport(&http_get_check->dst))
-				    , http_arg->url_it + 1
+				    , http->url_it + 1
 				    , digest_tmp);
 				/*
 				 * We set retry iterator to max value to not retry
 				 * when service is already know as die.
 				 */
-				http_arg->retry_it = http_get_check->nb_get_retry;
+				http->retry_it = http_get_check->nb_get_retry;
 			}
 			FREE(digest_tmp);
 			return epilog(thread, 2, 0, 1);
@@ -476,7 +476,7 @@ http_handle_response(thread_t * thread,
 				log_message(LOG_INFO, "MD5 digest success to [%s]:%d url(%d)."
 				       , inet_sockaddrtos(&http_get_check->dst)
 				       , ntohs(inet_sockaddrport(&http_get_check->dst))
-				       , http_arg->url_it + 1);
+				       , http->url_it + 1);
 			FREE(digest_tmp);
 			return epilog(thread, 1, 1, 0) + 1;
 		}
@@ -517,8 +517,8 @@ http_read_thread(thread_t * thread)
 {
 	checker_t *checker = THREAD_ARG(thread);
 	http_checker_t *http_get_check = CHECKER_ARG(checker);
-	http_arg_t *http_arg = HTTP_ARG(http_get_check);
-	request_t *req = HTTP_REQ(http_arg);
+	http_t *http = HTTP_ARG(http_get_check);
+	request_t *req = HTTP_REQ(http);
 	unsigned char digest[16];
 	int r = 0;
 	int val;
@@ -601,8 +601,8 @@ http_response_thread(thread_t * thread)
 {
 	checker_t *checker = THREAD_ARG(thread);
 	http_checker_t *http_get_check = CHECKER_ARG(checker);
-	http_arg_t *http_arg = HTTP_ARG(http_get_check);
-	request_t *req = HTTP_REQ(http_arg);
+	http_t *http = HTTP_ARG(http_get_check);
+	request_t *req = HTTP_REQ(http);
 
 	/* Handle read timeout */
 	if (thread->type == THREAD_READ_TIMEOUT)
@@ -632,8 +632,8 @@ http_request_thread(thread_t * thread)
 {
 	checker_t *checker = THREAD_ARG(thread);
 	http_checker_t *http_get_check = CHECKER_ARG(checker);
-	http_arg_t *http_arg = HTTP_ARG(http_get_check);
-	request_t *req = HTTP_REQ(http_arg);
+	http_t *http = HTTP_ARG(http_get_check);
+	request_t *req = HTTP_REQ(http);
 	char *vhost = CHECKER_VHOST(checker);
 	char *str_request;
 	url_t *fetched_url;
@@ -655,7 +655,7 @@ http_request_thread(thread_t * thread)
 		 (vhost) ? vhost : inet_sockaddrtos(&http_get_check->dst)
 		 , ntohs(inet_sockaddrport(&http_get_check->dst)));
 	DBG("Processing url(%d) of [%s]:%d.",
-	    http_arg->url_it + 1
+	    http->url_it + 1
 	    , inet_sockaddrtos(&http_get_check->dst)
 	    , ntohs(inet_sockaddrport(&http_get_check->dst)));
 
@@ -707,9 +707,9 @@ http_check_thread(thread_t * thread)
 {
 	checker_t *checker = THREAD_ARG(thread);
 	http_checker_t *http_get_check = CHECKER_ARG(checker);
-	http_arg_t *http_arg = HTTP_ARG(http_get_check);
+	http_t *http = HTTP_ARG(http_get_check);
 #ifdef _DEBUG_
-	request_t *req = HTTP_REQ(http_arg);
+	request_t *req = HTTP_REQ(http);
 #endif
 	int ret = 1;
 	int status;
@@ -743,8 +743,8 @@ http_check_thread(thread_t * thread)
 		break;
 
 	case connect_success:{
-			if (!http_arg->req) {
-				http_arg->req = (request_t *) MALLOC(sizeof (request_t));
+			if (!http->req) {
+				http->req = (request_t *) MALLOC(sizeof (request_t));
 				new_req = 1;
 			} else
 				new_req = 0;
@@ -761,7 +761,7 @@ http_check_thread(thread_t * thread)
 				}
 
 				if (ret == -1) {
-					switch ((ssl_err = SSL_get_error(http_arg->req->ssl,
+					switch ((ssl_err = SSL_get_error(http->req->ssl,
 									 ret))) {
 					case SSL_ERROR_WANT_READ:
 						thread_add_read(thread->master,
@@ -810,7 +810,7 @@ http_check_thread(thread_t * thread)
 					log_message(LOG_INFO, "SSL handshake/communication error"
 							 " connecting to server"
 							 " (openssl errno: %d) [%s]:%d."
-						       , SSL_get_error (http_arg->req->ssl, ret)
+						       , SSL_get_error (http->req->ssl, ret)
 						       , inet_sockaddrtos(&http_get_check->dst)
 						       , ntohs(inet_sockaddrport(&http_get_check->dst)));
 					smtp_alert(checker->rs, NULL, NULL,
@@ -836,7 +836,7 @@ http_connect_thread(thread_t * thread)
 {
 	checker_t *checker = THREAD_ARG(thread);
 	http_checker_t *http_get_check = CHECKER_ARG(checker);
-	http_arg_t *http_arg = HTTP_ARG(http_get_check);
+	http_t *http = HTTP_ARG(http_get_check);
 	url_t *fetched_url;
 	enum connect_result status;
 	int fd;
@@ -869,7 +869,7 @@ http_connect_thread(thread_t * thread)
 						   , checker->vs
 						   , checker->rs);
 		}
-		http_arg->req = NULL;
+		http->req = NULL;
 		return epilog(thread, 1, 0, 0) + 1;
 	}
 
diff -rupN keepalived-1.2.7/keepalived/check/check_parser.c keepalived-1.2.7-unicast/keepalived/check/check_parser.c
--- keepalived-1.2.7/keepalived/check/check_parser.c	2012-08-29 00:05:12.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/check/check_parser.c	2013-05-24 10:12:36.510161600 +0200
@@ -76,7 +76,7 @@ vs_handler(vector_t *strvec)
 static void
 delay_handler(vector_t *strvec)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
 	vs->delay_loop = atoi(vector_slot(strvec, 1)) * TIMER_HZ;
 	if (vs->delay_loop < TIMER_HZ)
 		vs->delay_loop = TIMER_HZ;
@@ -84,7 +84,7 @@ delay_handler(vector_t *strvec)
 static void
 lbalgo_handler(vector_t *strvec)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
 	char *str = vector_slot(strvec, 1);
 	int size = sizeof (vs->sched);
 	int str_len = strlen(str);
@@ -97,7 +97,7 @@ lbalgo_handler(vector_t *strvec)
 static void
 lbkind_handler(vector_t *strvec)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
 	char *str = vector_slot(strvec, 1);
 
 	if (!strcmp(str, "NAT"))
@@ -112,13 +112,13 @@ lbkind_handler(vector_t *strvec)
 static void
 natmask_handler(vector_t *strvec)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
 	inet_ston(vector_slot(strvec, 1), &vs->nat_mask);
 }
 static void
 pto_handler(vector_t *strvec)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
 	char *str = vector_slot(strvec, 1);
 	int size = sizeof (vs->timeout_persistence);
 	int str_len = strlen(str);
@@ -131,7 +131,7 @@ pto_handler(vector_t *strvec)
 static void
 pgr_handler(vector_t *strvec)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
 	if (vs->addr.ss_family == AF_INET6)
 		vs->granularity_persistence = atoi(vector_slot(strvec, 1));
 	else
@@ -140,20 +140,20 @@ pgr_handler(vector_t *strvec)
 static void
 proto_handler(vector_t *strvec)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
 	char *str = vector_slot(strvec, 1);
 	vs->service_type = (!strcmp(str, "TCP")) ? IPPROTO_TCP : IPPROTO_UDP;
 }
 static void
 hasuspend_handler(vector_t *strvec)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
 	vs->ha_suspend = 1;
 }
 static void
 virtualhost_handler(vector_t *strvec)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
 	vs->virtualhost = set_value(strvec);
 }
 
@@ -173,8 +173,8 @@ rs_handler(vector_t *strvec)
 static void
 weight_handler(vector_t *strvec)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
-	real_server *rs = LIST_TAIL_DATA(vs->rs);
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
+	real_server_t *rs = LIST_TAIL_DATA(vs->rs);
 	rs->weight = atoi(vector_slot(strvec, 1));
 	rs->iweight = rs->weight;
 }
@@ -182,68 +182,68 @@ weight_handler(vector_t *strvec)
 static void
 uthreshold_handler(vector_t *strvec)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
-	real_server *rs = LIST_TAIL_DATA(vs->rs);
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
+	real_server_t *rs = LIST_TAIL_DATA(vs->rs);
 	rs->u_threshold = atoi(vector_slot(strvec, 1));
 }
 static void
 lthreshold_handler(vector_t *strvec)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
-	real_server *rs = LIST_TAIL_DATA(vs->rs);
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
+	real_server_t *rs = LIST_TAIL_DATA(vs->rs);
 	rs->l_threshold = atoi(vector_slot(strvec, 1));
 }
 #endif
 static void
 inhibit_handler(vector_t *strvec)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
-	real_server *rs = LIST_TAIL_DATA(vs->rs);
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
+	real_server_t *rs = LIST_TAIL_DATA(vs->rs);
 	rs->inhibit = 1;
 }
 static void
 notify_up_handler(vector_t *strvec)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
-	real_server *rs = LIST_TAIL_DATA(vs->rs);
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
+	real_server_t *rs = LIST_TAIL_DATA(vs->rs);
 	rs->notify_up = set_value(strvec);
 }
 static void
 notify_down_handler(vector_t *strvec)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
-	real_server *rs = LIST_TAIL_DATA(vs->rs);
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
+	real_server_t *rs = LIST_TAIL_DATA(vs->rs);
 	rs->notify_down = set_value(strvec);
 }
 static void
 alpha_handler(vector_t *strvec)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
 	vs->alpha = 1;
 	vs->quorum_state = DOWN;
 }
 static void
 omega_handler(vector_t *strvec)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
 	vs->omega = 1;
 }
 static void
 quorum_up_handler(vector_t *strvec)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
 	vs->quorum_up = set_value(strvec);
 }
 static void
 quorum_down_handler(vector_t *strvec)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
 	vs->quorum_down = set_value(strvec);
 }
 static void
 quorum_handler(vector_t *strvec)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
 	long tmp = atol (vector_slot(strvec, 1));
 	if (tmp < 1) {
 		log_message(LOG_ERR, "Condition not met: Quorum >= 1");
@@ -256,7 +256,7 @@ quorum_handler(vector_t *strvec)
 static void
 hysteresis_handler(vector_t *strvec)
 {
-	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
+	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
 	long tmp = atol (vector_slot(strvec, 1));
 	if (tmp < 0 || tmp >= vs->quorum) {
 		log_message(LOG_ERR, "Condition not met: 0 <= Hysteresis <= Quorum - 1");
diff -rupN keepalived-1.2.7/keepalived/check/check_snmp.c keepalived-1.2.7-unicast/keepalived/check/check_snmp.c
--- keepalived-1.2.7/keepalived/check/check_snmp.c	2012-08-29 00:05:12.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/check/check_snmp.c	2013-05-24 10:12:36.514161800 +0200
@@ -31,9 +31,9 @@ static u_char*
 check_snmp_vsgroup(struct variable *vp, oid *name, size_t *length,
 		   int exact, size_t *var_len, WriteMethod **write_method)
 {
-	virtual_server_group *g;
+	virtual_server_group_t *g;
 
-	if ((g = (virtual_server_group *)
+	if ((g = (virtual_server_group_t *)
 	     snmp_header_list_table(vp, name, length, exact,
 				    var_len, write_method,
 				    check_data->vs_group)) == NULL)
@@ -60,8 +60,8 @@ check_snmp_vsgroupmember(struct variable
         int result, target_len;
 	int curgroup = 0, curentry;
 	element e1, e2;
-	virtual_server_group *group;
-	virtual_server_group_entry *e, *be = NULL;
+	virtual_server_group_t *group;
+	virtual_server_group_entry_t *e, *be = NULL;
 	int state;
 	list l;
 
@@ -212,10 +212,10 @@ check_snmp_virtualserver(struct variable
 #ifdef _KRNL_2_6_
 	static U64 counter64_ret;
 #endif
-	virtual_server *v;
+	virtual_server_t *v;
 	element e;
 
-	if ((v = (virtual_server *)
+	if ((v = (virtual_server_t *)
 	     snmp_header_list_table(vp, name, length, exact,
 				    var_len, write_method,
 				    check_data->vs)) == NULL)
@@ -366,7 +366,7 @@ check_snmp_virtualserver(struct variable
 		long_ret = 0;
 		if (!LIST_ISEMPTY(v->rs))
 			for (e = LIST_HEAD(v->rs); e; ELEMENT_NEXT(e))
-				if (((real_server *)ELEMENT_DATA(e))->alive)
+				if (((real_server_t *)ELEMENT_DATA(e))->alive)
 					long_ret++;
 		return (u_char*)&long_ret;
 #if defined(_KRNL_2_6_) && defined(_WITH_LVS_)
@@ -430,8 +430,8 @@ check_snmp_realserver_weight(int action,
 			     u_char *statP, oid *name, size_t name_len)
 {
 	element e1, e2;
-	virtual_server *vs = NULL;
-	real_server *rs = NULL;
+	virtual_server_t *vs = NULL;
+	real_server_t *rs = NULL;
 	int ivs, irs;
 	switch (action) {
 	case RESERVE1:
@@ -490,9 +490,9 @@ check_snmp_realserver(struct variable *v
         oid *target, current[2], best[2];
         int result, target_len;
 	int curvirtual = 0, curreal;
-	real_server *e = NULL, *be = NULL;
+	real_server_t *e = NULL, *be = NULL;
 	element e1, e2 = NULL;
-	virtual_server *vs, *bvs = NULL;
+	virtual_server_t *vs, *bvs = NULL;
 	int state;
 	int type, btype;
 
@@ -882,7 +882,7 @@ check_snmp_agent_close()
 }
 
 void
-check_snmp_rs_trap(real_server *rs, virtual_server *vs)
+check_snmp_rs_trap(real_server_t *rs, virtual_server_t *vs)
 {
 	element e;
 
@@ -953,7 +953,7 @@ check_snmp_rs_trap(real_server *rs, virt
 	realup = 0;
 	if (!LIST_ISEMPTY(vs->rs))
 		for (e = LIST_HEAD(vs->rs); e; ELEMENT_NEXT(e))
-			if (((real_server *)ELEMENT_DATA(e))->alive)
+			if (((real_server_t *)ELEMENT_DATA(e))->alive)
 				realup++;
 
 	/* snmpTrapOID */
@@ -1084,7 +1084,7 @@ check_snmp_rs_trap(real_server *rs, virt
 }
 
 void
-check_snmp_quorum_trap(virtual_server *vs)
+check_snmp_quorum_trap(virtual_server_t *vs)
 {
 	check_snmp_rs_trap(NULL, vs);
 }
diff -rupN keepalived-1.2.7/keepalived/check/check_ssl.c keepalived-1.2.7-unicast/keepalived/check/check_ssl.c
--- keepalived-1.2.7/keepalived/check/check_ssl.c	2012-08-29 00:05:12.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/check/check_ssl.c	2013-05-24 10:12:36.516162000 +0200
@@ -192,8 +192,8 @@ ssl_connect(thread_t * thread, int new_r
 {
 	checker_t *checker = THREAD_ARG(thread);
 	http_checker_t *http_get_check = CHECKER_ARG(checker);
-	http_arg_t *http_arg = HTTP_ARG(http_get_check);
-	request_t *req = HTTP_REQ(http_arg);
+	http_t *http = HTTP_ARG(http_get_check);
+	request_t *req = HTTP_REQ(http);
 	int ret = 0;
 	int val = 0;
 
@@ -242,8 +242,8 @@ ssl_read_thread(thread_t * thread)
 {
 	checker_t *checker = THREAD_ARG(thread);
 	http_checker_t *http_get_check = CHECKER_ARG(checker);
-	http_arg_t *http_arg = HTTP_ARG(http_get_check);
-	request_t *req = HTTP_REQ(http_arg);
+	http_t *http = HTTP_ARG(http_get_check);
+	request_t *req = HTTP_REQ(http);
 	unsigned char digest[16];
 	int r = 0;
 	int val;
diff -rupN keepalived-1.2.7/keepalived/check/ipvswrapper.c keepalived-1.2.7-unicast/keepalived/check/ipvswrapper.c
--- keepalived-1.2.7/keepalived/check/ipvswrapper.c	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/check/ipvswrapper.c	2013-05-24 10:12:36.518162100 +0200
@@ -34,11 +34,11 @@ static int string_to_number(const char *
 static int modprobe_ipvs(void);
 
 /* fetch virtual server group from group name */
-virtual_server_group *
+virtual_server_group_t *
 ipvs_get_group_by_name(char *gname, list l)
 {
 	element e;
-	virtual_server_group *vsg;
+	virtual_server_group_t *vsg;
 
 	for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
 		vsg = ELEMENT_DATA(e);
@@ -119,7 +119,7 @@ ipvs_syncd_cmd(int cmd, char *ifname, in
 
 /* IPVS group range rule */
 static int
-ipvs_group_range_cmd(int cmd, virtual_server_group_entry *vsg_entry)
+ipvs_group_range_cmd(int cmd, virtual_server_group_entry_t *vsg_entry)
 {
 	uint32_t addr_ip;
 	int err = 0;
@@ -140,10 +140,10 @@ ipvs_group_range_cmd(int cmd, virtual_se
 
 /* set IPVS group rules */
 static int
-ipvs_group_cmd(int cmd, list vs_group, real_server * rs, char * vsgname)
+ipvs_group_cmd(int cmd, list vs_group, real_server_t * rs, char * vsgname)
 {
-	virtual_server_group *vsg = ipvs_get_group_by_name(vsgname, vs_group);
-	virtual_server_group_entry *vsg_entry;
+	virtual_server_group_t *vsg = ipvs_get_group_by_name(vsgname, vs_group);
+	virtual_server_group_entry_t *vsg_entry;
 	list l;
 	element e;
 	int err = 1;
@@ -198,7 +198,7 @@ ipvs_group_cmd(int cmd, list vs_group, r
 
 /* Fill IPVS rule with root vs infos */
 void
-ipvs_set_rule(int cmd, virtual_server * vs, real_server * rs)
+ipvs_set_rule(int cmd, virtual_server_t * vs, real_server_t * rs)
 {
 	/* Clean up target rule */
 	memset(urule, 0, sizeof (struct ip_vs_rule_user));
@@ -235,7 +235,7 @@ ipvs_set_rule(int cmd, virtual_server *
 
 /* Set/Remove a RS from a VS */
 int
-ipvs_cmd(int cmd, list vs_group, virtual_server * vs, real_server * rs)
+ipvs_cmd(int cmd, list vs_group, virtual_server_t * vs, real_server_t * rs)
 {
 	int err = 0;
 
@@ -276,9 +276,9 @@ ipvs_cmd(int cmd, list vs_group, virtual
 
 /* Remove a specific vs group entry */
 int
-ipvs_group_remove_entry(virtual_server *vs, virtual_server_group_entry *vsge)
+ipvs_group_remove_entry(virtual_server_t *vs, virtual_server_group_entry_t *vsge)
 {
-	real_server *rs;
+	real_server_t *rs;
 	int err = 0;
 	element e;
 	list l = vs->rs;
@@ -421,7 +421,7 @@ ipvs_syncd_cmd(int cmd, char *ifname, in
 
 /* IPVS group range rule */
 static void
-ipvs_group_range_cmd(int cmd, virtual_server_group_entry *vsg_entry)
+ipvs_group_range_cmd(int cmd, virtual_server_group_entry_t *vsg_entry)
 {
 	uint32_t addr_ip, ip;
 
@@ -455,10 +455,10 @@ ipvs_group_range_cmd(int cmd, virtual_se
 
 /* set IPVS group rules */
 static void
-ipvs_group_cmd(int cmd, list vs_group, real_server * rs, virtual_server * vs)
+ipvs_group_cmd(int cmd, list vs_group, real_server_t * rs, virtual_server_t * vs)
 {
-	virtual_server_group *vsg = ipvs_get_group_by_name(vs->vsgname, vs_group);
-	virtual_server_group_entry *vsg_entry;
+	virtual_server_group_t *vsg = ipvs_get_group_by_name(vs->vsgname, vs_group);
+	virtual_server_group_entry_t *vsg_entry;
 	list l;
 	element e;
 
@@ -495,7 +495,7 @@ ipvs_group_cmd(int cmd, list vs_group, r
 		srule->af = AF_INET;
 		/* Need to get address family from first real server */
 		if (vs->rs && !LIST_ISEMPTY(vs->rs) &&
-		    (((real_server *)ELEMENT_DATA(LIST_HEAD(vs->rs)))->addr.ss_family == AF_INET6)) {
+		    (((real_server_t *)ELEMENT_DATA(LIST_HEAD(vs->rs)))->addr.ss_family == AF_INET6)) {
 			srule->af = AF_INET6;
 			srule->netmask = 128;
 		}
@@ -524,7 +524,7 @@ ipvs_group_cmd(int cmd, list vs_group, r
 
 /* Fill IPVS rule with root vs infos */
 void
-ipvs_set_rule(int cmd, virtual_server * vs, real_server * rs)
+ipvs_set_rule(int cmd, virtual_server_t * vs, real_server_t * rs)
 {
 	/* Clean target rule */
 	memset(drule, 0, sizeof(ipvs_dest_t));
@@ -568,7 +568,7 @@ ipvs_set_rule(int cmd, virtual_server *
 
 /* Set/Remove a RS from a VS */
 int
-ipvs_cmd(int cmd, list vs_group, virtual_server * vs, real_server * rs)
+ipvs_cmd(int cmd, list vs_group, virtual_server_t * vs, real_server_t * rs)
 {
 	/* Allocate the room */
 	memset(srule, 0, sizeof(ipvs_service_t));
@@ -596,7 +596,7 @@ ipvs_cmd(int cmd, list vs_group, virtual
 			srule->af = AF_INET;
 			/* Need to get address family from first real server */
 			if (vs->rs && !LIST_ISEMPTY(vs->rs) &&
-			    (((real_server *)ELEMENT_DATA(LIST_HEAD(vs->rs)))->addr.ss_family == AF_INET6)) {
+			    (((real_server_t *)ELEMENT_DATA(LIST_HEAD(vs->rs)))->addr.ss_family == AF_INET6)) {
 				srule->af = AF_INET6;
 				srule->netmask = 128;
 			}
@@ -619,9 +619,9 @@ ipvs_cmd(int cmd, list vs_group, virtual
 
 /* Remove a specific vs group entry */
 int
-ipvs_group_remove_entry(virtual_server *vs, virtual_server_group_entry *vsge)
+ipvs_group_remove_entry(virtual_server_t *vs, virtual_server_group_entry_t *vsge)
 {
-	real_server *rs;
+	real_server_t *rs;
 	element e;
 	list l = vs->rs;
 
@@ -682,12 +682,12 @@ ipvs_group_remove_entry(virtual_server *
    statistics of real servers. The update is only done if we need
    refreshing. */
 void
-ipvs_update_stats(virtual_server *vs)
+ipvs_update_stats(virtual_server_t *vs)
 {
 	element e, ge = NULL;
-	real_server *rs;
-	virtual_server_group *vsg = NULL;
-	virtual_server_group_entry *vsg_entry = NULL;
+	real_server_t *rs;
+	virtual_server_group_t *vsg = NULL;
+	virtual_server_group_entry_t *vsg_entry = NULL;
 	uint32_t addr_ip = 0;
 	union nf_inet_addr nfaddr;
 	ipvs_service_entry_t * serv = NULL;
diff -rupN keepalived-1.2.7/keepalived/check/ipwrapper.c keepalived-1.2.7-unicast/keepalived/check/ipwrapper.c
--- keepalived-1.2.7/keepalived/check/ipwrapper.c	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/check/ipwrapper.c	2013-05-24 10:12:36.520162200 +0200
@@ -33,10 +33,10 @@
 
 /* Returns the sum of all RS weight in a virtual server. */
 long unsigned
-weigh_live_realservers(virtual_server * vs)
+weigh_live_realservers(virtual_server_t * vs)
 {
 	element e;
-	real_server *svr;
+	real_server_t *svr;
 	long unsigned count = 0;
 
 	for (e = LIST_HEAD(vs->rs); e; ELEMENT_NEXT(e)) {
@@ -49,10 +49,10 @@ weigh_live_realservers(virtual_server *
 
 /* Remove a realserver IPVS rule */
 static int
-clear_service_rs(list vs_group, virtual_server * vs, list l)
+clear_service_rs(list vs_group, virtual_server_t * vs, list l)
 {
 	element e;
-	real_server *rs;
+	real_server_t *rs;
 	char rsip[INET6_ADDRSTRLEN];
 
 	for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
@@ -106,7 +106,7 @@ clear_service_rs(list vs_group, virtual_
 
 /* Remove a virtualserver IPVS rule */
 static int
-clear_service_vs(list vs_group, virtual_server * vs)
+clear_service_vs(list vs_group, virtual_server_t * vs)
 {
 	/* Processing real server queue */
 	if (!LIST_ISEMPTY(vs->rs)) {
@@ -132,7 +132,7 @@ clear_services(void)
 {
 	element e;
 	list l = check_data->vs;
-	virtual_server *vs;
+	virtual_server_t *vs;
 
 	for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
 		vs = ELEMENT_DATA(e);
@@ -144,10 +144,10 @@ clear_services(void)
 
 /* Set a realserver IPVS rules */
 static int
-init_service_rs(virtual_server * vs)
+init_service_rs(virtual_server_t * vs)
 {
 	element e;
-	real_server *rs;
+	real_server_t *rs;
 
 	for (e = LIST_HEAD(vs->rs); e; ELEMENT_NEXT(e)) {
 		rs = ELEMENT_DATA(e);
@@ -177,7 +177,7 @@ init_service_rs(virtual_server * vs)
 
 /* Set a virtualserver IPVS rules */
 static int
-init_service_vs(virtual_server * vs)
+init_service_vs(virtual_server_t * vs)
 {
 	/* Init the VS root */
 	if (!ISALIVE(vs) || vs->vsgname) {
@@ -203,7 +203,7 @@ init_services(void)
 {
 	element e;
 	list l = check_data->vs;
-	virtual_server *vs;
+	virtual_server_t *vs;
 
 	for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
 		vs = ELEMENT_DATA(e);
@@ -215,10 +215,10 @@ init_services(void)
 
 /* add or remove _alive_ real servers from a virtual server */
 void
-perform_quorum_state(virtual_server *vs, int add)
+perform_quorum_state(virtual_server_t *vs, int add)
 {
 	element e;
-	real_server *rs;
+	real_server_t *rs;
 
 	if (LIST_ISEMPTY(vs->rs))
 		return;
@@ -240,7 +240,7 @@ perform_quorum_state(virtual_server *vs,
 
 /* set quorum state depending on current weight of real servers */
 void
-update_quorum_state(virtual_server * vs)
+update_quorum_state(virtual_server_t * vs)
 {
 	char rsip[INET6_ADDRSTRLEN];
 
@@ -324,7 +324,7 @@ update_quorum_state(virtual_server * vs)
 
 /* manipulate add/remove rs according to alive state */
 void
-perform_svr_state(int alive, virtual_server * vs, real_server * rs)
+perform_svr_state(int alive, virtual_server_t * vs, real_server_t * rs)
 {
 	char rsip[INET6_ADDRSTRLEN];
 
@@ -399,7 +399,7 @@ perform_svr_state(int alive, virtual_ser
 
 /* Store new weight in real_server struct and then update kernel. */
 void
-update_svr_wgt(int weight, virtual_server * vs, real_server * rs)
+update_svr_wgt(int weight, virtual_server_t * vs, real_server_t * rs)
 {
 	char rsip[INET6_ADDRSTRLEN];
 
@@ -428,7 +428,7 @@ update_svr_wgt(int weight, virtual_serve
 
 /* Test if realserver is marked UP for a specific checker */
 int
-svr_checker_up(checker_id_t cid, real_server *rs)
+svr_checker_up(checker_id_t cid, real_server_t *rs)
 {
 	element e;
 	list l = rs->failed_checkers;
@@ -450,7 +450,7 @@ svr_checker_up(checker_id_t cid, real_se
 
 /* Update checker's state */
 void
-update_svr_checker_state(int alive, checker_id_t cid, virtual_server *vs, real_server *rs)
+update_svr_checker_state(int alive, checker_id_t cid, virtual_server_t *vs, real_server_t *rs)
 {
 	element e;
 	list l = rs->failed_checkers;
@@ -487,10 +487,10 @@ update_svr_checker_state(int alive, chec
 
 /* Check if a vsg entry is in new data */
 static int
-vsge_exist(virtual_server_group_entry *vsg_entry, list l)
+vsge_exist(virtual_server_group_entry_t *vsg_entry, list l)
 {
 	element e;
-	virtual_server_group_entry *vsge;
+	virtual_server_group_entry_t *vsge;
 
 	for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
 		vsge = ELEMENT_DATA(e);
@@ -510,9 +510,9 @@ vsge_exist(virtual_server_group_entry *v
 
 /* Clear the diff vsge of old group */
 static int
-clear_diff_vsge(list old, list new, virtual_server * old_vs)
+clear_diff_vsge(list old, list new, virtual_server_t * old_vs)
 {
-	virtual_server_group_entry *vsge;
+	virtual_server_group_entry_t *vsge;
 	element e;
 
 	for (e = LIST_HEAD(old); e; ELEMENT_NEXT(e)) {
@@ -535,10 +535,10 @@ clear_diff_vsge(list old, list new, virt
 
 /* Clear the diff vsg of the old vs */
 static int
-clear_diff_vsg(virtual_server * old_vs)
+clear_diff_vsg(virtual_server_t * old_vs)
 {
-	virtual_server_group *old;
-	virtual_server_group *new;
+	virtual_server_group_t *old;
+	virtual_server_group_t *new;
 
 	/* Fetch group */
 	old = ipvs_get_group_by_name(old_vs->vsgname, old_check_data->vs_group);
@@ -557,12 +557,12 @@ clear_diff_vsg(virtual_server * old_vs)
 
 /* Check if a vs exist in new data */
 static int
-vs_exist(virtual_server * old_vs)
+vs_exist(virtual_server_t * old_vs)
 {
 	element e;
 	list l = check_data->vs;
-	virtual_server *vs;
-	virtual_server_group *vsg;
+	virtual_server_t *vs;
+	virtual_server_group_t *vsg;
 
 	if (LIST_ISEMPTY(l))
 		return 0;
@@ -594,10 +594,10 @@ vs_exist(virtual_server * old_vs)
 
 /* Check if rs is in new vs data */
 static int
-rs_exist(real_server * old_rs, list l)
+rs_exist(real_server_t * old_rs, list l)
 {
 	element e;
-	real_server *rs;
+	real_server_t *rs;
 
 	if (LIST_ISEMPTY(l))
 		return 0;
@@ -622,11 +622,11 @@ rs_exist(real_server * old_rs, list l)
 
 /* get rs list for a specific vs */
 static list
-get_rs_list(virtual_server * vs)
+get_rs_list(virtual_server_t * vs)
 {
 	element e;
 	list l = check_data->vs;
-	virtual_server *vsvr;
+	virtual_server_t *vsvr;
 
 	if (LIST_ISEMPTY(l))
 		return NULL;
@@ -643,12 +643,12 @@ get_rs_list(virtual_server * vs)
 
 /* Clear the diff rs of the old vs */
 static int
-clear_diff_rs(virtual_server * old_vs)
+clear_diff_rs(virtual_server_t * old_vs)
 {
 	element e;
 	list l = old_vs->rs;
 	list new = get_rs_list(old_vs);
-	real_server *rs;
+	real_server_t *rs;
 	char rsip[INET6_ADDRSTRLEN];
 
 	/* If old vs didn't own rs then nothing return */
@@ -682,7 +682,7 @@ clear_diff_services(void)
 {
 	element e;
 	list l = old_check_data->vs;
-	virtual_server *vs;
+	virtual_server_t *vs;
 
 	/* If old config didn't own vs then nothing return */
 	if (LIST_ISEMPTY(l))
diff -rupN keepalived-1.2.7/keepalived/check/Makefile.in keepalived-1.2.7-unicast/keepalived/check/Makefile.in
--- keepalived-1.2.7/keepalived/check/Makefile.in	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/check/Makefile.in	2013-05-24 10:12:36.501161100 +0200
@@ -4,13 +4,12 @@
 #
 # Copyright (C) 2001-2012 Alexandre Cassen, <acassen@gmail.com>
 
-KERNEL   = @KERN@
 CC	 = @CC@
 SNMP_FLAG = @SNMP_SUPPORT@
 INCLUDES = -I../include -I../../lib
 CFLAGS	 = @CFLAGS@ @CPPFLAGS@ $(INCLUDES) \
 	   -Wall -Wunused -Wstrict-prototypes
-DEFS	 = -D$(KERNEL) -D@IPVS_SUPPORT@ -D@IPVS_SYNCD@ -D@VRRP_SUPPORT@ -D@SNMP_SUPPORT@ @DFLAGS@
+DEFS	 = -D@KERN@ -D@IPVS_SUPPORT@ -D@IPVS_SYNCD@ -D@VRRP_SUPPORT@ -D@SNMP_SUPPORT@ @DFLAGS@
 COMPILE	 = $(CC) $(CFLAGS) $(DEFS)
 
 OBJS = 	check_daemon.o check_data.o check_parser.o \
diff -rupN keepalived-1.2.7/keepalived/core/global_data.c keepalived-1.2.7-unicast/keepalived/core/global_data.c
--- keepalived-1.2.7/keepalived/core/global_data.c	2012-08-17 01:21:28.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/core/global_data.c	2013-05-24 10:12:36.526162500 +0200
@@ -31,11 +31,11 @@
 #include "utils.h"
 
 /* global vars */
-conf_data_t *global_data = NULL;
+data_t *global_data = NULL;
 
 /* Default settings */
 static void
-set_default_router_id(conf_data_t * data)
+set_default_router_id(data_t * data)
 {
 	char *new_id = NULL;
 	int len = 0;
@@ -53,7 +53,7 @@ set_default_router_id(conf_data_t * data
 }
 
 static void
-set_default_email_from(conf_data_t * data)
+set_default_email_from(data_t * data)
 {
 	struct passwd *pwd = NULL;
 	char *hostname = NULL;
@@ -76,13 +76,13 @@ set_default_email_from(conf_data_t * dat
 }
 
 static void
-set_default_smtp_connection_timeout(conf_data_t * data)
+set_default_smtp_connection_timeout(data_t * data)
 {
 	data->smtp_connection_to = DEFAULT_SMTP_CONNECTION_TIMEOUT;
 }
 
 static void
-set_default_values(conf_data_t * data)
+set_default_values(data_t * data)
 {
 	/* No global data so don't default */
 	if (!data)
@@ -94,14 +94,14 @@ set_default_values(conf_data_t * data)
 
 /* email facility functions */
 static void
-free_email(void *data_obj)
+free_email(void *data)
 {
-	FREE(data_obj);
+	FREE(data);
 }
 static void
-dump_email(void *data_obj)
+dump_email(void *data)
 {
-	char *addr = data_obj;
+	char *addr = data;
 	log_message(LOG_INFO, " Email notification = %s", addr);
 }
 
@@ -118,12 +118,12 @@ alloc_email(char *addr)
 }
 
 /* data facility functions */
-conf_data_t *
+data_t *
 alloc_global_data(void)
 {
-	conf_data_t *new;
+	data_t *new;
 
-	new = (conf_data_t *) MALLOC(sizeof (conf_data_t));
+	new = (data_t *) MALLOC(sizeof(data_t));
 	new->email = alloc_list(free_email, dump_email);
 
 	set_default_values(new);
@@ -131,7 +131,7 @@ alloc_global_data(void)
 }
 
 void
-free_global_data(conf_data_t * data)
+free_global_data(data_t * data)
 {
 	free_list(data->email);
 	FREE_PTR(data->router_id);
@@ -141,7 +141,7 @@ free_global_data(conf_data_t * data)
 }
 
 void
-dump_global_data(conf_data_t * data)
+dump_global_data(data_t * data)
 {
 	if (!data)
 		return;
diff -rupN keepalived-1.2.7/keepalived/core/Makefile.in keepalived-1.2.7-unicast/keepalived/core/Makefile.in
--- keepalived-1.2.7/keepalived/core/Makefile.in	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/core/Makefile.in	2013-05-24 10:12:36.522162300 +0200
@@ -31,7 +31,7 @@ distclean: clean
 	rm -f Makefile
 
 
-main.o: main.c ../include/main.h ../include/config.h ../../lib/signals.h
+main.o: main.c ../include/main.h ../../lib/config.h ../../lib/signals.h
 daemon.o: daemon.c ../include/daemon.h ../../lib/utils.h
 pidfile.o: pidfile.c ../include/pidfile.h
 layer4.o: layer4.c ../include/layer4.h ../include/check_api.h ../../lib/utils.h
@@ -43,4 +43,4 @@ global_parser.o: global_parser.c ../incl
   ../include/global_data.h ../../lib/parser.h ../../lib/memory.h \
   ../../lib/utils.h
 snmp.o: snmp.c ../include/snmp.h ../../lib/logger.h ../../lib/list.h \
-  ../include/config.h ../include/global_data.h
+  ../../lib/config.h ../include/global_data.h
diff -rupN keepalived-1.2.7/keepalived/core/smtp.c keepalived-1.2.7-unicast/keepalived/core/smtp.c
--- keepalived-1.2.7/keepalived/core/smtp.c	2012-08-17 01:21:28.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/core/smtp.c	2013-05-24 10:12:36.532162900 +0200
@@ -75,39 +75,39 @@ struct {
 };
 
 static void
-free_smtp_all(smtp_thread_arg * smtp_arg)
+free_smtp_all(smtp_t * smtp)
 {
-	FREE(smtp_arg->buffer);
-	FREE(smtp_arg->subject);
-	FREE(smtp_arg->body);
-	FREE(smtp_arg);
+	FREE(smtp->buffer);
+	FREE(smtp->subject);
+	FREE(smtp->body);
+	FREE(smtp);
 }
 
 static char *
-fetch_next_email(smtp_thread_arg * smtp_arg)
+fetch_next_email(smtp_t * smtp)
 {
-	return list_element(global_data->email, smtp_arg->email_it);
+	return list_element(global_data->email, smtp->email_it);
 }
 
 /* layer4 connection handlers */
 static int
 connection_error(thread_t * thread)
 {
-	smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+	smtp_t *smtp = THREAD_ARG(thread);
 
 	log_message(LOG_INFO, "SMTP connection ERROR to [%s]:%d."
 			    , inet_sockaddrtos(&global_data->smtp_server), SMTP_PORT);
-	free_smtp_all(smtp_arg);
+	free_smtp_all(smtp);
 	return 0;
 }
 static int
 connection_timeout(thread_t * thread)
 {
-	smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+	smtp_t *smtp = THREAD_ARG(thread);
 
 	log_message(LOG_INFO, "Timeout connecting SMTP server [%s]:%d."
 			    , inet_sockaddrtos(&global_data->smtp_server), SMTP_PORT);
-	free_smtp_all(smtp_arg);
+	free_smtp_all(smtp);
 	return 0;
 }
 static int
@@ -132,14 +132,14 @@ connection_in_progress(thread_t * thread
 static int
 connection_success(thread_t * thread)
 {
-	smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+	smtp_t *smtp = THREAD_ARG(thread);
 
 	log_message(LOG_INFO, "Remote SMTP server [%s]:%d connected."
 			    , inet_sockaddrtos(&global_data->smtp_server), SMTP_PORT);
 
-	smtp_arg->stage = connect_success;
-	thread_add_read(thread->master, smtp_read_thread, smtp_arg,
-			smtp_arg->fd, global_data->smtp_connection_to);
+	smtp->stage = connect_success;
+	thread_add_read(thread->master, smtp_read_thread, smtp,
+			smtp->fd, global_data->smtp_connection_to);
 	return 0;
 }
 
@@ -147,13 +147,13 @@ connection_success(thread_t * thread)
 static int
 smtp_read_thread(thread_t * thread)
 {
-	smtp_thread_arg *smtp_arg;
+	smtp_t *smtp;
 	char *buffer;
 	char *reply;
 	int rcv_buffer_size = 0;
 	int status = -1;
 
-	smtp_arg = THREAD_ARG(thread);
+	smtp = THREAD_ARG(thread);
 
 	if (thread->type == THREAD_READ_TIMEOUT) {
 		log_message(LOG_INFO, "Timeout reading data to remote SMTP server [%s]:%d."
@@ -162,10 +162,10 @@ smtp_read_thread(thread_t * thread)
 		return -1;
 	}
 
-	buffer = smtp_arg->buffer;
+	buffer = smtp->buffer;
 
-	rcv_buffer_size = read(thread->u.fd, buffer + smtp_arg->buflen,
-			       SMTP_BUFFER_LENGTH - smtp_arg->buflen);
+	rcv_buffer_size = read(thread->u.fd, buffer + smtp->buflen,
+			       SMTP_BUFFER_LENGTH - smtp->buflen);
 
 	if (rcv_buffer_size == -1) {
 		if (errno == EAGAIN)
@@ -177,33 +177,33 @@ smtp_read_thread(thread_t * thread)
 	}
 
 	/* received data overflow buffer size ? */
-	if (smtp_arg->buflen >= SMTP_BUFFER_MAX) {
+	if (smtp->buflen >= SMTP_BUFFER_MAX) {
 		log_message(LOG_INFO, "Received buffer from remote SMTP server [%s]:%d"
 				      " overflow our get read buffer length."
 				    , inet_sockaddrtos(&global_data->smtp_server), SMTP_PORT);
 		SMTP_FSM_READ(QUIT, thread, 0);
 		return 0;
 	} else {
-		smtp_arg->buflen += rcv_buffer_size;
-		buffer[smtp_arg->buflen] = 0;	/* NULL terminate */
+		smtp->buflen += rcv_buffer_size;
+		buffer[smtp->buflen] = 0;	/* NULL terminate */
 	}
 
       end:
 
 	/* parse the buffer, finding the last line of the response for the code */
 	reply = buffer;
-	while (reply < buffer + smtp_arg->buflen) {
+	while (reply < buffer + smtp->buflen) {
 		char *p;
 
 		p = strstr(reply, "\r\n");
 		if (!p) {
 			memmove(buffer, reply,
-				smtp_arg->buflen - (reply - buffer));
-			smtp_arg->buflen -= (reply - buffer);
-			buffer[smtp_arg->buflen] = 0;
+				smtp->buflen - (reply - buffer));
+			smtp->buflen -= (reply - buffer);
+			buffer[smtp->buflen] = 0;
 
 			thread_add_read(thread->master, smtp_read_thread,
-					smtp_arg, thread->u.fd,
+					smtp, thread->u.fd,
 					global_data->smtp_connection_to);
 			return 0;
 		}
@@ -220,22 +220,22 @@ smtp_read_thread(thread_t * thread)
 		break;
 	}
 
-	memmove(buffer, reply, smtp_arg->buflen - (reply - buffer));
-	smtp_arg->buflen -= (reply - buffer);
-	buffer[smtp_arg->buflen] = 0;
+	memmove(buffer, reply, smtp->buflen - (reply - buffer));
+	smtp->buflen -= (reply - buffer);
+	buffer[smtp->buflen] = 0;
 
 	if (status == -1) {
-		thread_add_read(thread->master, smtp_read_thread, smtp_arg,
+		thread_add_read(thread->master, smtp_read_thread, smtp,
 				thread->u.fd, global_data->smtp_connection_to);
 		return 0;
 	}
 
-	SMTP_FSM_READ(smtp_arg->stage, thread, status);
+	SMTP_FSM_READ(smtp->stage, thread, status);
 
 	/* Registering next smtp command processing thread */
-	if (smtp_arg->stage != ERROR) {
-		thread_add_write(thread->master, smtp_send_thread, smtp_arg,
-				 smtp_arg->fd, global_data->smtp_connection_to);
+	if (smtp->stage != ERROR) {
+		thread_add_write(thread->master, smtp_send_thread, smtp,
+				 smtp->fd, global_data->smtp_connection_to);
 	} else {
 		log_message(LOG_INFO, "Can not read data from remote SMTP server [%s]:%d."
 				    , inet_sockaddrtos(&global_data->smtp_server), SMTP_PORT);
@@ -248,7 +248,7 @@ smtp_read_thread(thread_t * thread)
 static int
 smtp_send_thread(thread_t * thread)
 {
-	smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+	smtp_t *smtp = THREAD_ARG(thread);
 
 	if (thread->type == THREAD_WRITE_TIMEOUT) {
 		log_message(LOG_INFO, "Timeout sending data to remote SMTP server [%s]:%d."
@@ -257,22 +257,22 @@ smtp_send_thread(thread_t * thread)
 		return 0;
 	}
 
-	SMTP_FSM_SEND(smtp_arg->stage, thread);
+	SMTP_FSM_SEND(smtp->stage, thread);
 
 	/* Handle END command */
-	if (smtp_arg->stage == END) {
+	if (smtp->stage == END) {
 		SMTP_FSM_READ(QUIT, thread, 0);
 		return 0;
 	}
 
 	/* Registering next smtp command processing thread */
-	if (smtp_arg->stage != ERROR) {
-		thread_add_read(thread->master, smtp_read_thread, smtp_arg,
+	if (smtp->stage != ERROR) {
+		thread_add_read(thread->master, smtp_read_thread, smtp,
 				thread->u.fd, global_data->smtp_connection_to);
 	} else {
-		log_message(LOG_INFO,
-		       "Can not send data to remote SMTP server [%s]:%d.",
-		       inet_sockaddrtos(&global_data->smtp_server), SMTP_PORT);
+		log_message(LOG_INFO, "Can not send data to remote SMTP server [%s]:%d."
+				    , inet_sockaddrtos(&global_data->smtp_server)
+				    , SMTP_PORT);
 		SMTP_FSM_READ(QUIT, thread, 0);
 	}
 
@@ -282,15 +282,16 @@ smtp_send_thread(thread_t * thread)
 static int
 connection_code(thread_t * thread, int status)
 {
-	smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+	smtp_t *smtp = THREAD_ARG(thread);
 
 	if (status == 220) {
-		smtp_arg->stage++;
+		smtp->stage++;
 	} else {
 		log_message(LOG_INFO, "Error connecting SMTP server[%s]:%d."
-		       " SMTP status code = %d", inet_sockaddrtos(&global_data->smtp_server),
-		       SMTP_PORT, status);
-		smtp_arg->stage = ERROR;
+				      " SMTP status code = %d"
+				    , inet_sockaddrtos(&global_data->smtp_server)
+				    , SMTP_PORT, status);
+		smtp->stage = ERROR;
 	}
 
 	return 0;
@@ -300,13 +301,13 @@ connection_code(thread_t * thread, int s
 static int
 helo_cmd(thread_t * thread)
 {
-	smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+	smtp_t *smtp = THREAD_ARG(thread);
 	char *buffer;
 
 	buffer = (char *) MALLOC(SMTP_BUFFER_MAX);
 	snprintf(buffer, SMTP_BUFFER_MAX, SMTP_HELO_CMD, get_local_name());
 	if (send(thread->u.fd, buffer, strlen(buffer), 0) == -1)
-		smtp_arg->stage = ERROR;
+		smtp->stage = ERROR;
 	FREE(buffer);
 
 	return 0;
@@ -314,16 +315,16 @@ helo_cmd(thread_t * thread)
 static int
 helo_code(thread_t * thread, int status)
 {
-	smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+	smtp_t *smtp = THREAD_ARG(thread);
 
 	if (status == 250) {
-		smtp_arg->stage++;
+		smtp->stage++;
 	} else {
-		log_message(LOG_INFO,
-		       "Error processing HELO cmd on SMTP server [%s]:%d."
-		       " SMTP status code = %d", inet_sockaddrtos(&global_data->smtp_server),
-		       SMTP_PORT, status);
-		smtp_arg->stage = ERROR;
+		log_message(LOG_INFO, "Error processing HELO cmd on SMTP server [%s]:%d."
+				      " SMTP status code = %d"
+				    , inet_sockaddrtos(&global_data->smtp_server)
+				    , SMTP_PORT, status);
+		smtp->stage = ERROR;
 	}
 
 	return 0;
@@ -333,13 +334,13 @@ helo_code(thread_t * thread, int status)
 static int
 mail_cmd(thread_t * thread)
 {
-	smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+	smtp_t *smtp = THREAD_ARG(thread);
 	char *buffer;
 
 	buffer = (char *) MALLOC(SMTP_BUFFER_MAX);
 	snprintf(buffer, SMTP_BUFFER_MAX, SMTP_MAIL_CMD, global_data->email_from);
 	if (send(thread->u.fd, buffer, strlen(buffer), 0) == -1)
-		smtp_arg->stage = ERROR;
+		smtp->stage = ERROR;
 	FREE(buffer);
 
 	return 0;
@@ -347,16 +348,16 @@ mail_cmd(thread_t * thread)
 static int
 mail_code(thread_t * thread, int status)
 {
-	smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+	smtp_t *smtp = THREAD_ARG(thread);
 
 	if (status == 250) {
-		smtp_arg->stage++;
+		smtp->stage++;
 	} else {
-		log_message(LOG_INFO,
-		       "Error processing MAIL cmd on SMTP server [%s]:%d."
-		       " SMTP status code = %d", inet_sockaddrtos(&global_data->smtp_server),
-		       SMTP_PORT, status);
-		smtp_arg->stage = ERROR;
+		log_message(LOG_INFO, "Error processing MAIL cmd on SMTP server [%s]:%d."
+				      " SMTP status code = %d"
+				    , inet_sockaddrtos(&global_data->smtp_server)
+				    , SMTP_PORT, status);
+		smtp->stage = ERROR;
 	}
 
 	return 0;
@@ -366,7 +367,7 @@ mail_code(thread_t * thread, int status)
 static int
 rcpt_cmd(thread_t * thread)
 {
-	smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+	smtp_t *smtp = THREAD_ARG(thread);
 	char *buffer;
 	char *fetched_email;
 
@@ -374,11 +375,11 @@ rcpt_cmd(thread_t * thread)
 	/* We send RCPT TO command multiple time to add all our email receivers.
 	 * --rfc821.3.1
 	 */
-	fetched_email = fetch_next_email(smtp_arg);
+	fetched_email = fetch_next_email(smtp);
 
 	snprintf(buffer, SMTP_BUFFER_MAX, SMTP_RCPT_CMD, fetched_email);
 	if (send(thread->u.fd, buffer, strlen(buffer), 0) == -1)
-		smtp_arg->stage = ERROR;
+		smtp->stage = ERROR;
 	FREE(buffer);
 
 	return 0;
@@ -386,22 +387,22 @@ rcpt_cmd(thread_t * thread)
 static int
 rcpt_code(thread_t * thread, int status)
 {
-	smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+	smtp_t *smtp = THREAD_ARG(thread);
 	char *fetched_email;
 
 	if (status == 250) {
-		smtp_arg->email_it++;
+		smtp->email_it++;
 
-		fetched_email = fetch_next_email(smtp_arg);
+		fetched_email = fetch_next_email(smtp);
 
 		if (!fetched_email)
-			smtp_arg->stage++;
+			smtp->stage++;
 	} else {
-		log_message(LOG_INFO,
-		       "Error processing RCPT cmd on SMTP server [%s]:%d."
-		       " SMTP status code = %d", inet_sockaddrtos(&global_data->smtp_server),
-		       SMTP_PORT, status);
-		smtp_arg->stage = ERROR;
+		log_message(LOG_INFO, "Error processing RCPT cmd on SMTP server [%s]:%d."
+				      " SMTP status code = %d"
+				    , inet_sockaddrtos(&global_data->smtp_server)
+				    , SMTP_PORT, status);
+		smtp->stage = ERROR;
 	}
 
 	return 0;
@@ -411,25 +412,25 @@ rcpt_code(thread_t * thread, int status)
 static int
 data_cmd(thread_t * thread)
 {
-	smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+	smtp_t *smtp = THREAD_ARG(thread);
 
 	if (send(thread->u.fd, SMTP_DATA_CMD, strlen(SMTP_DATA_CMD), 0) == -1)
-		smtp_arg->stage = ERROR;
+		smtp->stage = ERROR;
 	return 0;
 }
 static int
 data_code(thread_t * thread, int status)
 {
-	smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+	smtp_t *smtp = THREAD_ARG(thread);
 
 	if (status == 354) {
-		smtp_arg->stage++;
+		smtp->stage++;
 	} else {
-		log_message(LOG_INFO,
-		       "Error processing DATA cmd on SMTP server [%s]:%d."
-		       " SMTP status code = %d", inet_sockaddrtos(&global_data->smtp_server),
-		       SMTP_PORT, status);
-		smtp_arg->stage = ERROR;
+		log_message(LOG_INFO, "Error processing DATA cmd on SMTP server [%s]:%d."
+				      " SMTP status code = %d"
+				    , inet_sockaddrtos(&global_data->smtp_server)
+				    , SMTP_PORT, status);
+		smtp->stage = ERROR;
 	}
 
 	return 0;
@@ -442,7 +443,7 @@ data_code(thread_t * thread, int status)
 static int
 body_cmd(thread_t * thread)
 {
-	smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+	smtp_t *smtp = THREAD_ARG(thread);
 	char *buffer;
 	char rfc822[80];
 	time_t tm;
@@ -453,23 +454,22 @@ body_cmd(thread_t * thread)
 	strftime(rfc822, sizeof(rfc822), "%a, %d %b %Y %H:%M:%S %z", gmtime(&tm));
 
 	snprintf(buffer, SMTP_BUFFER_MAX, SMTP_HEADERS_CMD,
-		 rfc822, global_data->email_from, smtp_arg->subject);
+		 rfc822, global_data->email_from, smtp->subject);
 
 	/* send the subject field */
 	if (send(thread->u.fd, buffer, strlen(buffer), 0) == -1)
-		smtp_arg->stage = ERROR;
+		smtp->stage = ERROR;
 
 	memset(buffer, 0, SMTP_BUFFER_MAX);
-	snprintf(buffer, SMTP_BUFFER_MAX, SMTP_BODY_CMD, smtp_arg->body);
+	snprintf(buffer, SMTP_BUFFER_MAX, SMTP_BODY_CMD, smtp->body);
 
 	/* send the the body field */
 	if (send(thread->u.fd, buffer, strlen(buffer), 0) == -1)
-		smtp_arg->stage = ERROR;
+		smtp->stage = ERROR;
 
 	/* send the sending dot */
-	if (send(thread->u.fd, SMTP_SEND_CMD, strlen(SMTP_SEND_CMD), 0)
-	    == -1)
-		smtp_arg->stage = ERROR;
+	if (send(thread->u.fd, SMTP_SEND_CMD, strlen(SMTP_SEND_CMD), 0) == -1)
+		smtp->stage = ERROR;
 
 	FREE(buffer);
 	return 0;
@@ -477,17 +477,17 @@ body_cmd(thread_t * thread)
 static int
 body_code(thread_t * thread, int status)
 {
-	smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+	smtp_t *smtp = THREAD_ARG(thread);
 
 	if (status == 250) {
 		log_message(LOG_INFO, "SMTP alert successfully sent.");
-		smtp_arg->stage++;
+		smtp->stage++;
 	} else {
-		log_message(LOG_INFO,
-		       "Error processing DOT cmd on SMTP server [%s]:%d."
-		       " SMTP status code = %d", inet_sockaddrtos(&global_data->smtp_server),
-		       SMTP_PORT, status);
-		smtp_arg->stage = ERROR;
+		log_message(LOG_INFO, "Error processing DOT cmd on SMTP server [%s]:%d."
+				      " SMTP status code = %d"
+				    , inet_sockaddrtos(&global_data->smtp_server)
+				    , SMTP_PORT, status);
+		smtp->stage = ERROR;
 	}
 
 	return 0;
@@ -497,81 +497,84 @@ body_code(thread_t * thread, int status)
 static int
 quit_cmd(thread_t * thread)
 {
-	smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+	smtp_t *smtp = THREAD_ARG(thread);
 
 	if (send(thread->u.fd, SMTP_QUIT_CMD, strlen(SMTP_QUIT_CMD), 0) == -1)
-		smtp_arg->stage = ERROR;
+		smtp->stage = ERROR;
 	else
-		smtp_arg->stage++;
+		smtp->stage++;
 	return 0;
 }
 static int
 quit_code(thread_t * thread, int status)
 {
-	smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+	smtp_t *smtp = THREAD_ARG(thread);
 
 	/* final state, we are disconnected from the remote host */
-	free_smtp_all(smtp_arg);
+	free_smtp_all(smtp);
 	close(thread->u.fd);
 	return 0;
 }
 
 /* connect remote SMTP server */
 static void
-smtp_connect(smtp_thread_arg * smtp_arg)
+smtp_connect(smtp_t * smtp)
 {
 	enum connect_result status;
 
-	if ((smtp_arg->fd = socket(global_data->smtp_server.ss_family, SOCK_STREAM, IPPROTO_TCP)) == -1) {
+	if ((smtp->fd = socket(global_data->smtp_server.ss_family, SOCK_STREAM, IPPROTO_TCP)) == -1) {
 		DBG("SMTP connect fail to create socket.");
-		free_smtp_all(smtp_arg);
+		free_smtp_all(smtp);
 		return;
 	}
 
-	status = tcp_connect(smtp_arg->fd, &global_data->smtp_server);
+	status = tcp_connect(smtp->fd, &global_data->smtp_server);
 
 	/* Handle connection status code */
-	thread_add_event(master, SMTP_FSM[status].send, smtp_arg, smtp_arg->fd);
+	thread_add_event(master, SMTP_FSM[status].send, smtp, smtp->fd);
 }
 
 /* Main entry point */
 void
-smtp_alert(real_server * rs, vrrp_rt * vrrp,
-	   vrrp_sgroup * vgroup, const char *subject, const char *body)
+smtp_alert(real_server_t * rs, vrrp_t * vrrp,
+	   vrrp_sgroup_t * vgroup, const char *subject, const char *body)
 {
-	smtp_thread_arg *smtp_arg;
+	smtp_t *smtp;
 
 	/* Only send mail if email specified */
 	if (!LIST_ISEMPTY(global_data->email) && global_data->smtp_server.ss_family != 0) {
 		/* allocate & initialize smtp argument data structure */
-		smtp_arg = (smtp_thread_arg *) MALLOC(sizeof (smtp_thread_arg));
-		smtp_arg->subject = (char *) MALLOC(MAX_HEADERS_LENGTH);
-		smtp_arg->body = (char *) MALLOC(MAX_BODY_LENGTH);
-		smtp_arg->buffer = (char *) MALLOC(SMTP_BUFFER_MAX);
+		smtp = (smtp_t *) MALLOC(sizeof(smtp_t));
+		smtp->subject = (char *) MALLOC(MAX_HEADERS_LENGTH);
+		smtp->body = (char *) MALLOC(MAX_BODY_LENGTH);
+		smtp->buffer = (char *) MALLOC(SMTP_BUFFER_MAX);
 
 		/* format subject if rserver is specified */
 		if (rs) {
-			snprintf(smtp_arg->subject, MAX_HEADERS_LENGTH, "[%s] Realserver [%s]:%d - %s"
-				 , global_data->router_id, inet_sockaddrtos(&rs->addr)
-				 , ntohs(inet_sockaddrport(&rs->addr))
-				 , subject);
+			snprintf(smtp->subject, MAX_HEADERS_LENGTH, "[%s] Realserver [%s]:%d - %s"
+					      , global_data->router_id
+					      , inet_sockaddrtos(&rs->addr)
+					      , ntohs(inet_sockaddrport(&rs->addr))
+					      , subject);
 		} else if (vrrp)
-			snprintf(smtp_arg->subject, MAX_HEADERS_LENGTH,
-				 "[%s] VRRP Instance %s - %s",
-				 global_data->router_id, vrrp->iname, subject);
+			snprintf(smtp->subject, MAX_HEADERS_LENGTH, "[%s] VRRP Instance %s - %s"
+					      , global_data->router_id
+					      , vrrp->iname
+					      , subject);
 		else if (vgroup)
-			snprintf(smtp_arg->subject, MAX_HEADERS_LENGTH,
-				 "[%s] VRRP Group %s - %s",
-				 global_data->router_id, vgroup->gname, subject);
+			snprintf(smtp->subject, MAX_HEADERS_LENGTH, "[%s] VRRP Group %s - %s"
+					      , global_data->router_id
+					      , vgroup->gname
+					      , subject);
 		else if (global_data->router_id)
-			snprintf(smtp_arg->subject, MAX_HEADERS_LENGTH,
-				 "[%s] %s", global_data->router_id, subject);
+			snprintf(smtp->subject, MAX_HEADERS_LENGTH, "[%s] %s"
+					      , global_data->router_id
+					      , subject);
 		else
-			snprintf(smtp_arg->subject, MAX_HEADERS_LENGTH, "%s",
-				 subject);
+			snprintf(smtp->subject, MAX_HEADERS_LENGTH, "%s", subject);
 
-		strncpy(smtp_arg->body, body, MAX_BODY_LENGTH);
+		strncpy(smtp->body, body, MAX_BODY_LENGTH);
 
-		smtp_connect(smtp_arg);
+		smtp_connect(smtp);
 	}
 }
diff -rupN keepalived-1.2.7/keepalived/core/snmp.c keepalived-1.2.7-unicast/keepalived/core/snmp.c
--- keepalived-1.2.7/keepalived/core/snmp.c	2012-08-17 01:21:28.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/core/snmp.c	2013-05-24 10:12:36.534163000 +0200
@@ -218,10 +218,6 @@ snmp_agent_init(oid *myoid, int len, cha
 	    NETSNMP_DS_LIB_DONT_PERSIST_STATE, TRUE);
 	/* Do not load any MIB */
 	setenv("MIBS", "", 1);
-	/* Ping AgentX less often than every 15 seconds: pinging can
-	   block keepalived. We check every 2 minutes. */
-	netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
-			   NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL, 120);
 	/* We also register a callback to modify default timeout and
 	   retries value. */
 	snmp_register_callback(SNMP_CALLBACK_LIBRARY,
@@ -229,6 +225,10 @@ snmp_agent_init(oid *myoid, int len, cha
 			       snmp_setup_session_cb, NULL);
 
 	init_agent(name);
+	/* Ping AgentX less often than every 15 seconds: pinging can
+	   block keepalived. We check every 2 minutes. */
+	netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
+			   NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL, 120);
 	if (register_mib(name, (struct variable *) variables, varsize,
 			 varlen, myoid, len) != MIB_REGISTERED_OK)
 		log_message(LOG_WARNING, "Unable to register MIB");
diff -rupN keepalived-1.2.7/keepalived/include/check_api.h keepalived-1.2.7-unicast/keepalived/include/check_api.h
--- keepalived-1.2.7/keepalived/include/check_api.h	2012-08-29 00:05:12.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/check_api.h	2013-05-24 10:12:36.540163300 +0200
@@ -29,15 +29,15 @@
 
 /* Checkers structure definition */
 typedef struct _checker {
-	void (*free_func) (void *);
-	void (*dump_func) (void *);
-	int (*launch) (struct _thread *);
-	int (*plugin_launch) (void *);
-	virtual_server *vs;	/* pointer to the checker thread virtualserver */
-	real_server *rs;	/* pointer to the checker thread realserver */
-	void *data;
-	checker_id_t id;	/* Checker identifier */
-	int enabled;		/* Activation flag */
+	void				(*free_func) (void *);
+	void				(*dump_func) (void *);
+	int				(*launch) (struct _thread *);
+	int				(*plugin_launch) (void *);
+	virtual_server_t		*vs;	/* pointer to the checker thread virtualserver */
+	real_server_t			*rs;	/* pointer to the checker thread realserver */
+	void				*data;
+	checker_id_t			id;	/* Checker identifier */
+	int				enabled;/* Activation flag */
 } checker_t;
 
 /* Checkers queue */
diff -rupN keepalived-1.2.7/keepalived/include/check_data.h keepalived-1.2.7-unicast/keepalived/include/check_data.h
--- keepalived-1.2.7/keepalived/include/check_data.h	2012-08-29 00:05:12.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/check_data.h	2013-05-24 10:12:36.544163600 +0200
@@ -55,96 +55,96 @@ typedef unsigned int checker_id_t;
 #define KEEPALIVED_DEFAULT_DELAY	(60 * TIMER_HZ) 
 
 /* SSL specific data */
-typedef struct ssl_data {
-	int enable;
-	int strong_check;
-	SSL_CTX *ctx;
-	SSL_METHOD *meth;
-	char *password;
-	char *cafile;
-	char *certfile;
-	char *keyfile;
+typedef struct _ssl_data {
+	int				enable;
+	int				strong_check;
+	SSL_CTX				*ctx;
+	SSL_METHOD			*meth;
+	char				*password;
+	char				*cafile;
+	char				*certfile;
+	char				*keyfile;
 } ssl_data_t;
 
 /* Real Server definition */
 typedef struct _real_server {
-	struct sockaddr_storage	addr;
-	int weight;
-	int iweight;		/* Initial weight */
+	struct sockaddr_storage		addr;
+	int				weight;
+	int				iweight;	/* Initial weight */
 #ifdef _KRNL_2_6_
-	uint32_t u_threshold;   /* Upper connection limit. */
-	uint32_t l_threshold;   /* Lower connection limit. */
+	uint32_t			u_threshold;   /* Upper connection limit. */
+	uint32_t			l_threshold;   /* Lower connection limit. */
 #endif
-	int inhibit;		/* Set weight to 0 instead of removing
-				 * the service from IPVS topology.
-				 */
-	char *notify_up;	/* Script to launch when RS is added to LVS */
-	char *notify_down;	/* Script to launch when RS is removed from LVS */
-	int alive;
-	list failed_checkers;	/* List of failed checkers */
-	int set;		/* in the IPVS table */
+	int				inhibit;	/* Set weight to 0 instead of removing
+							 * the service from IPVS topology.
+							 */
+	char				*notify_up;	/* Script to launch when RS is added to LVS */
+	char				*notify_down;	/* Script to launch when RS is removed from LVS */
+	int				alive;
+	list				failed_checkers;/* List of failed checkers */
+	int				set;		/* in the IPVS table */
 #if defined(_WITH_SNMP_) && defined(_KRNL_2_6_) && defined(_WITH_LVS_)
 	/* Statistics */
-	uint32_t activeconns;  /* active connections */
-	uint32_t inactconns;   /* inactive connections */
-	uint32_t persistconns; /* persistent connections */
-	struct ip_vs_stats_user stats;
+	uint32_t			activeconns;	/* active connections */
+	uint32_t			inactconns;	/* inactive connections */
+	uint32_t			persistconns;	/* persistent connections */
+	struct ip_vs_stats_user		stats;
 #endif
-} real_server;
+} real_server_t;
 
 /* Virtual Server group definition */
 typedef struct _virtual_server_group_entry {
-	struct sockaddr_storage	addr;
-	uint8_t range;
-	uint32_t vfwmark;
-	int alive;
-} virtual_server_group_entry;
+	struct sockaddr_storage		addr;
+	uint8_t				range;
+	uint32_t			vfwmark;
+	int				alive;
+} virtual_server_group_entry_t;
 
 typedef struct _virtual_server_group {
-	char *gname;
-	list addr_ip;
-	list range;
-	list vfwmark;
-} virtual_server_group;
+	char				*gname;
+	list				addr_ip;
+	list				range;
+	list				vfwmark;
+} virtual_server_group_t;
 
 /* Virtual Server definition */
 typedef struct _virtual_server {
-	char *vsgname;
-	struct sockaddr_storage	addr;
-	real_server *s_svr;
-	uint32_t vfwmark;
-	uint16_t service_type;
-	long delay_loop;
-	int ha_suspend;
-	char sched[SCHED_MAX_LENGTH];
-	char timeout_persistence[MAX_TIMEOUT_LENGTH];
-	unsigned loadbalancing_kind;
-	uint32_t nat_mask;
-	uint32_t granularity_persistence;
-	char *virtualhost;
-	list rs;
-	int alive;
-	unsigned alpha;			/* Alpha mode enabled. */
-	unsigned omega;			/* Omega mode enabled. */
-	char *quorum_up;		/* A hook to call when the VS gains quorum. */
-	char * quorum_down;		/* A hook to call when the VS loses quorum. */
-	long unsigned quorum;		/* Minimum live RSs to consider VS up. */
+	char				*vsgname;
+	struct sockaddr_storage		addr;
+	real_server_t			*s_svr;
+	uint32_t			vfwmark;
+	uint16_t			service_type;
+	long				delay_loop;
+	int				ha_suspend;
+	char				sched[SCHED_MAX_LENGTH];
+	char				timeout_persistence[MAX_TIMEOUT_LENGTH];
+	unsigned			loadbalancing_kind;
+	uint32_t			nat_mask;
+	uint32_t			granularity_persistence;
+	char				*virtualhost;
+	list				rs;
+	int				alive;
+	unsigned			alpha;		/* Alpha mode enabled. */
+	unsigned			omega;		/* Omega mode enabled. */
+	char				*quorum_up;	/* A hook to call when the VS gains quorum. */
+	char				*quorum_down;	/* A hook to call when the VS loses quorum. */
+	long unsigned			quorum;		/* Minimum live RSs to consider VS up. */
 
-	long unsigned hysteresis;	/* up/down events "lag" WRT quorum. */
-	unsigned quorum_state;		/* Reflects result of the last transition done. */
+	long unsigned			hysteresis;	/* up/down events "lag" WRT quorum. */
+	unsigned			quorum_state;	/* Reflects result of the last transition done. */
 #if defined(_WITH_SNMP_) && defined(_KRNL_2_6_) && defined(_WITH_LVS_)
 	/* Statistics */
-	time_t lastupdated;
-	struct ip_vs_stats_user stats;
+	time_t				lastupdated;
+	struct ip_vs_stats_user		stats;
 #endif
-} virtual_server;
+} virtual_server_t;
 
 /* Configuration data root */
-typedef struct _check_conf_data {
-	ssl_data_t *ssl;
-	list vs_group;
-	list vs;
-} check_conf_data;
+typedef struct _check_data {
+	ssl_data_t			*ssl;
+	list				vs_group;
+	list				vs;
+} check_data_t;
 
 /* inline stuff */
 static inline int __ip6_addr_equal(const struct in6_addr *a1,
@@ -228,8 +228,8 @@ static inline int inaddr_equal(sa_family
 			 (X)->iweight   == (Y)->iweight)
 
 /* Global vars exported */
-extern check_conf_data *check_data;
-extern check_conf_data *old_check_data;
+extern check_data_t *check_data;
+extern check_data_t *old_check_data;
 
 /* prototypes */
 extern ssl_data_t *alloc_ssl(void);
@@ -242,8 +242,8 @@ extern void alloc_ssvr(char *, char *);
 extern void alloc_group(char *);
 extern void alloc_rsgroup(char *, char *);
 extern void set_rsgroup(char *);
-extern check_conf_data *alloc_check_data(void);
-extern void free_check_data(check_conf_data *);
-extern void dump_check_data(check_conf_data *);
+extern check_data_t *alloc_check_data(void);
+extern void free_check_data(check_data_t *);
+extern void dump_check_data(check_data_t *);
 
 #endif
diff -rupN keepalived-1.2.7/keepalived/include/check_http.h keepalived-1.2.7-unicast/keepalived/include/check_http.h
--- keepalived-1.2.7/keepalived/include/check_http.h	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/check_http.h	2013-05-24 10:12:36.546163700 +0200
@@ -39,38 +39,38 @@
 /* Checker argument structure  */
 /* ssl specific thread arguments defs */
 typedef struct _request {
-	char *buffer;
-	char *extracted;
-	int error;
-	int status_code;
-	int len;
-	SSL *ssl;
-	BIO *bio;
-	MD5_CTX context;
+	char				*buffer;
+	char				*extracted;
+	int				error;
+	int				status_code;
+	int				len;
+	SSL				*ssl;
+	BIO				*bio;
+	MD5_CTX				context;
 } request_t;
 
 /* http specific thread arguments defs */
-typedef struct _http_arg {
-	int retry_it;		/* current number of get retry */
-	int url_it;		/* current url checked index */
-	request_t *req;		/* GET buffer and SSL args */
-} http_arg_t ;
+typedef struct _http {
+	int				retry_it;	/* current number of get retry */
+	int				url_it;		/* current url checked index */
+	request_t			*req;		/* GET buffer and SSL args */
+} http_t ;
 
 typedef struct _url {
-	char *path;
-	char *digest;
-	int status_code;
+	char				*path;
+	char				*digest;
+	int				status_code;
 } url_t;
 
 typedef struct _http_checker {
-	int proto;
-	struct sockaddr_storage dst;
-	struct sockaddr_storage bindto;
-	long connection_to;
-	int nb_get_retry;
-	long delay_before_retry;
-	list url;
-	http_arg_t *arg;
+	int				proto;
+	struct sockaddr_storage		dst;
+	struct sockaddr_storage		bindto;
+	long				connection_to;
+	int				nb_get_retry;
+	long				delay_before_retry;
+	list				url;
+	http_t				*arg;
 } http_checker_t;
 
 /* global defs */
diff -rupN keepalived-1.2.7/keepalived/include/check_misc.h keepalived-1.2.7-unicast/keepalived/include/check_misc.h
--- keepalived-1.2.7/keepalived/include/check_misc.h	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/check_misc.h	2013-05-24 10:12:36.547163700 +0200
@@ -32,9 +32,9 @@
 
 /* Checker argument structure  */
 typedef struct _misc_checker {
-	char *path;
-	long timeout;
-	int dynamic;  /* 0: old-style, 1: exit code from checker affects weight */
+	char			*path;
+	long			timeout;
+	int			dynamic;  /* 0: old-style, 1: exit code from checker affects weight */
 } misc_checker_t;
 
 /* Prototypes defs */
diff -rupN keepalived-1.2.7/keepalived/include/check_smtp.h keepalived-1.2.7-unicast/keepalived/include/check_smtp.h
--- keepalived-1.2.7/keepalived/include/check_smtp.h	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/check_smtp.h	2013-05-24 10:12:36.549163800 +0200
@@ -46,30 +46,30 @@
 
 /* Per host configuration structure  */
 typedef struct _smtp_host {
-	struct sockaddr_storage dst;
-	struct sockaddr_storage bindto;
+	struct sockaddr_storage		dst;
+	struct sockaddr_storage		bindto;
 } smtp_host_t;
 
 /* Checker argument structure  */
 typedef struct _smtp_checker {
 	/* non per host config data goes here */
-	char *helo_name;
-	long timeout;
-	long db_retry;
-	int retry;
-	int attempts;
-	int  host_ctr;
-	smtp_host_t *host_ptr;
+	char				*helo_name;
+	long				timeout;
+	long				db_retry;
+	int				retry;
+	int				attempts;
+	int				host_ctr;
+	smtp_host_t			*host_ptr;
 
 	/* data buffer */
-	char buff[SMTP_BUFF_MAX];
-	int buff_ctr;
-	int (*buff_cb) (thread_t *);
+	char				buff[SMTP_BUFF_MAX];
+	int				buff_ctr;
+	int				(*buff_cb) (thread_t *);
 
-	int state;
+	int				state;
 
 	/* list holding the host config data */
-	list host;
+	list				host;
 } smtp_checker_t;
 
 /* Prototypes defs */
diff -rupN keepalived-1.2.7/keepalived/include/check_snmp.h keepalived-1.2.7-unicast/keepalived/include/check_snmp.h
--- keepalived-1.2.7/keepalived/include/check_snmp.h	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/check_snmp.h	2013-05-24 10:12:36.551164000 +0200
@@ -126,7 +126,7 @@ do {									\
 /* Prototypes */
 extern void check_snmp_agent_init(void);
 extern void check_snmp_agent_close(void);
-extern void check_snmp_rs_trap(real_server *, virtual_server *);
-extern void check_snmp_quorum_trap(virtual_server *);
+extern void check_snmp_rs_trap(real_server_t *, virtual_server_t *);
+extern void check_snmp_quorum_trap(virtual_server_t *);
 
 #endif
diff -rupN keepalived-1.2.7/keepalived/include/check_tcp.h keepalived-1.2.7-unicast/keepalived/include/check_tcp.h
--- keepalived-1.2.7/keepalived/include/check_tcp.h	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/check_tcp.h	2013-05-24 10:12:36.553164100 +0200
@@ -33,9 +33,9 @@
 
 /* Checker argument structure  */
 typedef struct _tcp_checker {
-	struct sockaddr_storage dst;
-	struct sockaddr_storage bindto;
-	int connection_to;
+	struct sockaddr_storage		dst;
+	struct sockaddr_storage		bindto;
+	int				connection_to;
 } tcp_checker_t;
 
 /* Prototypes defs */
diff -rupN keepalived-1.2.7/keepalived/include/config.h.in keepalived-1.2.7-unicast/keepalived/include/config.h.in
--- keepalived-1.2.7/keepalived/include/config.h.in	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/config.h.in	1970-01-01 01:00:00.000000000 +0100
@@ -1,30 +0,0 @@
-/*
- * Soft:        Keepalived is a failover program for the LVS project
- *              <www.linuxvirtualserver.org>. It monitor & manipulate
- *              a loadbalanced server pool using multi-layer checks.
- *
- * Part:        Configuration include file.
- *
- * Author:      Jacob Rief, <jacob.rief@tiscover.com>
- *
- *              This program is distributed in the hope that it will be useful,
- *              but WITHOUT ANY WARRANTY; without even the implied warranty of
- *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *              See the GNU General Public License for more details.
- *
- *              This program is free software; you can redistribute it and/or
- *              modify it under the terms of the GNU General Public License
- *              as published by the Free Software Foundation; either version
- *              2 of the License, or (at your option) any later version.
- *
- * Copyright (C) 2001-2012 Alexandre Cassen, <acassen@gmail.com>
- */
-
-#ifndef _CONFIG_H
-#define _CONFIG_H
-
-#define LOG_FACILITY_MAX	7
-#define PROG			"Keepalived"
-#define VERSION_STRING PROG" v@VERSION@ (@VERSION_DATE@)\n"
-
-#endif
diff -rupN keepalived-1.2.7/keepalived/include/global_data.h keepalived-1.2.7-unicast/keepalived/include/global_data.h
--- keepalived-1.2.7/keepalived/include/global_data.h	2012-08-17 01:21:28.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/global_data.h	2013-05-24 10:12:36.555164200 +0200
@@ -39,30 +39,30 @@
 
 /* email link list */
 typedef struct _email {
-	char *addr;
-} email;
+	char				*addr;
+} email_t;
 
 /* Configuration data root */
-typedef struct _conf_data {
-	int linkbeat_use_polling;
-	char *router_id;
-	char *plugin_dir;
-	char *email_from;
-	struct sockaddr_storage smtp_server;
-	long smtp_connection_to;
-	list email;
+typedef struct _data {
+	int				linkbeat_use_polling;
+	char				*router_id;
+	char				*plugin_dir;
+	char				*email_from;
+	struct sockaddr_storage		smtp_server;
+	long				smtp_connection_to;
+	list				email;
 #ifdef _WITH_SNMP_
-	int enable_traps;
+	int				enable_traps;
 #endif
-} conf_data_t;
+} data_t;
 
 /* Global vars exported */
-extern conf_data_t *global_data; /* Global configuration data */
+extern data_t *global_data; /* Global configuration data */
 
 /* Prototypes */
 extern void alloc_email(char *);
-extern conf_data_t *alloc_global_data(void);
-extern void free_global_data(conf_data_t *);
-extern void dump_global_data(conf_data_t *);
+extern data_t *alloc_global_data(void);
+extern void free_global_data(data_t *);
+extern void dump_global_data(data_t *);
 
 #endif
diff -rupN keepalived-1.2.7/keepalived/include/ipvswrapper.h keepalived-1.2.7-unicast/keepalived/include/ipvswrapper.h
--- keepalived-1.2.7/keepalived/include/ipvswrapper.h	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/ipvswrapper.h	2013-05-24 10:12:36.557164300 +0200
@@ -91,9 +91,9 @@ do {						\
 /* prototypes */
 extern int ipvs_start(void);
 extern void ipvs_stop(void);
-extern virtual_server_group *ipvs_get_group_by_name(char *, list);
-extern int ipvs_group_remove_entry(virtual_server *, virtual_server_group_entry *);
-extern int ipvs_cmd(int, list, virtual_server *, real_server *);
+extern virtual_server_group_t *ipvs_get_group_by_name(char *, list);
+extern int ipvs_group_remove_entry(virtual_server_t *, virtual_server_group_entry_t *);
+extern int ipvs_cmd(int, list, virtual_server_t *, real_server_t *);
 extern int ipvs_syncd_cmd(int, char *, int, int);
 extern void ipvs_syncd_master(char *, int);
 extern void ipvs_syncd_backup(char *, int);
@@ -101,7 +101,7 @@ extern void ipvs_syncd_backup(char *, in
 #ifdef _KRNL_2_6_
 /* Refresh statistics at most every 5 seconds */
 #define STATS_REFRESH 5
-extern void ipvs_update_stats(virtual_server * vs);
+extern void ipvs_update_stats(virtual_server_t * vs);
 #endif
 
 #endif
diff -rupN keepalived-1.2.7/keepalived/include/ipwrapper.h keepalived-1.2.7-unicast/keepalived/include/ipwrapper.h
--- keepalived-1.2.7/keepalived/include/ipwrapper.h	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/ipwrapper.h	2013-05-24 10:12:36.559164400 +0200
@@ -49,10 +49,10 @@
 #define LVS_CMD_EDIT_DEST	IP_VS_SO_SET_EDITDEST
 
 /* prototypes */
-extern void perform_svr_state(int, virtual_server *, real_server *);
-extern void update_svr_wgt(int, virtual_server *, real_server *);
-extern int svr_checker_up(checker_id_t, real_server *);
-extern void update_svr_checker_state(int, checker_id_t, virtual_server *, real_server *);
+extern void perform_svr_state(int, virtual_server_t *, real_server_t *);
+extern void update_svr_wgt(int, virtual_server_t *, real_server_t *);
+extern int svr_checker_up(checker_id_t, real_server_t *);
+extern void update_svr_checker_state(int, checker_id_t, virtual_server_t *, real_server_t *);
 extern int init_services(void);
 extern int clear_services(void);
 extern int clear_diff_services(void);
diff -rupN keepalived-1.2.7/keepalived/include/smtp.h keepalived-1.2.7-unicast/keepalived/include/smtp.h
--- keepalived-1.2.7/keepalived/include/smtp.h	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/smtp.h	2013-05-24 10:12:36.563164600 +0200
@@ -68,15 +68,15 @@ do {					\
 } while (0)
 
 /* SMTP thread arguments */
-typedef struct _smtp_thread_arg {
-	int fd;
-	int stage;
-	int email_it;
-	char *subject;
-	char *body;
-	char *buffer;
-	long buflen;
-} smtp_thread_arg;
+typedef struct _smtp {
+	int		fd;
+	int		stage;
+	int		email_it;
+	char		*subject;
+	char		*body;
+	char		*buffer;
+	long		buflen;
+} smtp_t;
 
 /* SMTP command string processing */
 #define SMTP_HELO_CMD    "HELO %s\r\n"
@@ -90,6 +90,6 @@ typedef struct _smtp_thread_arg {
 #define SMTP_QUIT_CMD    "QUIT\r\n"
 
 /* Prototypes defs */
-extern void smtp_alert(real_server *, vrrp_rt *, vrrp_sgroup *,
+extern void smtp_alert(real_server_t *, vrrp_t *, vrrp_sgroup_t *,
 		       const char *, const char *);
 #endif
diff -rupN keepalived-1.2.7/keepalived/include/vrrp.h keepalived-1.2.7-unicast/keepalived/include/vrrp.h
--- keepalived-1.2.7/keepalived/include/vrrp.h	2012-08-29 00:05:12.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/vrrp.h	2013-05-24 10:12:36.566164800 +0200
@@ -38,17 +38,17 @@
 #include "vector.h"
 #include "list.h"
 
-typedef struct {		/* rfc2338.5.1 */
-	uint8_t vers_type;	/* 0-3=type, 4-7=version */
-	uint8_t vrid;		/* virtual router id */
-	uint8_t priority;	/* router priority */
-	uint8_t naddr;		/* address counter */
-	uint8_t auth_type;	/* authentification type */
-	uint8_t adver_int;	/* advertissement interval(in sec) */
-	uint16_t chksum;	/* checksum (ip-like one) */
-/* here <naddr> ip addresses */
-/* here authentification infos */
-} vrrp_pkt;
+typedef struct _vrrphdr {			/* rfc2338.5.1 */
+	uint8_t			vers_type;	/* 0-3=type, 4-7=version */
+	uint8_t			vrid;		/* virtual router id */
+	uint8_t			priority;	/* router priority */
+	uint8_t			naddr;		/* address counter */
+	uint8_t			auth_type;	/* authentification type */
+	uint8_t			adver_int;	/* advertissement interval(in sec) */
+	uint16_t		chksum;		/* checksum (ip-like one) */
+	/* here <naddr> ip addresses */
+	/* here authentification infos */
+} vrrphdr_t;
 
 /* protocol constants */
 #define INADDR_VRRP_GROUP	0xe0000012	/* multicast addr - rfc2338.5.2.2 */
@@ -70,86 +70,86 @@ typedef struct {		/* rfc2338.5.1 */
  * of VRRP instances that need to be state sync together.
  */
 typedef struct _vrrp_sgroup {
-	char *gname;		/* Group name */
-	vector_t *iname;	/* Set of VRRP instances in this group */
-	list index_list;	/* List of VRRP instances */
-	int state;		/* current stable state */
-	int global_tracking;	/* Use floating priority and scripts
-				 * All VRRP must share same tracking conf
-				 */
+	char			*gname;			/* Group name */
+	vector_t		*iname;			/* Set of VRRP instances in this group */
+	list			index_list;		/* List of VRRP instances */
+	int			state;			/* current stable state */
+	int			global_tracking;	/* Use floating priority and scripts
+							 * All VRRP must share same tracking conf
+							 */
 
 	/* State transition notification */
-	int notify_exec;
-	char *script_backup;
-	char *script_master;
-	char *script_fault;
-	char *script;
-	int smtp_alert;
-} vrrp_sgroup;
+	int			notify_exec;
+	char			*script_backup;
+	char			*script_master;
+	char			*script_fault;
+	char			*script;
+	int			smtp_alert;
+} vrrp_sgroup_t;
 
 /* parameters per virtual router -- rfc2338.6.1.2 */
-typedef struct _vrrp_rt {
-	sa_family_t family;	/* AF_INET|AF_INET6 */
-	char *iname;		/* Instance Name */
-	vrrp_sgroup *sync;	/* Sync group we belong to */
-	interface *ifp;		/* Interface we belong to */
-	int dont_track_primary; /* If set ignores ifp faults */
-	int vmac;		/* If set try to set VRRP VMAC */
-	char vmac_ifname[IFNAMSIZ]; /* Name of VRRP VMAC interface */
-	unsigned int vmac_ifindex;	/* ifindex of vmac interface */
-	list track_ifp;		/* Interface state we monitor */
-	list track_script;	/* Script state we monitor */
-	uint32_t mcast_saddr;	/* Src IP address to use in VRRP IP header */
-	char *lvs_syncd_if;	/* handle LVS sync daemon state using this
-				 * instance FSM & running on specific interface
-				 * => eth0 for example.
-				 */
-	int garp_delay;		/* Delay to launch gratuitous ARP */
-	int vrid;		/* virtual id. from 1(!) to 255 */
-	int base_priority;	/* configured priority value */
-	int effective_priority;	/* effective priority value */
-	int vipset;		/* All the vips are set ? */
-	list vip;		/* list of virtual ip addresses */
-	list evip;		/* list of protocol excluded VIPs.
-				 * Those VIPs will not be presents into the
-				 * VRRP adverts
-				 */
-	list vroutes;		/* list of virtual routes */
-	int adver_int;		/* delay between advertisements(in sec) */
-	int nopreempt;          /* true if higher prio does not preempt lower */
-	long preempt_delay;     /* Seconds*TIMER_HZ after startup until
-				 * preemption based on higher prio over lower
-				 * prio is allowed.  0 means no delay.
-				 */
-	timeval_t preempt_time; /* Time after which preemption can happen */
-	int state;		/* internal state (init/backup/master) */
-	int init_state;		/* the initial state of the instance */
-	int wantstate;		/* user explicitly wants a state (back/mast) */
-	int fd_in;		/* IN socket descriptor */
-	int fd_out;		/* OUT socket descriptor */
+typedef struct _vrrp_t {
+	sa_family_t		family;			/* AF_INET|AF_INET6 */
+	char			*iname;			/* Instance Name */
+	vrrp_sgroup_t		*sync;			/* Sync group we belong to */
+	interface_t		*ifp;			/* Interface we belong to */
+	int			dont_track_primary;	/* If set ignores ifp faults */
+	int			vmac;			/* If set try to set VRRP VMAC */
+	char			vmac_ifname[IFNAMSIZ];	/* Name of VRRP VMAC interface */
+	unsigned int		vmac_ifindex;		/* ifindex of vmac interface */
+	list			track_ifp;		/* Interface state we monitor */
+	list			track_script;		/* Script state we monitor */
+	uint32_t		mcast_saddr;		/* Src IP address to use in VRRP IP header */
+	char			*lvs_syncd_if;		/* handle LVS sync daemon state using this
+							 * instance FSM & running on specific interface
+							 * => eth0 for example.
+							 */
+	int			garp_delay;		/* Delay to launch gratuitous ARP */
+	int			vrid;			/* virtual id. from 1(!) to 255 */
+	int			base_priority;		/* configured priority value */
+	int			effective_priority;	/* effective priority value */
+	int			vipset;			/* All the vips are set ? */
+	list			vip;			/* list of virtual ip addresses */
+	list			evip;			/* list of protocol excluded VIPs.
+							 * Those VIPs will not be presents into the
+							 * VRRP adverts
+							 */
+	list			vroutes;		/* list of virtual routes */
+	int			adver_int;		/* delay between advertisements(in sec) */
+	int			nopreempt;		/* true if higher prio does not preempt lower */
+	long			preempt_delay;		/* Seconds*TIMER_HZ after startup until
+							 * preemption based on higher prio over lower
+							 * prio is allowed.  0 means no delay.
+							 */
+	timeval_t		preempt_time;		/* Time after which preemption can happen */
+	int			state;			/* internal state (init/backup/master) */
+	int			init_state;		/* the initial state of the instance */
+	int			wantstate;		/* user explicitly wants a state (back/mast) */
+	int			fd_in;			/* IN socket descriptor */
+	int			fd_out;			/* OUT socket descriptor */
 
-	int debug;		/* Debug level 0-4 */
+	int			debug;			/* Debug level 0-4 */
 
 	/* State transition notification */
-	int smtp_alert;
-	int notify_exec;
-	char *script_backup;
-	char *script_master;
-	char *script_fault;
-	char *script_stop;
-	char *script;
+	int			smtp_alert;
+	int			notify_exec;
+	char			*script_backup;
+	char			*script_master;
+	char			*script_fault;
+	char			*script_stop;
+	char			*script;
 
 	/* rfc2336.6.2 */
-	uint32_t ms_down_timer;
-	struct timeval sands;
+	uint32_t		ms_down_timer;
+	timeval_t		sands;
 
 	/* Sending buffer */
-	char *send_buffer;	/* Allocated send buffer */
-	int send_buffer_size;
+	char			*send_buffer;		/* Allocated send buffer */
+	int			send_buffer_size;
 
 	/* Authentication data */
-	int auth_type;		/* authentification type. VRRP_AUTH_* */
-	uint8_t auth_data[8];	/* authentification data */
+	int			auth_type;		/* authentification type. VRRP_AUTH_* */
+	uint8_t			auth_data[8];		/* authentification data */
 
 	/*
 	 * To have my own ip_id creates collision with kernel ip->id
@@ -158,11 +158,11 @@ typedef struct _vrrp_rt {
 	 * This packet isnt routed, i can check the outgoing MTU
 	 * to warn the user only if the outoing mtu is too small
 	 */
-	int ip_id;
+	int			ip_id;
 
 	/* IPSEC AH counter def --rfc2402.3.3.2 */
-	seq_counter *ipsecah_counter;
-} vrrp_rt;
+	seq_counter_t		*ipsecah_counter;
+} vrrp_t;
 
 /* VRRP state machine -- rfc2338.6.4 */
 #define VRRP_STATE_INIT			0	/* rfc2338.6.4.1 */
@@ -215,24 +215,24 @@ typedef struct _vrrp_rt {
 #define VRRP_ISUP(V)           (VRRP_IF_ISUP(V) && VRRP_SCRIPT_ISUP(V))
 
 /* prototypes */
-extern vrrp_pkt *vrrp_get_header(sa_family_t, char *, int *, uint32_t *);
+extern vrrphdr_t *vrrp_get_header(sa_family_t, char *, int *, uint32_t *);
 extern int open_vrrp_send_socket(sa_family_t, int, int);
 extern int open_vrrp_socket(sa_family_t, int, int);
-extern int new_vrrp_socket(vrrp_rt *);
-extern void close_vrrp_socket(vrrp_rt *);
-extern void vrrp_send_link_update(vrrp_rt *);
-extern int vrrp_send_adv(vrrp_rt *, int);
-extern int vrrp_state_fault_rx(vrrp_rt *, char *, int);
-extern int vrrp_state_master_rx(vrrp_rt *, char *, int);
-extern int vrrp_state_master_tx(vrrp_rt *, const int);
-extern void vrrp_state_backup(vrrp_rt *, char *, int);
-extern void vrrp_state_goto_master(vrrp_rt *);
-extern void vrrp_state_leave_master(vrrp_rt *);
+extern int new_vrrp_socket(vrrp_t *);
+extern void close_vrrp_socket(vrrp_t *);
+extern void vrrp_send_link_update(vrrp_t *);
+extern int vrrp_send_adv(vrrp_t *, int);
+extern int vrrp_state_fault_rx(vrrp_t *, char *, int);
+extern int vrrp_state_master_rx(vrrp_t *, char *, int);
+extern int vrrp_state_master_tx(vrrp_t *, const int);
+extern void vrrp_state_backup(vrrp_t *, char *, int);
+extern void vrrp_state_goto_master(vrrp_t *);
+extern void vrrp_state_leave_master(vrrp_t *);
 extern int vrrp_ipsecah_len(void);
 extern int vrrp_complete_init(void);
 extern void shutdown_vrrp_instances(void);
 extern void clear_diff_vrrp(void);
 extern void clear_diff_script(void);
-extern void vrrp_restore_interface(vrrp_rt *, int);
+extern void vrrp_restore_interface(vrrp_t *, int);
 
 #endif
diff -rupN keepalived-1.2.7/keepalived/include/vrrp_arp.h keepalived-1.2.7-unicast/keepalived/include/vrrp_arp.h
--- keepalived-1.2.7/keepalived/include/vrrp_arp.h	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/vrrp_arp.h	2013-05-24 10:12:36.567164900 +0200
@@ -36,19 +36,19 @@
 #define IPPROTO_ADDR_LEN	4
 
 /* types definition */
-typedef struct _m_arphdr {
-	unsigned short int ar_hrd;	/* Format of hardware address.  */
-	unsigned short int ar_pro;	/* Format of protocol address.  */
-	unsigned char ar_hln;	/* Length of hardware address.  */
-	unsigned char ar_pln;	/* Length of protocol address.  */
-	unsigned short int ar_op;	/* ARP opcode (command).  */
+typedef struct _arphdr {
+	unsigned short int	ar_hrd;	/* Format of hardware address.  */
+	unsigned short int	ar_pro;	/* Format of protocol address.  */
+	unsigned char		ar_hln;	/* Length of hardware address.  */
+	unsigned char		ar_pln;	/* Length of protocol address.  */
+	unsigned short int	ar_op;	/* ARP opcode (command).  */
 
 	/* Ethernet looks like this : This bit is variable sized however...  */
-	unsigned char __ar_sha[ETH_ALEN];	/* Sender hardware address.  */
-	unsigned char __ar_sip[4];	/* Sender IP address.  */
-	unsigned char __ar_tha[ETH_ALEN];	/* Target hardware address.  */
-	unsigned char __ar_tip[4];	/* Target IP address.  */
-} m_arphdr;
+	unsigned char		__ar_sha[ETH_ALEN];	/* Sender hardware address.  */
+	unsigned char		__ar_sip[4];		/* Sender IP address.  */
+	unsigned char		__ar_tha[ETH_ALEN];	/* Target hardware address.  */
+	unsigned char		__ar_tip[4];		/* Target IP address.  */
+} arphdr_t;
 
 /* Global vars exported */
 extern char *garp_buffer;
@@ -57,6 +57,6 @@ extern int garp_fd;
 /* prototypes */
 extern void gratuitous_arp_init(void);
 extern void gratuitous_arp_close(void);
-extern int send_gratuitous_arp(ip_address *);
+extern int send_gratuitous_arp(ip_address_t *);
 
 #endif
diff -rupN keepalived-1.2.7/keepalived/include/vrrp_data.h keepalived-1.2.7-unicast/keepalived/include/vrrp_data.h
--- keepalived-1.2.7/keepalived/include/vrrp_data.h	2012-08-29 00:05:12.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/vrrp_data.h	2013-05-24 10:12:36.570165000 +0200
@@ -40,28 +40,28 @@
  * physical interface.
  */
 typedef struct _sock {
-	sa_family_t family;
-	int proto;
-	int ifindex;
-	int fd_in;
-	int fd_out;
+	sa_family_t		family;
+	int			proto;
+	int			ifindex;
+	int			fd_in;
+	int			fd_out;
 } sock_t;
 
 /* Configuration data root */
-typedef struct _vrrp_conf_data {
-	list static_addresses;
-	list static_routes;
-	list vrrp_sync_group;
-	list vrrp;
-	list vrrp_index;
-	list vrrp_index_fd;
-	list vrrp_socket_pool;
-	list vrrp_script;
-} vrrp_conf_data;
+typedef struct _vrrp_data {
+	list			static_addresses;
+	list			static_routes;
+	list			vrrp_sync_group;
+	list			vrrp;
+	list			vrrp_index;
+	list			vrrp_index_fd;
+	list			vrrp_socket_pool;
+	list			vrrp_script;
+} vrrp_data_t;
 
 /* Global Vars exported */
-extern vrrp_conf_data *vrrp_data;
-extern vrrp_conf_data *old_vrrp_data;
+extern vrrp_data_t *vrrp_data;
+extern vrrp_data_t *old_vrrp_data;
 extern char *vrrp_buffer;
 
 /* prototypes */
@@ -77,9 +77,9 @@ extern void alloc_vrrp_evip(vector_t *);
 extern void alloc_vrrp_vroute(vector_t *);
 extern void alloc_vrrp_buffer(void);
 extern void free_vrrp_buffer(void);
-extern vrrp_conf_data *alloc_vrrp_data(void);
-extern void free_vrrp_data(vrrp_conf_data *);
-extern void dump_vrrp_data(vrrp_conf_data *);
-extern void free_vrrp_sockpool(vrrp_conf_data *);
+extern vrrp_data_t *alloc_vrrp_data(void);
+extern void free_vrrp_data(vrrp_data_t *);
+extern void dump_vrrp_data(vrrp_data_t *);
+extern void free_vrrp_sockpool(vrrp_data_t *);
 
 #endif
diff -rupN keepalived-1.2.7/keepalived/include/vrrp_if.h keepalived-1.2.7-unicast/keepalived/include/vrrp_if.h
--- keepalived-1.2.7/keepalived/include/vrrp_if.h	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/vrrp_if.h	2013-05-24 10:12:36.571165100 +0200
@@ -72,24 +72,24 @@ struct ethtool_value {
 
 /* Interface structure definition */
 typedef struct _interface {
-	char ifname[IF_NAMESIZ + 1];	/* Interface name */
-	unsigned int ifindex;		/* Interface index */
-	struct in_addr sin_addr;	/* IPv4 primary IPv4 address */
-	struct in6_addr sin6_addr;	/* IPv6 link address */
-	unsigned long flags;		/* flags */
-	unsigned int mtu;		/* MTU for this interface */
-	unsigned short hw_type;		/* Type of hardware address */
-	u_char hw_addr[IF_HWADDR_MAX];	/* MAC address */
-	int hw_addr_len;		/* MAC addresss length */
-	int lb_type;			/* Interface regs selection */
-	int linkbeat;			/* LinkBeat from MII BMSR req */
-} interface;
+	char			ifname[IF_NAMESIZ + 1];	/* Interface name */
+	unsigned int		ifindex;		/* Interface index */
+	struct in_addr		sin_addr;		/* IPv4 primary IPv4 address */
+	struct in6_addr		sin6_addr;		/* IPv6 link address */
+	unsigned long		flags;			/* flags */
+	unsigned int		mtu;			/* MTU for this interface_t */
+	unsigned short		hw_type;		/* Type of hardware address */
+	u_char			hw_addr[IF_HWADDR_MAX];	/* MAC address */
+	int			hw_addr_len;		/* MAC addresss length */
+	int			lb_type;		/* Interface regs selection */
+	int			linkbeat;		/* LinkBeat from MII BMSR req */
+} interface_t;
 
 /* Tracked interface structure definition */
 typedef struct _tracked_if {
-	int weight;		/* tracking weight when non-zero */
-	interface *ifp;		/* interface backpointer, cannot be NULL */
-} tracked_if;
+	int			weight;		/* tracking weight when non-zero */
+	interface_t		*ifp;		/* interface backpointer, cannot be NULL */
+} tracked_if_t;
 
 /* Macros */
 #define IF_NAME(X) ((X)->ifname)
@@ -105,24 +105,24 @@ typedef struct _tracked_if {
                     if_linkbeat(X))
 
 /* prototypes */
-extern interface *if_get_by_ifindex(const int);
-extern interface *if_get_by_ifname(const char *);
-extern int if_linkbeat(const interface *);
+extern interface_t *if_get_by_ifindex(const int);
+extern interface_t *if_get_by_ifname(const char *);
+extern int if_linkbeat(const interface_t *);
 extern int if_mii_probe(const char *);
 extern int if_ethtool_probe(const char *);
-extern void if_add_queue(interface *);
+extern void if_add_queue(interface_t *);
 extern int if_monitor_thread(thread_t *);
 extern void init_interface_queue(void);
 extern void init_interface_linkbeat(void);
 extern void free_interface_queue(void);
 extern void dump_if(void *);
-extern int if_join_vrrp_group(sa_family_t, int *, interface *, int);
-extern int if_leave_vrrp_group(sa_family_t, int, interface *);
-extern int if_setsockopt_bindtodevice(int *, interface *);
+extern int if_join_vrrp_group(sa_family_t, int *, interface_t *, int);
+extern int if_leave_vrrp_group(sa_family_t, int, interface_t *);
+extern int if_setsockopt_bindtodevice(int *, interface_t *);
 extern int if_setsockopt_hdrincl(int *);
 extern int if_setsockopt_mcast_loop(sa_family_t, int *);
 extern int if_setsockopt_mcast_hops(sa_family_t, int *);
-extern int if_setsockopt_mcast_if(sa_family_t, int *, interface *);
+extern int if_setsockopt_mcast_if(sa_family_t, int *, interface_t *);
 extern int if_setsockopt_priority(int *);
 
 #endif
diff -rupN keepalived-1.2.7/keepalived/include/vrrp_index.h keepalived-1.2.7-unicast/keepalived/include/vrrp_index.h
--- keepalived-1.2.7/keepalived/include/vrrp_index.h	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/vrrp_index.h	2013-05-24 10:12:36.573165200 +0200
@@ -36,10 +36,10 @@
 /* Macro definition */
 
 /* prototypes */
-extern void alloc_vrrp_bucket(vrrp_rt *);
-extern void alloc_vrrp_fd_bucket(vrrp_rt *);
-extern void remove_vrrp_fd_bucket(vrrp_rt *);
-extern void set_vrrp_fd_bucket(int, vrrp_rt *);
-extern vrrp_rt *vrrp_index_lookup(const int, const int);
+extern void alloc_vrrp_bucket(vrrp_t *);
+extern void alloc_vrrp_fd_bucket(vrrp_t *);
+extern void remove_vrrp_fd_bucket(vrrp_t *);
+extern void set_vrrp_fd_bucket(int, vrrp_t *);
+extern vrrp_t *vrrp_index_lookup(const int, const int);
 
 #endif
diff -rupN keepalived-1.2.7/keepalived/include/vrrp_ipaddress.h keepalived-1.2.7-unicast/keepalived/include/vrrp_ipaddress.h
--- keepalived-1.2.7/keepalived/include/vrrp_ipaddress.h	2012-08-29 00:05:12.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/vrrp_ipaddress.h	2013-05-24 10:12:36.574165300 +0200
@@ -37,7 +37,7 @@
 #include "vector.h"
 
 /* types definition */
-typedef struct {
+typedef struct _ip_address {
 	struct ifaddrmsg ifa;
 
 	union {
@@ -48,10 +48,10 @@ typedef struct {
 		struct in6_addr sin6_addr;
 	} u;
 
-	interface *ifp;		/* Interface owning IP address */
-	char *label;		/* Alias name, e.g. eth0:1 */
-	int set;		/* TRUE if addr is set */
-} ip_address;
+	interface_t		*ifp;	/* Interface owning IP address */
+	char			*label;	/* Alias name, e.g. eth0:1 */
+	int			set;	/* TRUE if addr is set */
+} ip_address_t;
 
 #define IPADDRESS_DEL 0
 #define IPADDRESS_ADD 1
@@ -79,7 +79,7 @@ typedef struct {
 extern void netlink_iplist(list, int);
 extern void free_ipaddress(void *);
 extern void dump_ipaddress(void *);
-extern void alloc_ipaddress(list, vector_t *, interface *);
+extern void alloc_ipaddress(list, vector_t *, interface_t *);
 extern void clear_diff_address(list, list);
 extern void clear_diff_saddresses(void);
 
diff -rupN keepalived-1.2.7/keepalived/include/vrrp_iproute.h keepalived-1.2.7-unicast/keepalived/include/vrrp_iproute.h
--- keepalived-1.2.7/keepalived/include/vrrp_iproute.h	2012-08-29 00:05:12.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/vrrp_iproute.h	2013-05-24 10:12:36.576165400 +0200
@@ -34,18 +34,18 @@
 
 /* types definition */
 typedef struct _ip_route {
-	uint32_t dst;		/* RTA_DST */
-	uint8_t dmask;
-	uint32_t gw;		/* RTA_GATEWAY */
-	uint32_t gw2;		/* Will use RTA_MULTIPATH */
-	uint32_t src;		/* RTA_PREFSRC */
-	uint32_t metric;	/* RTA_PRIORITY */
-	int index;		/* RTA_OIF */
-	int blackhole;
-	int scope;
-	int table;
-	int set;
-} ip_route;
+	uint32_t		dst;		/* RTA_DST */
+	uint8_t			dmask;
+	uint32_t		gw;		/* RTA_GATEWAY */
+	uint32_t		gw2;		/* Will use RTA_MULTIPATH */
+	uint32_t		src;		/* RTA_PREFSRC */
+	uint32_t		metric;		/* RTA_PRIORITY */
+	int			index;		/* RTA_OIF */
+	int			blackhole;
+	int			scope;
+	int			table;
+	int			set;
+} ip_route_t;
 
 #define IPROUTE_DEL 0
 #define IPROUTE_ADD 1
@@ -60,7 +60,7 @@ typedef struct _ip_route {
 			 (X)->index  == (Y)->index)
 
 /* prototypes */
-extern int netlink_route_ipv4(ip_route *, int);
+extern int netlink_route_ipv4(ip_route_t *, int);
 extern void netlink_rtlist_ipv4(list, int);
 extern void free_iproute(void *);
 extern void dump_iproute(void *);
diff -rupN keepalived-1.2.7/keepalived/include/vrrp_ipsecah.h keepalived-1.2.7-unicast/keepalived/include/vrrp_ipsecah.h
--- keepalived-1.2.7/keepalived/include/vrrp_ipsecah.h	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/vrrp_ipsecah.h	2013-05-24 10:12:36.577165400 +0200
@@ -38,26 +38,26 @@
 				   -- rfc2402.2.2 */
 #define IPPROTO_IPSEC_AH 51	/* IP protocol number -- rfc2402.2 */
 
-typedef struct {		/* rfc2402.2 */
-	uint8_t next_header;	/* Next header field */
-	uint8_t payload_len;	/* Payload Lenght */
-	uint16_t reserved;	/* Reserved field */
-	uint32_t spi;		/* Security Parameter Index */
-	uint32_t seq_number;	/* Sequence number */
-	uint32_t auth_data[3];	/* Authentication data 128-bit MD5 digest trucated
-				   => HMAC_MD5_TRUNC*8/32 */
-} ipsec_ah;
+typedef struct _ipsec_ah {				/* rfc2402.2 */
+	uint8_t			next_header;	/* Next header field */
+	uint8_t			payload_len;	/* Payload Lenght */
+	uint16_t		reserved;	/* Reserved field */
+	uint32_t		spi;		/* Security Parameter Index */
+	uint32_t		seq_number;	/* Sequence number */
+	uint32_t		auth_data[3];	/* Authentication data 128-bit MD5 digest trucated
+						   => HMAC_MD5_TRUNC*8/32 */
+} ipsec_ah_t;
 
 typedef struct {		/* rfc2402.3.3.3.1.1.1 */
-	u_int8_t tos;
-	u_int16_t frag_off;
-	u_int16_t check;
+	uint8_t			tos;
+	uint16_t		frag_off;
+	uint16_t		check;
 } ICV_mutable_fields;		/* We need to zero this fields to compute the ICV */
 
-typedef struct {
-	int cycle;
-	uint32_t seq_number;
-} seq_counter;
+typedef struct _seq_counter {
+	int			cycle;
+	uint32_t		seq_number;
+} seq_counter_t;
 
 extern void hmac_md5(unsigned char *, int, unsigned char *, int, unsigned char *);
 
diff -rupN keepalived-1.2.7/keepalived/include/vrrp_ndisc.h keepalived-1.2.7-unicast/keepalived/include/vrrp_ndisc.h
--- keepalived-1.2.7/keepalived/include/vrrp_ndisc.h	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/vrrp_ndisc.h	2013-05-24 10:12:36.579165600 +0200
@@ -86,7 +86,7 @@ struct nd_opt_hdr {
 /* prototypes */
 extern void ndisc_init(void);
 extern void ndisc_close(void);
-extern int ndisc_send_unsolicited_na(ip_address *);
+extern int ndisc_send_unsolicited_na(ip_address_t *);
 
 #endif
 
diff -rupN keepalived-1.2.7/keepalived/include/vrrp_netlink.h keepalived-1.2.7-unicast/keepalived/include/vrrp_netlink.h
--- keepalived-1.2.7/keepalived/include/vrrp_netlink.h	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/vrrp_netlink.h	2013-05-24 10:12:36.580165600 +0200
@@ -37,19 +37,19 @@
 #include "timer.h"
 
 /* types definitions */
-struct nl_handle {
-	int fd;
-	struct sockaddr_nl snl;
-	__u32 seq;
-};
+typedef struct _nl_handle {
+	int			fd;
+	struct sockaddr_nl	snl;
+	__u32			seq;
+} nl_handle_t;
 
 /* Define types */
 #define NETLINK_TIMER (30 * TIMER_HZ)
 #define NLMSG_TAIL(nmsg) ((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len)))
 
 /* Global vars exported */
-extern struct nl_handle nl_kernel;	/* Kernel reflection channel */
-extern struct nl_handle nl_cmd;		/* Command channel */
+extern nl_handle_t nl_kernel;	/* Kernel reflection channel */
+extern nl_handle_t nl_cmd;	/* Command channel */
 
 /* prototypes */
 extern int addattr32(struct nlmsghdr *, int, int, uint32_t);
@@ -57,9 +57,9 @@ extern int addattr_l(struct nlmsghdr *,
 extern int rta_addattr_l(struct rtattr *, int, int, const void *, int);
 extern char *netlink_scope_n2a(int);
 extern int netlink_scope_a2n(char *);
-extern int netlink_socket(struct nl_handle *, unsigned long);
-extern int netlink_close(struct nl_handle *);
-extern int netlink_talk(struct nl_handle *, struct nlmsghdr *);
+extern int netlink_socket(nl_handle_t *, unsigned long);
+extern int netlink_close(nl_handle_t *);
+extern int netlink_talk(nl_handle_t *, struct nlmsghdr *);
 extern int netlink_interface_lookup(void);
 extern int netlink_interface_refresh(void);
 extern void kernel_netlink_init(void);
diff -rupN keepalived-1.2.7/keepalived/include/vrrp_notify.h keepalived-1.2.7-unicast/keepalived/include/vrrp_notify.h
--- keepalived-1.2.7/keepalived/include/vrrp_notify.h	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/vrrp_notify.h	2013-05-24 10:12:36.582165700 +0200
@@ -27,7 +27,7 @@
 /* local include */
 #include "vrrp.h"
 
-extern int notify_instance_exec(vrrp_rt *, int);
-extern int notify_group_exec(vrrp_sgroup *, int);
+extern int notify_instance_exec(vrrp_t *, int);
+extern int notify_group_exec(vrrp_sgroup_t *, int);
 
 #endif
diff -rupN keepalived-1.2.7/keepalived/include/vrrp_scheduler.h keepalived-1.2.7-unicast/keepalived/include/vrrp_scheduler.h
--- keepalived-1.2.7/keepalived/include/vrrp_scheduler.h	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/vrrp_scheduler.h	2013-05-24 10:12:36.585165900 +0200
@@ -58,7 +58,7 @@ do {						\
 } while (0)
 
 /* extern prototypes */
-extern void vrrp_dispatcher_release(vrrp_conf_data *);
+extern void vrrp_dispatcher_release(vrrp_data_t *);
 extern int vrrp_dispatcher_init(thread_t *);
 extern int vrrp_read_dispatcher_thread(thread_t *);
 
diff -rupN keepalived-1.2.7/keepalived/include/vrrp_snmp.h keepalived-1.2.7-unicast/keepalived/include/vrrp_snmp.h
--- keepalived-1.2.7/keepalived/include/vrrp_snmp.h	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/vrrp_snmp.h	2013-05-24 10:12:36.587166000 +0200
@@ -110,7 +110,7 @@
 /* Prototypes */
 extern void vrrp_snmp_agent_init(void);
 extern void vrrp_snmp_agent_close(void);
-extern void vrrp_snmp_instance_trap(vrrp_rt *);
-extern void vrrp_snmp_group_trap(vrrp_sgroup *);
+extern void vrrp_snmp_instance_trap(vrrp_t *);
+extern void vrrp_snmp_group_trap(vrrp_sgroup_t *);
 
 #endif
diff -rupN keepalived-1.2.7/keepalived/include/vrrp_sync.h keepalived-1.2.7-unicast/keepalived/include/vrrp_sync.h
--- keepalived-1.2.7/keepalived/include/vrrp_sync.h	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/vrrp_sync.h	2013-05-24 10:12:36.588166100 +0200
@@ -41,15 +41,15 @@
 #define GROUP_NAME(G)  ((G)->gname)
 
 /* extern prototypes */
-extern void vrrp_init_instance_sands(vrrp_rt *);
-extern void vrrp_sync_smtp_notifier(vrrp_sgroup *);
-extern void vrrp_sync_set_group(vrrp_sgroup *);
-extern int vrrp_sync_group_up(vrrp_sgroup *);
-extern int vrrp_sync_leave_fault(vrrp_rt *);
-extern int vrrp_sync_goto_master(vrrp_rt *);
-extern void vrrp_sync_backup(vrrp_rt *);
-extern void vrrp_sync_master(vrrp_rt *);
-extern void vrrp_sync_master_election(vrrp_rt *);
-extern void vrrp_sync_fault(vrrp_rt *);
+extern void vrrp_init_instance_sands(vrrp_t *);
+extern void vrrp_sync_smtp_notifier(vrrp_sgroup_t *);
+extern void vrrp_sync_set_group(vrrp_sgroup_t *);
+extern int vrrp_sync_group_up(vrrp_sgroup_t *);
+extern int vrrp_sync_leave_fault(vrrp_t *);
+extern int vrrp_sync_goto_master(vrrp_t *);
+extern void vrrp_sync_backup(vrrp_t *);
+extern void vrrp_sync_master(vrrp_t *);
+extern void vrrp_sync_master_election(vrrp_t *);
+extern void vrrp_sync_fault(vrrp_t *);
 
 #endif
diff -rupN keepalived-1.2.7/keepalived/include/vrrp_track.h keepalived-1.2.7-unicast/keepalived/include/vrrp_track.h
--- keepalived-1.2.7/keepalived/include/vrrp_track.h	2012-08-29 00:05:12.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/vrrp_track.h	2013-05-24 10:12:36.590166200 +0200
@@ -56,22 +56,22 @@
 
 /* external script we call to track local processes */
 typedef struct _vrrp_script {
-	char *sname;		/* instance name */
-	char *script;		/* the command to be called */
-	long interval;		/* interval between script calls */
-	long timeout;		/* seconds before script timeout */
-	int weight;		/* weight associated to this script */
-	int result;		/* result of last call to this script: 0..R-1 = KO, R..R+F-1 = OK */
-	int inuse;		/* how many users have weight>0 ? */
-	int rise;		/* R: how many successes before OK */
-	int fall;		/* F: how many failures before KO */
-} vrrp_script;
+	char			*sname;		/* instance name */
+	char			*script;	/* the command to be called */
+	long			interval;	/* interval between script calls */
+	long			timeout;	/* seconds before script timeout */
+	int			weight;		/* weight associated to this script */
+	int			result;		/* result of last call to this script: 0..R-1 = KO, R..R+F-1 = OK */
+	int			inuse;		/* how many users have weight>0 ? */
+	int			rise;		/* R: how many successes before OK */
+	int			fall;		/* F: how many failures before KO */
+} vrrp_script_t;
 
 /* Tracked script structure definition */
 typedef struct _tracked_sc {
-	int weight;		/* tracking weight when non-zero */
-	vrrp_script *scr;	/* script pointer, cannot be NULL */
-} tracked_sc;
+	int			weight;		/* tracking weight when non-zero */
+	vrrp_script_t		*scr;		/* script pointer, cannot be NULL */
+} tracked_sc_t;
 
 /* prototypes */
 extern void dump_track(void *);
@@ -83,6 +83,6 @@ extern void vrrp_log_tracked_down(list);
 extern int vrrp_tracked_weight(list);
 extern int vrrp_script_up(list);
 extern int vrrp_script_weight(list);
-extern vrrp_script* find_script_by_name(char *);
+extern vrrp_script_t *find_script_by_name(char *);
 
 #endif
diff -rupN keepalived-1.2.7/keepalived/include/vrrp_vmac.h keepalived-1.2.7-unicast/keepalived/include/vrrp_vmac.h
--- keepalived-1.2.7/keepalived/include/vrrp_vmac.h	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/include/vrrp_vmac.h	2013-05-24 10:12:36.592166300 +0200
@@ -36,7 +36,7 @@
 #include "vrrp_if.h"
 
 /* prototypes */
-extern int netlink_link_add_vmac(vrrp_rt *);
-extern int netlink_link_del_vmac(vrrp_rt *);
+extern int netlink_link_add_vmac(vrrp_t *);
+extern int netlink_link_del_vmac(vrrp_t *);
 
 #endif
diff -rupN keepalived-1.2.7/keepalived/Makefile.in keepalived-1.2.7-unicast/keepalived/Makefile.in
--- keepalived-1.2.7/keepalived/Makefile.in	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/Makefile.in	2013-05-24 10:12:36.499161000 +0200
@@ -81,7 +81,6 @@ distclean:
 	for i in $(SUBDIRS); do \
 	$(MAKE) -C $$i distclean; done
 	rm -f Makefile $(BIN)/$(EXEC)
-	rm -f include/config.h
 
 mrproper: distclean
 	rm -f config.*
diff -rupN keepalived-1.2.7/keepalived/vrrp/vrrp.c keepalived-1.2.7-unicast/keepalived/vrrp/vrrp.c
--- keepalived-1.2.7/keepalived/vrrp/vrrp.c	2012-08-17 01:21:28.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/vrrp/vrrp.c	2013-05-24 10:12:36.603166900 +0200
@@ -48,7 +48,7 @@
 
 /* add/remove Virtual IP addresses */
 static int
-vrrp_handle_ipaddress(vrrp_rt * vrrp, int cmd, int type)
+vrrp_handle_ipaddress(vrrp_t * vrrp, int cmd, int type)
 {
 	if (debug & 32)
 		log_message(LOG_INFO, "VRRP_Instance(%s) %s protocol %s", vrrp->iname,
@@ -60,7 +60,7 @@ vrrp_handle_ipaddress(vrrp_rt * vrrp, in
 
 /* add/remove Virtual routes */
 static int
-vrrp_handle_iproutes(vrrp_rt * vrrp, int cmd)
+vrrp_handle_iproutes(vrrp_t * vrrp, int cmd)
 {
 	if (debug & 32)
 		log_message(LOG_INFO, "VRRP_Instance(%s) %s protocol Virtual Routes",
@@ -72,34 +72,34 @@ vrrp_handle_iproutes(vrrp_rt * vrrp, int
 
 /* IP header length */
 static int
-vrrp_iphdr_len(vrrp_rt * vrrp)
+vrrp_iphdr_len(vrrp_t * vrrp)
 {
-	return sizeof (struct iphdr);
+	return sizeof(struct iphdr);
 }
 
 /* IPSEC AH header length */
 int
 vrrp_ipsecah_len(void)
 {
-	return sizeof (ipsec_ah);
+	return sizeof(ipsec_ah_t);
 }
 
 /* VRRP header length */
 static int
-vrrp_hd_len(vrrp_rt * vrrp)
+vrrp_hd_len(vrrp_t * vrrp)
 {
-	int len = sizeof (vrrp_pkt);
+	int len = sizeof(vrrphdr_t);
 	if (vrrp->family == AF_INET)
 		len += VRRP_AUTH_LEN + ((!LIST_ISEMPTY(vrrp->vip)) ? LIST_SIZE(vrrp->vip) * sizeof (uint32_t) : 0);
         return len;
 }
 
 /* VRRP header pointer from buffer */
-vrrp_pkt *
+vrrphdr_t *
 vrrp_get_header(sa_family_t family, char *buf, int *proto, uint32_t *saddr)
 {
 	struct iphdr *iph;
-	vrrp_pkt *hd = NULL;
+	vrrphdr_t *hd = NULL;
 
 	if (family == AF_INET) {
 		iph = (struct iphdr *) buf;
@@ -109,18 +109,18 @@ vrrp_get_header(sa_family_t family, char
 		switch (iph->protocol) {
 		case IPPROTO_IPSEC_AH:
 			*proto = IPPROTO_IPSEC_AH;
-			hd = (vrrp_pkt *) ((char *) iph + (iph->ihl << 2) +
+			hd = (vrrphdr_t *) ((char *) iph + (iph->ihl << 2) +
 					   vrrp_ipsecah_len());
 			break;
 		case IPPROTO_VRRP:
 			*proto = IPPROTO_VRRP;
-			hd = (vrrp_pkt *) ((char *) iph + (iph->ihl << 2));
+			hd = (vrrphdr_t *) ((char *) iph + (iph->ihl << 2));
 			break;
 		}
 	} else if (family == AF_INET6) {
 		*proto = IPPROTO_VRRP;
 		*saddr = 0;
-		hd = (vrrp_pkt *) buf;
+		hd = (vrrphdr_t *) buf;
 	}
 
 	return hd;
@@ -131,10 +131,10 @@ vrrp_get_header(sa_family_t family, char
  * return 0 for a valid pkt, != 0 otherwise.
  */
 static int
-vrrp_in_chk_ipsecah(vrrp_rt * vrrp, char *buffer)
+vrrp_in_chk_ipsecah(vrrp_t * vrrp, char *buffer)
 {
 	struct iphdr *ip = (struct iphdr *) (buffer);
-	ipsec_ah *ah = (ipsec_ah *) ((char *) ip + (ip->ihl << 2));
+	ipsec_ah_t *ah = (ipsec_ah_t *) ((char *) ip + (ip->ihl << 2));
 	unsigned char *digest;
 	uint32_t backup_auth_data[3];
 
@@ -194,7 +194,7 @@ vrrp_in_chk_ipsecah(vrrp_rt * vrrp, char
 
 /* check if ipaddr is present in VIP buffer */
 static int
-vrrp_in_chk_vips(vrrp_rt * vrrp, ip_address *ipaddress, unsigned char *buffer)
+vrrp_in_chk_vips(vrrp_t * vrrp, ip_address_t *ipaddress, unsigned char *buffer)
 {
 	int i;
 	uint32_t ipbuf;
@@ -220,14 +220,14 @@ vrrp_in_chk_vips(vrrp_rt * vrrp, ip_addr
  * return 0 if the pkt is valid, != 0 otherwise.
  */
 static int
-vrrp_in_chk(vrrp_rt * vrrp, char *buffer)
+vrrp_in_chk(vrrp_t * vrrp, char *buffer)
 {
 	struct iphdr *ip;
-	int ihl, vrrp_pkt_len;
-	ipsec_ah *ah;
-	vrrp_pkt *hd;
+	int ihl, vrrphdr_len;
+	ipsec_ah_t *ah;
+	vrrphdr_t *hd;
 	unsigned char *vips;
-	ip_address *ipaddress;
+	ip_address_t *ipaddress;
 	element e;
 
 	/* IPv4 related */
@@ -237,14 +237,14 @@ vrrp_in_chk(vrrp_rt * vrrp, char *buffer
 		ihl = ip->ihl << 2;
 
 		if (vrrp->auth_type == VRRP_AUTH_AH) {
-			ah = (ipsec_ah *) (buffer + ihl);
-			hd = (vrrp_pkt *) (ah + vrrp_ipsecah_len());
+			ah = (ipsec_ah_t *) (buffer + ihl);
+			hd = (vrrphdr_t *) (ah + vrrp_ipsecah_len());
 		} else {
-			hd = (vrrp_pkt *) (buffer + ihl);
+			hd = (vrrphdr_t *) (buffer + ihl);
 		}
 	
 		/* pointer to vrrp vips pkt zone */
-		vips = (unsigned char *) ((char *) hd + sizeof (vrrp_pkt));
+		vips = (unsigned char *) ((char *) hd + sizeof(vrrphdr_t));
 	
 		/* MUST verify that the IP TTL is 255 */
 		if (ip->ttl != VRRP_IP_TTL) {
@@ -257,10 +257,10 @@ vrrp_in_chk(vrrp_rt * vrrp, char *buffer
 		 * MUST verify that the received packet length is greater than or
 		 * equal to the VRRP header
 		 */
-		if ((ntohs(ip->tot_len) - ihl) <= sizeof (vrrp_pkt)) {
+		if ((ntohs(ip->tot_len) - ihl) <= sizeof(vrrphdr_t)) {
 			log_message(LOG_INFO,
 			       "ip payload too short. %d and expect at least %d",
-			       ntohs(ip->tot_len) - ihl, sizeof (vrrp_pkt));
+			       ntohs(ip->tot_len) - ihl, sizeof(vrrphdr_t));
 			return VRRP_PACKET_KO;
 		}
 
@@ -304,12 +304,12 @@ vrrp_in_chk(vrrp_rt * vrrp, char *buffer
 			return (vrrp_in_chk_ipsecah(vrrp, buffer));
 
 		/* Set expected vrrp packet lenght */
-		vrrp_pkt_len = sizeof(vrrp_pkt) + VRRP_AUTH_LEN + hd->naddr * sizeof(uint32_t);
+		vrrphdr_len = sizeof(vrrphdr_t) + VRRP_AUTH_LEN + hd->naddr * sizeof(uint32_t);
 
 	} else if (vrrp->family == AF_INET6) { /* IPv6 related */
 
-		hd = (vrrp_pkt *) buffer;
-		vrrp_pkt_len = sizeof(vrrp_pkt);
+		hd = (vrrphdr_t *) buffer;
+		vrrphdr_len = sizeof(vrrphdr_t);
 
 	} else {
 		return VRRP_PACKET_KO;
@@ -323,7 +323,7 @@ vrrp_in_chk(vrrp_rt * vrrp, char *buffer
 	}
 
 	/* MUST verify the VRRP checksum */
-	if (in_csum((u_short *) hd, vrrp_pkt_len, 0)) {
+	if (in_csum((u_short *) hd, vrrphdr_len, 0)) {
 		log_message(LOG_INFO, "Invalid vrrp checksum");
 		return VRRP_PACKET_KO;
 	}
@@ -338,7 +338,7 @@ vrrp_in_chk(vrrp_rt * vrrp, char *buffer
 		return VRRP_PACKET_KO;
 	}
 
-	/* MUST verify that the VRID is valid on the receiving interface */
+	/* MUST verify that the VRID is valid on the receiving interface_t */
 	if (vrrp->vrid != hd->vrid) {
 		log_message(LOG_INFO,
 		       "received VRID mismatch. Received %d, Expected %d",
@@ -367,7 +367,7 @@ vrrp_in_chk(vrrp_rt * vrrp, char *buffer
 
 /* build IP header */
 static void
-vrrp_build_ip(vrrp_rt * vrrp, char *buffer, int buflen)
+vrrp_build_ip(vrrp_t * vrrp, char *buffer, int buflen)
 {
 	struct iphdr *ip = (struct iphdr *) (buffer);
 
@@ -396,12 +396,12 @@ vrrp_build_ip(vrrp_rt * vrrp, char *buff
 
 /* build IPSEC AH header */
 static void
-vrrp_build_ipsecah(vrrp_rt * vrrp, char *buffer, int buflen)
+vrrp_build_ipsecah(vrrp_t * vrrp, char *buffer, int buflen)
 {
 	ICV_mutable_fields *ip_mutable_fields;
 	unsigned char *digest;
 	struct iphdr *ip = (struct iphdr *) (buffer);
-	ipsec_ah *ah = (ipsec_ah *) (buffer + sizeof (struct iphdr));
+	ipsec_ah_t *ah = (ipsec_ah_t *) (buffer + sizeof (struct iphdr));
 
 	/* alloc a temp memory space to stock the ip mutable fields */
 	ip_mutable_fields = (ICV_mutable_fields *) MALLOC(sizeof (ICV_mutable_fields));
@@ -480,13 +480,13 @@ vrrp_build_ipsecah(vrrp_rt * vrrp, char
 
 /* build VRRP header */
 static int
-vrrp_build_vrrp(vrrp_rt * vrrp, int prio, char *buffer)
+vrrp_build_vrrp(vrrp_t * vrrp, int prio, char *buffer)
 {
 	int i = 0;
-	vrrp_pkt *hd = (vrrp_pkt *) buffer;
+	vrrphdr_t *hd = (vrrphdr_t *) buffer;
 	uint32_t *iparr;
 	element e;
-	ip_address *ip_addr;
+	ip_address_t *ip_addr;
 
 	/* Family independant */
 	hd->vers_type = (VRRP_VERSION << 4) | VRRP_PKT_ADVERT;
@@ -526,7 +526,7 @@ vrrp_build_vrrp(vrrp_rt * vrrp, int prio
 
 /* build VRRP packet */
 static void
-vrrp_build_pkt(vrrp_rt * vrrp, int prio)
+vrrp_build_pkt(vrrp_t * vrrp, int prio)
 {
 	char *bufptr;
 	int len;
@@ -566,7 +566,7 @@ vrrp_build_pkt(vrrp_rt * vrrp, int prio)
 
 /* send VRRP packet */
 static int
-vrrp_send_pkt(vrrp_rt * vrrp)
+vrrp_send_pkt(vrrp_t * vrrp)
 {
 	struct sockaddr_in6 dst6;
 	struct sockaddr_in dst4;
@@ -605,7 +605,7 @@ vrrp_send_pkt(vrrp_rt * vrrp)
 
 /* Allocate the sending buffer */
 static void
-vrrp_alloc_send_buffer(vrrp_rt * vrrp)
+vrrp_alloc_send_buffer(vrrp_t * vrrp)
 {
 	vrrp->send_buffer_size = vrrp_hd_len(vrrp);
 
@@ -620,7 +620,7 @@ vrrp_alloc_send_buffer(vrrp_rt * vrrp)
 
 /* send VRRP advertissement */
 int
-vrrp_send_adv(vrrp_rt * vrrp, int prio)
+vrrp_send_adv(vrrp_t * vrrp, int prio)
 {
 	/* alloc send buffer */
 	if (!vrrp->send_buffer)
@@ -637,7 +637,7 @@ vrrp_send_adv(vrrp_rt * vrrp, int prio)
 
 /* Received packet processing */
 int
-vrrp_check_packet(vrrp_rt * vrrp, char *buf, int buflen)
+vrrp_check_packet(vrrp_t * vrrp, char *buf, int buflen)
 {
 	int ret;
 
@@ -660,7 +660,7 @@ vrrp_check_packet(vrrp_rt * vrrp, char *
 
 /* Gratuitous ARP on each VIP */
 static void
-vrrp_send_update(vrrp_rt * vrrp, ip_address * ipaddress, int idx)
+vrrp_send_update(vrrp_t * vrrp, ip_address_t * ipaddress, int idx)
 {
 	char *msg;
 	char addr_str[41];
@@ -682,10 +682,10 @@ vrrp_send_update(vrrp_rt * vrrp, ip_addr
 }
 
 void
-vrrp_send_link_update(vrrp_rt * vrrp)
+vrrp_send_link_update(vrrp_t * vrrp)
 {
 	int j;
-	ip_address *ipaddress;
+	ip_address_t *ipaddress;
 	element e;
 
 	/* Only send gratuitous ARP if VIP are set */
@@ -712,7 +712,7 @@ vrrp_send_link_update(vrrp_rt * vrrp)
 
 /* becoming master */
 void
-vrrp_state_become_master(vrrp_rt * vrrp)
+vrrp_state_become_master(vrrp_t * vrrp)
 {
 	/* add the ip addresses */
 	if (!LIST_ISEMPTY(vrrp->vip))
@@ -743,7 +743,7 @@ vrrp_state_become_master(vrrp_rt * vrrp)
 }
 
 void
-vrrp_state_goto_master(vrrp_rt * vrrp)
+vrrp_state_goto_master(vrrp_t * vrrp)
 {
 	/*
 	 * Send an advertisement. To force a new master
@@ -760,7 +760,7 @@ vrrp_state_goto_master(vrrp_rt * vrrp)
 
 /* leaving master state */
 void
-vrrp_restore_interface(vrrp_rt * vrrp, int advF)
+vrrp_restore_interface(vrrp_t * vrrp, int advF)
 {
         /* if we stop vrrp, warn the other routers to speed up the recovery */
 	if (advF) {
@@ -792,7 +792,7 @@ vrrp_restore_interface(vrrp_rt * vrrp, i
 }
 
 void
-vrrp_state_leave_master(vrrp_rt * vrrp)
+vrrp_state_leave_master(vrrp_t * vrrp)
 {
 	if (VRRP_VIP_ISSET(vrrp)) {
 #ifdef _HAVE_IPVS_SYNCD_
@@ -830,9 +830,9 @@ vrrp_state_leave_master(vrrp_rt * vrrp)
 
 /* BACKUP state processing */
 void
-vrrp_state_backup(vrrp_rt * vrrp, char *buf, int buflen)
+vrrp_state_backup(vrrp_t * vrrp, char *buf, int buflen)
 {
-	vrrp_pkt *hd;
+	vrrphdr_t *hd;
 	uint32_t saddr;
 	int ret = 0, proto;
 
@@ -859,7 +859,7 @@ vrrp_state_backup(vrrp_rt * vrrp, char *
 
 /* MASTER state processing */
 int
-vrrp_state_master_tx(vrrp_rt * vrrp, const int prio)
+vrrp_state_master_tx(vrrp_t * vrrp, const int prio)
 {
 	int ret = 0;
 
@@ -877,12 +877,12 @@ vrrp_state_master_tx(vrrp_rt * vrrp, con
 }
 
 int
-vrrp_state_master_rx(vrrp_rt * vrrp, char *buf, int buflen)
+vrrp_state_master_rx(vrrp_t * vrrp, char *buf, int buflen)
 {
-	vrrp_pkt *hd = NULL;
+	vrrphdr_t *hd = NULL;
 	int ret = 0, proto = 0;
 	uint32_t saddr = 0;
-	ipsec_ah *ah;
+	ipsec_ah_t *ah;
 
 	/* return on link failure */
 	if (vrrp->wantstate == VRRP_STATE_GOTO_FAULT) {
@@ -907,7 +907,7 @@ vrrp_state_master_rx(vrrp_rt * vrrp, cha
 		log_message(LOG_INFO, "VRRP_Instance(%s) Received lower prio advert"
 				      ", forcing new election", vrrp->iname);
 		if (proto == IPPROTO_IPSEC_AH) {
-			ah = (ipsec_ah *) (buf + sizeof(struct iphdr));
+			ah = (ipsec_ah_t *) (buf + sizeof(struct iphdr));
 			log_message(LOG_INFO, "VRRP_Instance(%s) IPSEC-AH : Syncing seq_num"
 					      " - Increment seq"
 					    , vrrp->iname);
@@ -927,7 +927,7 @@ vrrp_state_master_rx(vrrp_rt * vrrp, cha
 			log_message(LOG_INFO, "VRRP_Instance(%s) Received higher prio advert"
 					    , vrrp->iname);
 			if (proto == IPPROTO_IPSEC_AH) {
-				ah = (ipsec_ah *) (buf + sizeof(struct iphdr));
+				ah = (ipsec_ah_t *) (buf + sizeof(struct iphdr));
 				log_message(LOG_INFO, "VRRP_Instance(%s) IPSEC-AH : Syncing seq_num"
 						      " - Decrement seq"
 						    , vrrp->iname);
@@ -955,9 +955,9 @@ vrrp_state_master_rx(vrrp_rt * vrrp, cha
 }
 
 int
-vrrp_state_fault_rx(vrrp_rt * vrrp, char *buf, int buflen)
+vrrp_state_fault_rx(vrrp_t * vrrp, char *buf, int buflen)
 {
-	vrrp_pkt *hd;
+	vrrphdr_t *hd;
 	uint32_t saddr;
 	int ret = 0, proto;
 
@@ -980,7 +980,7 @@ vrrp_state_fault_rx(vrrp_rt * vrrp, char
 
 /* check for minimum configuration requirements */
 static int
-chk_min_cfg(vrrp_rt * vrrp)
+chk_min_cfg(vrrp_t * vrrp)
 {
 	if (vrrp->vrid == 0) {
 		log_message(LOG_INFO, "VRRP_Instance(%s) the virtual id must be set!",
@@ -1000,10 +1000,10 @@ chk_min_cfg(vrrp_rt * vrrp)
 int
 open_vrrp_send_socket(sa_family_t family, int proto, int idx)
 {
-	interface *ifp;
+	interface_t *ifp;
 	int fd = -1;
 
-	/* Retreive interface */
+	/* Retreive interface_t */
 	ifp = if_get_by_ifindex(idx);
 
 	/* Create and init socket descriptor */
@@ -1043,10 +1043,10 @@ open_vrrp_send_socket(sa_family_t family
 int
 open_vrrp_socket(sa_family_t family, int proto, int idx)
 {
-	interface *ifp;
+	interface_t *ifp;
 	int fd = -1;
 
-	/* Retreive interface */
+	/* Retreive interface_t */
 	ifp = if_get_by_ifindex(idx);
 
 	/* open the socket */
@@ -1071,14 +1071,14 @@ open_vrrp_socket(sa_family_t family, int
 }
 
 void
-close_vrrp_socket(vrrp_rt * vrrp)
+close_vrrp_socket(vrrp_t * vrrp)
 {
 	if_leave_vrrp_group(vrrp->family, vrrp->fd_in, vrrp->ifp);
 	close(vrrp->fd_out);
 }
 
 int
-new_vrrp_socket(vrrp_rt * vrrp)
+new_vrrp_socket(vrrp_t * vrrp)
 {
 	int old_fd = vrrp->fd_in;
 	int proto;
@@ -1103,7 +1103,7 @@ shutdown_vrrp_instances(void)
 {
 	list l = vrrp_data->vrrp;
 	element e;
-	vrrp_rt *vrrp;
+	vrrp_t *vrrp;
 
 	for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
 		vrrp = ELEMENT_DATA(e);
@@ -1138,7 +1138,7 @@ shutdown_vrrp_instances(void)
 
 /* complete vrrp structure */
 static int
-vrrp_complete_instance(vrrp_rt * vrrp)
+vrrp_complete_instance(vrrp_t * vrrp)
 {
 	vrrp->state = VRRP_STATE_INIT;
 	if (!vrrp->adver_int)
@@ -1154,8 +1154,8 @@ vrrp_complete_init(void)
 {
 	list l;
 	element e;
-	vrrp_rt *vrrp;
-	vrrp_sgroup *sgroup;
+	vrrp_t *vrrp;
+	vrrp_sgroup_t *sgroup;
 
 	/* Complete VRRP instance initialization */
 	l = vrrp_data->vrrp;
@@ -1176,12 +1176,12 @@ vrrp_complete_init(void)
 }
 
 /* Try to find a VRRP instance */
-static vrrp_rt *
-vrrp_exist(vrrp_rt * old_vrrp)
+static vrrp_t *
+vrrp_exist(vrrp_t * old_vrrp)
 {
 	element e;
 	list l = vrrp_data->vrrp;
-	vrrp_rt *vrrp;
+	vrrp_t *vrrp;
 
 	if (LIST_ISEMPTY(l))
 		return NULL;
@@ -1197,9 +1197,9 @@ vrrp_exist(vrrp_rt * old_vrrp)
 
 /* Clear VIP|EVIP not present into the new data */
 static void
-clear_diff_vrrp_vip(vrrp_rt * old_vrrp, int type)
+clear_diff_vrrp_vip(vrrp_t * old_vrrp, int type)
 {
-	vrrp_rt *vrrp = vrrp_exist(old_vrrp);
+	vrrp_t *vrrp = vrrp_exist(old_vrrp);
 	list l = (type == VRRP_VIP_TYPE) ? old_vrrp->vip : old_vrrp->evip;
 	list n = (type == VRRP_VIP_TYPE) ? vrrp->vip : vrrp->evip;
 	clear_diff_address(l, n);
@@ -1207,24 +1207,24 @@ clear_diff_vrrp_vip(vrrp_rt * old_vrrp,
 
 /* Clear virtual routes not present in the new data */
 static void
-clear_diff_vrrp_vroutes(vrrp_rt * old_vrrp)
+clear_diff_vrrp_vroutes(vrrp_t * old_vrrp)
 {
-	vrrp_rt *vrrp = vrrp_exist(old_vrrp);
+	vrrp_t *vrrp = vrrp_exist(old_vrrp);
 	clear_diff_routes(old_vrrp->vroutes, vrrp->vroutes);
 }
 
 /* Keep the state from before reload */
 static void
-reset_vrrp_state(vrrp_rt * old_vrrp)
+reset_vrrp_state(vrrp_t * old_vrrp)
 {
 	/* Keep VRRP state, ipsec AH seq_number */
-	vrrp_rt *vrrp = vrrp_exist(old_vrrp);
+	vrrp_t *vrrp = vrrp_exist(old_vrrp);
 	vrrp->state = old_vrrp->state;
 	vrrp->init_state = old_vrrp->state;
 	vrrp->wantstate = old_vrrp->state;
 	if (!old_vrrp->sync)
 		vrrp->effective_priority = old_vrrp->effective_priority;
-	memcpy(vrrp->ipsecah_counter, old_vrrp->ipsecah_counter, sizeof(seq_counter));
+	memcpy(vrrp->ipsecah_counter, old_vrrp->ipsecah_counter, sizeof(seq_counter_t));
 
 #ifdef _HAVE_IPVS_SYNCD_
 	if (old_vrrp->lvs_syncd_if)
@@ -1257,14 +1257,14 @@ clear_diff_vrrp(void)
 {
 	element e;
 	list l = old_vrrp_data->vrrp;
-	vrrp_rt *vrrp;
+	vrrp_t *vrrp;
 
 	if (LIST_ISEMPTY(l))
 		return;
 
 	for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
 		vrrp = ELEMENT_DATA(e);
-		vrrp_rt *new_vrrp;
+		vrrp_t *new_vrrp;
 
 		/*
 		 * Try to find this vrrp into the new conf data
@@ -1308,7 +1308,7 @@ clear_diff_script(void)
 {
 	element e;
 	list l = old_vrrp_data->vrrp_script;
-	vrrp_script *vscript, *nvscript;
+	vrrp_script_t *vscript, *nvscript;
 
 	if (LIST_ISEMPTY(l))
 		return;
diff -rupN keepalived-1.2.7/keepalived/vrrp/vrrp_arp.c keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_arp.c
--- keepalived-1.2.7/keepalived/vrrp/vrrp_arp.c	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_arp.c	2013-05-24 10:12:36.605167000 +0200
@@ -34,7 +34,7 @@ char *garp_buffer;
 int garp_fd;
 
 /* Send the gratuitous ARP message */
-static int send_arp(ip_address *ipaddress)
+static int send_arp(ip_address_t *ipaddress)
 {
 	struct sockaddr_ll sll;
 	int len;
@@ -47,7 +47,7 @@ static int send_arp(ip_address *ipaddres
 	sll.sll_ifindex = IF_INDEX(ipaddress->ifp);
 
 	/* Send packet */
-	len = sendto(garp_fd, garp_buffer, sizeof(m_arphdr) + ETHER_HDR_LEN
+	len = sendto(garp_fd, garp_buffer, sizeof(arphdr_t) + ETHER_HDR_LEN
 		     , 0, (struct sockaddr *)&sll, sizeof(sll));
 	if (len < 0)
 		log_message(LOG_INFO, "Error sending gratuitous ARP on %s for %s",
@@ -56,10 +56,10 @@ static int send_arp(ip_address *ipaddres
 }
 
 /* Build a gratuitous ARP message over a specific interface */
-int send_gratuitous_arp(ip_address *ipaddress)
+int send_gratuitous_arp(ip_address_t *ipaddress)
 {
 	struct ether_header *eth = (struct ether_header *) garp_buffer;
-	m_arphdr *arph		 = (m_arphdr *) (garp_buffer + ETHER_HDR_LEN);
+	arphdr_t *arph		 = (arphdr_t *) (garp_buffer + ETHER_HDR_LEN);
 	char *hwaddr		 = (char *) IF_HWADDR(ipaddress->ifp);
 	int len;
 
@@ -83,7 +83,7 @@ int send_gratuitous_arp(ip_address *ipad
 	len = send_arp(ipaddress);
 
 	/* Cleanup room for next round */
-	memset(garp_buffer, 0, sizeof(m_arphdr) + ETHER_HDR_LEN);
+	memset(garp_buffer, 0, sizeof(arphdr_t) + ETHER_HDR_LEN);
 	return len;
 }
 
@@ -94,7 +94,7 @@ int send_gratuitous_arp(ip_address *ipad
 void gratuitous_arp_init(void)
 {
 	/* Initalize shared buffer */
-	garp_buffer = (char *)MALLOC(sizeof(m_arphdr) + ETHER_HDR_LEN);
+	garp_buffer = (char *)MALLOC(sizeof(arphdr_t) + ETHER_HDR_LEN);
 
 	/* Create the socket descriptor */
 	garp_fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_RARP));
diff -rupN keepalived-1.2.7/keepalived/vrrp/vrrp_data.c keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_data.c
--- keepalived-1.2.7/keepalived/vrrp/vrrp_data.c	2012-08-29 00:05:12.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_data.c	2013-05-24 10:12:36.608167200 +0200
@@ -30,8 +30,8 @@
 #include "logger.h"
 
 /* global vars */
-vrrp_conf_data *vrrp_data = NULL;
-vrrp_conf_data *old_vrrp_data = NULL;
+vrrp_data_t *vrrp_data = NULL;
+vrrp_data_t *old_vrrp_data = NULL;
 char *vrrp_buffer;
 
 /* Static addresses facility function */
@@ -56,7 +56,7 @@ alloc_sroute(vector_t *strvec)
 static void
 free_vgroup(void *data)
 {
-	vrrp_sgroup *vgroup = data;
+	vrrp_sgroup_t *vgroup = data;
 
 	FREE(vgroup->gname);
 	free_strvec(vgroup->iname);
@@ -70,7 +70,7 @@ free_vgroup(void *data)
 static void
 dump_vgroup(void *data)
 {
-	vrrp_sgroup *vgroup = data;
+	vrrp_sgroup_t *vgroup = data;
 	int i;
 	char *str;
 
@@ -101,7 +101,7 @@ dump_vgroup(void *data)
 static void
 free_vscript(void *data)
 {
-	vrrp_script *vscript = data;
+	vrrp_script_t *vscript = data;
 
 	FREE(vscript->sname);
 	FREE_PTR(vscript->script);
@@ -110,7 +110,7 @@ free_vscript(void *data)
 static void
 dump_vscript(void *data)
 {
-	vrrp_script *vscript = data;
+	vrrp_script_t *vscript = data;
 	char *str;
 
 	log_message(LOG_INFO, " VRRP Script = %s", vscript->sname);
@@ -139,7 +139,7 @@ static void
 free_sock(void *sock_data)
 {
 	sock_t *sock = sock_data;
-	interface *ifp;
+	interface_t *ifp;
 	if (sock->fd_in > 0) {
 		ifp = if_get_by_ifindex(sock->ifindex);
 		if_leave_vrrp_group(sock->family, sock->fd_in, ifp);
@@ -163,7 +163,7 @@ dump_sock(void *sock_data)
 static void
 free_vrrp(void *data)
 {
-	vrrp_rt *vrrp = data;
+	vrrp_t *vrrp = data;
 	element e;
 
 	FREE(vrrp->iname);
@@ -194,7 +194,7 @@ free_vrrp(void *data)
 static void
 dump_vrrp(void *data)
 {
-	vrrp_rt *vrrp = data;
+	vrrp_t *vrrp = data;
 	char auth_data[sizeof(vrrp->auth_data) + 1];
 
 	log_message(LOG_INFO, " VRRP Instance = %s", vrrp->iname);
@@ -278,10 +278,10 @@ void
 alloc_vrrp_sync_group(char *gname)
 {
 	int size = strlen(gname);
-	vrrp_sgroup *new;
+	vrrp_sgroup_t *new;
 
 	/* Allocate new VRRP group structure */
-	new = (vrrp_sgroup *) MALLOC(sizeof (vrrp_sgroup));
+	new = (vrrp_sgroup_t *) MALLOC(sizeof(vrrp_sgroup_t));
 	new->gname = (char *) MALLOC(size + 1);
 	new->state = VRRP_STATE_INIT;
 	memcpy(new->gname, gname, size);
@@ -294,12 +294,12 @@ void
 alloc_vrrp(char *iname)
 {
 	int size = strlen(iname);
-	seq_counter *counter;
-	vrrp_rt *new;
+	seq_counter_t *counter;
+	vrrp_t *new;
 
 	/* Allocate new VRRP structure */
-	new = (vrrp_rt *) MALLOC(sizeof (vrrp_rt));
-	counter = (seq_counter *) MALLOC(sizeof (seq_counter));
+	new = (vrrp_t *) MALLOC(sizeof(vrrp_t));
+	counter = (seq_counter_t *) MALLOC(sizeof(seq_counter_t));
 
 	/* Build the structure */
 	new->ipsecah_counter = counter;
@@ -318,7 +318,7 @@ alloc_vrrp(char *iname)
 void
 alloc_vrrp_track(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 
 	if (LIST_ISEMPTY(vrrp->track_ifp))
 		vrrp->track_ifp = alloc_list(NULL, dump_track);
@@ -328,7 +328,7 @@ alloc_vrrp_track(vector_t *strvec)
 void
 alloc_vrrp_track_script(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 
 	if (LIST_ISEMPTY(vrrp->track_script))
 		vrrp->track_script = alloc_list(NULL, dump_track_script);
@@ -338,7 +338,7 @@ alloc_vrrp_track_script(vector_t *strvec
 void
 alloc_vrrp_vip(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 	if (vrrp->ifp == NULL) {
 		log_message(LOG_ERR, "Configuration error: VRRP definition must belong to an interface");
 	}
@@ -350,7 +350,7 @@ alloc_vrrp_vip(vector_t *strvec)
 void
 alloc_vrrp_evip(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 
 	if (LIST_ISEMPTY(vrrp->evip))
 		vrrp->evip = alloc_list(free_ipaddress, dump_ipaddress);
@@ -360,7 +360,7 @@ alloc_vrrp_evip(vector_t *strvec)
 void
 alloc_vrrp_vroute(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 
 	if (LIST_ISEMPTY(vrrp->vroutes))
 		vrrp->vroutes = alloc_list(free_iproute, dump_iproute);
@@ -371,10 +371,10 @@ void
 alloc_vrrp_script(char *sname)
 {
 	int size = strlen(sname);
-	vrrp_script *new;
+	vrrp_script_t *new;
 
 	/* Allocate new VRRP group structure */
-	new = (vrrp_script *) MALLOC(sizeof (vrrp_script));
+	new = (vrrp_script_t *) MALLOC(sizeof(vrrp_script_t));
 	new->sname = (char *) MALLOC(size + 1);
 	memcpy(new->sname, sname, size + 1);
 	new->interval = VRRP_SCRIPT_DI * TIMER_HZ;
@@ -400,12 +400,12 @@ free_vrrp_buffer(void)
 	FREE(vrrp_buffer);
 }
 
-vrrp_conf_data *
+vrrp_data_t *
 alloc_vrrp_data(void)
 {
-	vrrp_conf_data *new;
+	vrrp_data_t *new;
 
-	new = (vrrp_conf_data *) MALLOC(sizeof (vrrp_conf_data));
+	new = (vrrp_data_t *) MALLOC(sizeof(vrrp_data_t));
 	new->vrrp = alloc_list(free_vrrp, dump_vrrp);
 	new->vrrp_index = alloc_mlist(NULL, NULL, 255+1);
 	new->vrrp_index_fd = alloc_mlist(NULL, NULL, 1024+1);
@@ -417,7 +417,7 @@ alloc_vrrp_data(void)
 }
 
 void
-free_vrrp_data(vrrp_conf_data * data)
+free_vrrp_data(vrrp_data_t * data)
 {
 	free_list(data->static_addresses);
 	free_list(data->static_routes);
@@ -431,13 +431,13 @@ free_vrrp_data(vrrp_conf_data * data)
 }
 
 void
-free_vrrp_sockpool(vrrp_conf_data * data)
+free_vrrp_sockpool(vrrp_data_t * data)
 {
 	free_list(data->vrrp_socket_pool);
 }
 
 void
-dump_vrrp_data(vrrp_conf_data * data)
+dump_vrrp_data(vrrp_data_t * data)
 {
 	if (!LIST_ISEMPTY(data->static_addresses)) {
 		log_message(LOG_INFO, "------< Static Addresses >------");
diff -rupN keepalived-1.2.7/keepalived/vrrp/vrrp_if.c keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_if.c
--- keepalived-1.2.7/keepalived/vrrp/vrrp_if.c	2012-08-17 01:21:28.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_if.c	2013-05-24 10:12:36.609167300 +0200
@@ -62,10 +62,10 @@ static struct ifreq ifr;
 
 /* Helper functions */
 /* Return interface from interface index */
-interface *
+interface_t *
 if_get_by_ifindex(const int ifindex)
 {
-	interface *ifp;
+	interface_t *ifp;
 	element e;
 
 	if (LIST_ISEMPTY(if_queue))
@@ -79,10 +79,10 @@ if_get_by_ifindex(const int ifindex)
 	return NULL;
 }
 
-interface *
+interface_t *
 if_get_by_ifname(const char *ifname)
 {
-	interface *ifp;
+	interface_t *ifp;
 	element e;
 
 	if (LIST_ISEMPTY(if_queue)) {
@@ -238,7 +238,7 @@ if_ethtool_probe(const char *ifname)
 }
 
 void
-if_ioctl_flags(interface * ifp)
+if_ioctl_flags(interface_t * ifp)
 {
 	int fd = socket(AF_INET, SOCK_DGRAM, 0);
 
@@ -264,7 +264,7 @@ free_if(void *data)
 void
 dump_if(void *data)
 {
-	interface *ifp = data;
+	interface_t *ifp = data;
 	char addr_str[41];
 
 	log_message(LOG_INFO, "------< NIC >------");
@@ -319,7 +319,7 @@ init_if_queue(void)
 }
 
 void
-if_add_queue(interface * ifp)
+if_add_queue(interface_t * ifp)
 {
 	list_add(if_queue, ifp);
 }
@@ -327,7 +327,7 @@ if_add_queue(interface * ifp)
 static int
 if_linkbeat_refresh_thread(thread_t * thread)
 {
-	interface *ifp = THREAD_ARG(thread);
+	interface_t *ifp = THREAD_ARG(thread);
 
 	if (IF_MII_SUPPORTED(ifp))
 		ifp->linkbeat = (if_mii_probe(ifp->ifname)) ? 1 : 0;
@@ -350,7 +350,7 @@ if_linkbeat_refresh_thread(thread_t * th
 static void
 init_if_linkbeat(void)
 {
-	interface *ifp;
+	interface_t *ifp;
 	element e;
 	int status;
 
@@ -375,7 +375,7 @@ init_if_linkbeat(void)
 }
 
 int
-if_linkbeat(const interface * ifp)
+if_linkbeat(const interface_t * ifp)
 {
 	if (!global_data->linkbeat_use_polling)
 		return 1;
@@ -416,7 +416,7 @@ init_interface_linkbeat(void)
 }
 
 int
-if_join_vrrp_group(sa_family_t family, int *sd, interface *ifp, int proto)
+if_join_vrrp_group(sa_family_t family, int *sd, interface_t *ifp, int proto)
 {
 	struct ip_mreqn imr;
 	struct ipv6_mreq imr6;
@@ -462,7 +462,7 @@ if_join_vrrp_group(sa_family_t family, i
 }
 
 int
-if_leave_vrrp_group(sa_family_t family, int sd, interface *ifp)
+if_leave_vrrp_group(sa_family_t family, int sd, interface_t *ifp)
 {
 	struct ip_mreqn imr;
 	struct ipv6_mreq imr6;
@@ -506,7 +506,7 @@ if_leave_vrrp_group(sa_family_t family,
 }
 
 int
-if_setsockopt_bindtodevice(int *sd, interface *ifp)
+if_setsockopt_bindtodevice(int *sd, interface_t *ifp)
 {
 	int ret;
 
@@ -601,7 +601,7 @@ if_setsockopt_mcast_hops(sa_family_t fam
 }
 
 int
-if_setsockopt_mcast_if(sa_family_t family, int *sd, interface *ifp)
+if_setsockopt_mcast_if(sa_family_t family, int *sd, interface_t *ifp)
 {
 	int ret;
 	unsigned int ifindex;
diff -rupN keepalived-1.2.7/keepalived/vrrp/vrrp_index.c keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_index.c
--- keepalived-1.2.7/keepalived/vrrp/vrrp_index.c	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_index.c	2013-05-24 10:12:36.611167400 +0200
@@ -29,15 +29,15 @@
 
 /* VRID hash table */
 void
-alloc_vrrp_bucket(vrrp_rt *vrrp)
+alloc_vrrp_bucket(vrrp_t *vrrp)
 {
 	list_add(&vrrp_data->vrrp_index[vrrp->vrid], vrrp);
 }
 
-vrrp_rt *
+vrrp_t *
 vrrp_index_lookup(const int vrid, const int fd)
 {
-	vrrp_rt *vrrp;
+	vrrp_t *vrrp;
 	element e;
 	list l = &vrrp_data->vrrp_index[vrid];
 
@@ -71,22 +71,22 @@ vrrp_index_lookup(const int vrid, const
 
 /* FD hash table */
 void
-alloc_vrrp_fd_bucket(vrrp_rt *vrrp)
+alloc_vrrp_fd_bucket(vrrp_t *vrrp)
 {
 	/* We use a mod key plus 1 */
 	list_add(&vrrp_data->vrrp_index_fd[vrrp->fd_in%1024 + 1], vrrp);
 }
 
 void
-remove_vrrp_fd_bucket(vrrp_rt *vrrp)
+remove_vrrp_fd_bucket(vrrp_t *vrrp)
 {
 	list l = &vrrp_data->vrrp_index_fd[vrrp->fd_in%1024 + 1];
 	list_del(l, vrrp);
 }
 
-void set_vrrp_fd_bucket(int old_fd, vrrp_rt *vrrp)
+void set_vrrp_fd_bucket(int old_fd, vrrp_t *vrrp)
 {
-	vrrp_rt *vrrp_ptr;
+	vrrp_t *vrrp_ptr;
 	element e;
 	list l = &vrrp_data->vrrp_index_fd[old_fd%1024 + 1];
 
diff -rupN keepalived-1.2.7/keepalived/vrrp/vrrp_ipaddress.c keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_ipaddress.c
--- keepalived-1.2.7/keepalived/vrrp/vrrp_ipaddress.c	2012-08-29 00:05:12.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_ipaddress.c	2013-05-24 10:12:36.613167500 +0200
@@ -28,9 +28,9 @@
 #include "memory.h"
 #include "utils.h"
 
-/* Add/Delete IP address to a specific interface */
+/* Add/Delete IP address to a specific interface_t */
 static int
-netlink_ipaddress(ip_address *ipaddress, int cmd)
+netlink_ipaddress(ip_address_t *ipaddress, int cmd)
 {
 	int status = 1;
 	struct {
@@ -71,7 +71,7 @@ netlink_ipaddress(ip_address *ipaddress,
 void
 netlink_iplist(list ip_list, int cmd)
 {
-	ip_address *ipaddr;
+	ip_address_t *ipaddr;
 	element e;
 
 	/* No addresses in this list */
@@ -98,7 +98,7 @@ netlink_iplist(list ip_list, int cmd)
 void
 free_ipaddress(void *if_data)
 {
-	ip_address *ipaddr = if_data;
+	ip_address_t *ipaddr = if_data;
 
 	FREE_PTR(ipaddr->label);
 	FREE(ipaddr);
@@ -106,7 +106,7 @@ free_ipaddress(void *if_data)
 void
 dump_ipaddress(void *if_data)
 {
-	ip_address *ipaddr = if_data;
+	ip_address_t *ipaddr = if_data;
 	char *broadcast = (char *) MALLOC(21);
 	char *addr_str = (char *) MALLOC(41);
 
@@ -131,15 +131,15 @@ dump_ipaddress(void *if_data)
 	FREE(addr_str);
 }
 void
-alloc_ipaddress(list ip_list, vector_t *strvec, interface *ifp)
+alloc_ipaddress(list ip_list, vector_t *strvec, interface_t *ifp)
 {
-	ip_address *new;
-	interface *ifp_local;
+	ip_address_t *new;
+	interface_t *ifp_local;
 	char *str, *p;
 	void *addr;
 	int i = 0, addr_idx =0;
 
-	new = (ip_address *) MALLOC(sizeof(ip_address));
+	new = (ip_address_t *) MALLOC(sizeof(ip_address_t));
 	if (ifp) {
 		new->ifa.ifa_index = IF_INDEX(ifp);
 		new->ifp = ifp;
@@ -220,9 +220,9 @@ alloc_ipaddress(list ip_list, vector_t *
 
 /* Find an address in a list */
 int
-address_exist(list l, ip_address *ipaddress)
+address_exist(list l, ip_address_t *ipaddress)
 {
-	ip_address *ipaddr;
+	ip_address_t *ipaddr;
 	element e;
 
 	for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
@@ -243,7 +243,7 @@ address_exist(list l, ip_address *ipaddr
 void
 clear_diff_address(list l, list n)
 {
-	ip_address *ipaddr;
+	ip_address_t *ipaddr;
 	element e;
 	char *addr_str;
 	void *addr;
diff -rupN keepalived-1.2.7/keepalived/vrrp/vrrp_iproute.c keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_iproute.c
--- keepalived-1.2.7/keepalived/vrrp/vrrp_iproute.c	2012-08-29 00:05:12.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_iproute.c	2013-05-24 10:12:36.614167600 +0200
@@ -31,7 +31,7 @@
 
 /* Add/Delete IP route to/from a specific interface */
 int
-netlink_route_ipv4(ip_route *iproute, int cmd)
+netlink_route_ipv4(ip_route_t *iproute, int cmd)
 {
 	int status = 1;
 	struct {
@@ -98,7 +98,7 @@ netlink_route_ipv4(ip_route *iproute, in
 void
 netlink_rtlist_ipv4(list rt_list, int cmd)
 {
-	ip_route *iproute;
+	ip_route_t *iproute;
 	element e;
 
 	/* No routes to add */
@@ -126,7 +126,7 @@ free_iproute(void *rt_data)
 void
 dump_iproute(void *rt_data)
 {
-	ip_route *route = rt_data;
+	ip_route_t *route = rt_data;
 	char *log_msg = MALLOC(150);
 	char *tmp = MALLOC(30);
 
@@ -176,13 +176,13 @@ dump_iproute(void *rt_data)
 void
 alloc_route(list rt_list, vector_t *strvec)
 {
-	ip_route *new;
+	ip_route_t *new;
 	uint32_t ipaddr = 0;
-	interface *ifp;
+	interface_t *ifp;
 	char *str;
 	int i = 0;
 
-	new = (ip_route *) MALLOC(sizeof(ip_route));
+	new = (ip_route_t *) MALLOC(sizeof(ip_route_t));
 
 	/* FMT parse */
 	while (i < vector_size(strvec)) {
@@ -230,9 +230,9 @@ alloc_route(list rt_list, vector_t *strv
 
 /* Try to find a route in a list */
 int
-route_exist(list l, ip_route *iproute)
+route_exist(list l, ip_route_t *iproute)
 {
-	ip_route *ipr;
+	ip_route_t *ipr;
 	element e;
 
 	for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
@@ -249,7 +249,7 @@ route_exist(list l, ip_route *iproute)
 void
 clear_diff_routes(list l, list n)
 {
-	ip_route *iproute;
+	ip_route_t *iproute;
 	element e;
 
 	/* No route in previous conf */
diff -rupN keepalived-1.2.7/keepalived/vrrp/vrrp_ndisc.c keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_ndisc.c
--- keepalived-1.2.7/keepalived/vrrp/vrrp_ndisc.c	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_ndisc.c	2013-05-24 10:12:36.617167700 +0200
@@ -40,7 +40,7 @@ int ndisc_fd;
  *	Neighbour Advertisement sending routine.
  */
 static int
-ndisc_send_na(ip_address *ipaddress)
+ndisc_send_na(ip_address_t *ipaddress)
 {
 	struct sockaddr_ll sll;
 	int len;
@@ -116,7 +116,7 @@ ndisc_icmp6_cksum(const struct ip6hdr *i
  *	new information quickly.
  */
 int
-ndisc_send_unsolicited_na(ip_address *ipaddress)
+ndisc_send_unsolicited_na(ip_address_t *ipaddress)
 {
 	struct ether_header *eth = (struct ether_header *) ndisc_buffer;
 	struct ip6hdr *ip6h = (struct ip6hdr *) ((char *)eth + ETHER_HDR_LEN);
diff -rupN keepalived-1.2.7/keepalived/vrrp/vrrp_netlink.c keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_netlink.c
--- keepalived-1.2.7/keepalived/vrrp/vrrp_netlink.c	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_netlink.c	2013-05-24 10:12:36.619167800 +0200
@@ -44,12 +44,12 @@
 #include "utils.h"
 
 /* Global vars */
-struct nl_handle nl_kernel;	/* Kernel reflection channel */
-struct nl_handle nl_cmd;	/* Command channel */
+nl_handle_t nl_kernel;	/* Kernel reflection channel */
+nl_handle_t nl_cmd;	/* Command channel */
 
-/* Create a socket to netlink interface */
+/* Create a socket to netlink interface_t */
 int
-netlink_socket(struct nl_handle *nl, unsigned long groups)
+netlink_socket(nl_handle_t *nl, unsigned long groups)
 {
 	socklen_t addr_len;
 	int ret;
@@ -107,7 +107,7 @@ netlink_socket(struct nl_handle *nl, uns
 
 /* Close a netlink socket */
 int
-netlink_close(struct nl_handle *nl)
+netlink_close(nl_handle_t *nl)
 {
 	close(nl->fd);
 	return 0;
@@ -115,7 +115,7 @@ netlink_close(struct nl_handle *nl)
 
 /* Set netlink socket channel as blocking */
 int
-netlink_set_block(struct nl_handle *nl, int *flags)
+netlink_set_block(nl_handle_t *nl, int *flags)
 {
 	if ((*flags = fcntl(nl->fd, F_GETFL, 0)) < 0) {
 		log_message(LOG_INFO, "Netlink: Cannot F_GETFL socket : (%s)",
@@ -133,7 +133,7 @@ netlink_set_block(struct nl_handle *nl,
 
 /* Set netlink socket channel as non-blocking */
 int
-netlink_set_nonblock(struct nl_handle *nl, int *flags)
+netlink_set_nonblock(nl_handle_t *nl, int *flags)
 {
 	*flags |= O_NONBLOCK;
 	if (fcntl(nl->fd, F_SETFL, *flags) < 0) {
@@ -240,7 +240,7 @@ netlink_scope_a2n(char *scope)
 /* Our netlink parser */
 static int
 netlink_parse_info(int (*filter) (struct sockaddr_nl *, struct nlmsghdr *),
-		   struct nl_handle *nl, struct nlmsghdr *n)
+		   nl_handle_t *nl, struct nlmsghdr *n)
 {
 	int status;
 	int ret = 0;
@@ -354,7 +354,7 @@ netlink_talk_filter(struct sockaddr_nl *
 
 /* send message to netlink kernel socket, then receive response */
 int
-netlink_talk(struct nl_handle *nl, struct nlmsghdr *n)
+netlink_talk(nl_handle_t *nl, struct nlmsghdr *n)
 {
 	int status;
 	int ret, flags;
@@ -394,7 +394,7 @@ netlink_talk(struct nl_handle *nl, struc
 
 /* Fetch a specific type information from netlink kernel */
 static int
-netlink_request(struct nl_handle *nl, int family, int type)
+netlink_request(nl_handle_t *nl, int family, int type)
 {
 	int status;
 	struct sockaddr_nl snl;
@@ -430,7 +430,7 @@ netlink_if_link_filter(struct sockaddr_n
 {
 	struct ifinfomsg *ifi;
 	struct rtattr *tb[IFLA_MAX + 1];
-	interface *ifp;
+	interface_t *ifp;
 	int i, len;
 	char *name;
 
@@ -460,7 +460,7 @@ netlink_if_link_filter(struct sockaddr_n
 		return 0;
 
 	/* Fill the interface structure */
-	ifp = (interface *) MALLOC(sizeof (interface));
+	ifp = (interface_t *) MALLOC(sizeof(interface_t));
 	memcpy(ifp->ifname, name, strlen(name));
 	ifp->ifindex = ifi->ifi_index;
 	ifp->flags = ifi->ifi_flags;
@@ -487,7 +487,7 @@ netlink_if_link_filter(struct sockaddr_n
 		}
 	}
 
-	/* Queue this new interface */
+	/* Queue this new interface_t */
 	if_add_queue(ifp);
 	return 0;
 }
@@ -502,7 +502,7 @@ netlink_if_address_filter(struct sockadd
 {
 	struct ifaddrmsg *ifa;
 	struct rtattr *tb[IFA_MAX + 1];
-	interface *ifp;
+	interface_t *ifp;
 	int len;
 	void *addr;
 
@@ -522,7 +522,7 @@ netlink_if_address_filter(struct sockadd
 	memset(tb, 0, sizeof (tb));
 	parse_rtattr(tb, IFA_MAX, IFA_RTA(ifa), len);
 
-	/* Fetch interface */
+	/* Fetch interface_t */
 	ifp = if_get_by_ifindex(ifa->ifa_index);
 	if (!ifp)
 		return 0;
@@ -558,7 +558,7 @@ netlink_if_address_filter(struct sockadd
 int
 netlink_interface_lookup(void)
 {
-	struct nl_handle nlh;
+	nl_handle_t nlh;
 	int status = 0;
 	int ret, flags;
 
@@ -587,7 +587,7 @@ end_int:
 static int
 netlink_address_lookup(void)
 {
-	struct nl_handle nlh;
+	nl_handle_t nlh;
 	int status = 0;
 	int ret, flags;
 
@@ -625,7 +625,7 @@ netlink_reflect_filter(struct sockaddr_n
 {
 	struct ifinfomsg *ifi;
 	struct rtattr *tb[IFLA_MAX + 1];
-	interface *ifp;
+	interface_t *ifp;
 	int len;
 
 	ifi = NLMSG_DATA(h);
@@ -646,7 +646,7 @@ netlink_reflect_filter(struct sockaddr_n
 	if (ifi->ifi_type == ARPHRD_LOOPBACK)
 		return 0;
 
-	/* find the interface */
+	/* find the interface_t */
 	ifp = if_get_by_ifindex(ifi->ifi_index);
 	if (!ifp)
 		return -1;
diff -rupN keepalived-1.2.7/keepalived/vrrp/vrrp_notify.c keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_notify.c
--- keepalived-1.2.7/keepalived/vrrp/vrrp_notify.c	2012-08-13 20:50:25.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_notify.c	2013-05-24 10:12:36.620167900 +0200
@@ -30,7 +30,7 @@
 #include "logger.h"
 
 static char *
-get_iscript(vrrp_rt * vrrp, int state)
+get_iscript(vrrp_t * vrrp, int state)
 {
 	if (!vrrp->notify_exec)
 		return NULL;
@@ -44,13 +44,13 @@ get_iscript(vrrp_rt * vrrp, int state)
 }
 
 static char *
-get_igscript(vrrp_rt * vrrp)
+get_igscript(vrrp_t * vrrp)
 {
 	return vrrp->script;
 }
 
 static char *
-get_gscript(vrrp_sgroup * vgroup, int state)
+get_gscript(vrrp_sgroup_t * vgroup, int state)
 {
 	if (!vgroup->notify_exec)
 		return NULL;
@@ -64,7 +64,7 @@ get_gscript(vrrp_sgroup * vgroup, int st
 }
 
 static char *
-get_ggscript(vrrp_sgroup * vgroup)
+get_ggscript(vrrp_sgroup_t * vgroup)
 {
 	return vgroup->script;
 }
@@ -166,7 +166,7 @@ notify_script_exec(char* script, char *t
 }
 
 int
-notify_instance_exec(vrrp_rt * vrrp, int state)
+notify_instance_exec(vrrp_t * vrrp, int state)
 {
 	char *script = get_iscript(vrrp, state);
 	char *gscript = get_igscript(vrrp);
@@ -189,7 +189,7 @@ notify_instance_exec(vrrp_rt * vrrp, int
 }
 
 int
-notify_group_exec(vrrp_sgroup * vgroup, int state)
+notify_group_exec(vrrp_sgroup_t * vgroup, int state)
 {
 	char *script = get_gscript(vgroup, state);
 	char *gscript = get_ggscript(vgroup);
diff -rupN keepalived-1.2.7/keepalived/vrrp/vrrp_parser.c keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_parser.c
--- keepalived-1.2.7/keepalived/vrrp/vrrp_parser.c	2012-08-29 00:05:12.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_parser.c	2013-05-24 10:12:36.622168000 +0200
@@ -58,47 +58,47 @@ vrrp_sync_group_handler(vector_t *strvec
 static void
 vrrp_group_handler(vector_t *strvec)
 {
-	vrrp_sgroup *vgroup = LIST_TAIL_DATA(vrrp_data->vrrp_sync_group);
+	vrrp_sgroup_t *vgroup = LIST_TAIL_DATA(vrrp_data->vrrp_sync_group);
 	vgroup->iname = read_value_block();
 }
 static void
 vrrp_gnotify_backup_handler(vector_t *strvec)
 {
-	vrrp_sgroup *vgroup = LIST_TAIL_DATA(vrrp_data->vrrp_sync_group);
+	vrrp_sgroup_t *vgroup = LIST_TAIL_DATA(vrrp_data->vrrp_sync_group);
 	vgroup->script_backup = set_value(strvec);
 	vgroup->notify_exec = 1;
 }
 static void
 vrrp_gnotify_master_handler(vector_t *strvec)
 {
-	vrrp_sgroup *vgroup = LIST_TAIL_DATA(vrrp_data->vrrp_sync_group);
+	vrrp_sgroup_t *vgroup = LIST_TAIL_DATA(vrrp_data->vrrp_sync_group);
 	vgroup->script_master = set_value(strvec);
 	vgroup->notify_exec = 1;
 }
 static void
 vrrp_gnotify_fault_handler(vector_t *strvec)
 {
-	vrrp_sgroup *vgroup = LIST_TAIL_DATA(vrrp_data->vrrp_sync_group);
+	vrrp_sgroup_t *vgroup = LIST_TAIL_DATA(vrrp_data->vrrp_sync_group);
 	vgroup->script_fault = set_value(strvec);
 	vgroup->notify_exec = 1;
 }
 static void
 vrrp_gnotify_handler(vector_t *strvec)
 {
-	vrrp_sgroup *vgroup = LIST_TAIL_DATA(vrrp_data->vrrp_sync_group);
+	vrrp_sgroup_t *vgroup = LIST_TAIL_DATA(vrrp_data->vrrp_sync_group);
 	vgroup->script = set_value(strvec);
 	vgroup->notify_exec = 1;
 }
 static void
 vrrp_gsmtp_handler(vector_t *strvec)
 {
-	vrrp_sgroup *vgroup = LIST_TAIL_DATA(vrrp_data->vrrp_sync_group);
+	vrrp_sgroup_t *vgroup = LIST_TAIL_DATA(vrrp_data->vrrp_sync_group);
 	vgroup->smtp_alert = 1;
 }
 static void
 vrrp_gglobal_tracking_handler(vector_t *strvec)
 {
-	vrrp_sgroup *vgroup = LIST_TAIL_DATA(vrrp_data->vrrp_sync_group);
+	vrrp_sgroup_t *vgroup = LIST_TAIL_DATA(vrrp_data->vrrp_sync_group);
 	vgroup->global_tracking = 1;
 }
 static void
@@ -109,7 +109,7 @@ vrrp_handler(vector_t *strvec)
 static void
 vrrp_vmac_handler(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 	vrrp->vmac = 1;
 	if (!vrrp->mcast_saddr)
 		vrrp->mcast_saddr  = IF_ADDR(vrrp->ifp);
@@ -131,7 +131,7 @@ vrrp_vmac_handler(vector_t *strvec)
 static void
 vrrp_native_ipv6_handler(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 	vrrp->family = AF_INET6;
 
 	if (vrrp->auth_type != VRRP_AUTH_NONE)
@@ -141,8 +141,8 @@ static void
 vrrp_state_handler(vector_t *strvec)
 {
 	char *str = vector_slot(strvec, 1);
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
-	vrrp_sgroup *vgroup = vrrp->sync;
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_sgroup_t *vgroup = vrrp->sync;
 
 	if (!strcmp(str, "MASTER")) {
 		vrrp->wantstate = VRRP_STATE_MAST;
@@ -156,7 +156,7 @@ vrrp_state_handler(vector_t *strvec)
 static void
 vrrp_int_handler(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 	char *name = vector_slot(strvec, 1);
 	vrrp->ifp = if_get_by_ifname(name);
 	if (vrrp->vmac && !(vrrp->vmac & 2))
@@ -175,19 +175,19 @@ vrrp_track_scr_handler(vector_t *strvec)
 static void
 vrrp_dont_track_handler(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 	vrrp->dont_track_primary = 1;
 }
 static void
 vrrp_mcastip_handler(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 	inet_ston(vector_slot(strvec, 1), &vrrp->mcast_saddr);
 }
 static void
 vrrp_vrid_handler(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 	vrrp->vrid = atoi(vector_slot(strvec, 1));
 
 	if (VRRP_IS_BAD_VID(vrrp->vrid)) {
@@ -208,7 +208,7 @@ vrrp_vrid_handler(vector_t *strvec)
 static void
 vrrp_prio_handler(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 	vrrp->effective_priority = vrrp->base_priority = atoi(vector_slot(strvec, 1));
 
 	if (VRRP_IS_BAD_PRIORITY(vrrp->base_priority)) {
@@ -223,7 +223,7 @@ vrrp_prio_handler(vector_t *strvec)
 static void
 vrrp_adv_handler(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 	vrrp->adver_int = atoi(vector_slot(strvec, 1));
 
 	if (VRRP_IS_BAD_ADVERT_INT(vrrp->adver_int)) {
@@ -238,7 +238,7 @@ vrrp_adv_handler(vector_t *strvec)
 static void
 vrrp_debug_handler(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 	vrrp->debug = atoi(vector_slot(strvec, 1));
 
 	if (VRRP_IS_BAD_DEBUG_INT(vrrp->debug)) {
@@ -250,19 +250,19 @@ vrrp_debug_handler(vector_t *strvec)
 static void
 vrrp_nopreempt_handler(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 	vrrp->nopreempt = 1;
 }
 static void	/* backwards compatibility */
 vrrp_preempt_handler(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 	vrrp->nopreempt = 0;
 }
 static void
 vrrp_preempt_delay_handler(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 	vrrp->preempt_delay = atoi(vector_slot(strvec, 1));
 
 	if (VRRP_IS_BAD_PREEMPT_DELAY(vrrp->preempt_delay)) {
@@ -277,54 +277,54 @@ vrrp_preempt_delay_handler(vector_t *str
 static void
 vrrp_notify_backup_handler(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 	vrrp->script_backup = set_value(strvec);
 	vrrp->notify_exec = 1;
 }
 static void
 vrrp_notify_master_handler(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 	vrrp->script_master = set_value(strvec);
 	vrrp->notify_exec = 1;
 }
 static void
 vrrp_notify_fault_handler(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 	vrrp->script_fault = set_value(strvec);
 	vrrp->notify_exec = 1;
 }
 static void
 vrrp_notify_stop_handler(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 	vrrp->script_stop = set_value(strvec);
 	vrrp->notify_exec = 1;
 }
 static void
 vrrp_notify_handler(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 	vrrp->script = set_value(strvec);
 	vrrp->notify_exec = 1;
 }
 static void
 vrrp_smtp_handler(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 	vrrp->smtp_alert = 1;
 }
 static void
 vrrp_lvs_syncd_handler(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 	vrrp->lvs_syncd_if = set_value(strvec);
 }
 static void
 vrrp_garp_delay_handler(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 	vrrp->garp_delay = atoi(vector_slot(strvec, 1)) * TIMER_HZ;
 	if (vrrp->garp_delay < TIMER_HZ)
 		vrrp->garp_delay = TIMER_HZ;
@@ -332,7 +332,7 @@ vrrp_garp_delay_handler(vector_t *strvec
 static void
 vrrp_auth_type_handler(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 	char *str = vector_slot(strvec, 1);
 
 	if (!strcmp(str, "AH") && vrrp->family == AF_INET)
@@ -343,7 +343,7 @@ vrrp_auth_type_handler(vector_t *strvec)
 static void
 vrrp_auth_pass_handler(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 	char *str = vector_slot(strvec, 1);
 	int max_size = sizeof (vrrp->auth_data);
 	int str_len = strlen(str);
@@ -360,7 +360,7 @@ vrrp_auth_pass_handler(vector_t *strvec)
 static void
 vrrp_vip_handler(vector_t *strvec)
 {
-	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
 	char *buf;
 	char *str = NULL;
 	vector_t *vec = NULL;
@@ -414,13 +414,13 @@ vrrp_script_handler(vector_t *strvec)
 static void
 vrrp_vscript_script_handler(vector_t *strvec)
 {
-	vrrp_script *vscript = LIST_TAIL_DATA(vrrp_data->vrrp_script);
+	vrrp_script_t *vscript = LIST_TAIL_DATA(vrrp_data->vrrp_script);
 	vscript->script = set_value(strvec);
 }
 static void
 vrrp_vscript_interval_handler(vector_t *strvec)
 {
-	vrrp_script *vscript = LIST_TAIL_DATA(vrrp_data->vrrp_script);
+	vrrp_script_t *vscript = LIST_TAIL_DATA(vrrp_data->vrrp_script);
 	vscript->interval = atoi(vector_slot(strvec, 1)) * TIMER_HZ;
 	if (vscript->interval < TIMER_HZ)
 		vscript->interval = TIMER_HZ;
@@ -428,7 +428,7 @@ vrrp_vscript_interval_handler(vector_t *
 static void
 vrrp_vscript_timeout_handler(vector_t *strvec)
 {
-	vrrp_script *vscript = LIST_TAIL_DATA(vrrp_data->vrrp_script);
+	vrrp_script_t *vscript = LIST_TAIL_DATA(vrrp_data->vrrp_script);
 	vscript->timeout = atoi(vector_slot(strvec, 1)) * TIMER_HZ;
 	if (vscript->timeout < TIMER_HZ)
 		vscript->timeout = TIMER_HZ;
@@ -436,13 +436,13 @@ vrrp_vscript_timeout_handler(vector_t *s
 static void
 vrrp_vscript_weight_handler(vector_t *strvec)
 {
-	vrrp_script *vscript = LIST_TAIL_DATA(vrrp_data->vrrp_script);
+	vrrp_script_t *vscript = LIST_TAIL_DATA(vrrp_data->vrrp_script);
 	vscript->weight = atoi(vector_slot(strvec, 1));
 }
 static void
 vrrp_vscript_rise_handler(vector_t *strvec)
 {
-	vrrp_script *vscript = LIST_TAIL_DATA(vrrp_data->vrrp_script);
+	vrrp_script_t *vscript = LIST_TAIL_DATA(vrrp_data->vrrp_script);
 	vscript->rise = atoi(vector_slot(strvec, 1));
 	if (vscript->rise < 1)
 		vscript->rise = 1;
@@ -450,7 +450,7 @@ vrrp_vscript_rise_handler(vector_t *strv
 static void
 vrrp_vscript_fall_handler(vector_t *strvec)
 {
-	vrrp_script *vscript = LIST_TAIL_DATA(vrrp_data->vrrp_script);
+	vrrp_script_t *vscript = LIST_TAIL_DATA(vrrp_data->vrrp_script);
 	vscript->fall = atoi(vector_slot(strvec, 1));
 	if (vscript->fall < 1)
 		vscript->fall = 1;
diff -rupN keepalived-1.2.7/keepalived/vrrp/vrrp_scheduler.c keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_scheduler.c
--- keepalived-1.2.7/keepalived/vrrp/vrrp_scheduler.c	2012-08-29 01:18:29.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_scheduler.c	2013-05-24 10:12:36.624168100 +0200
@@ -65,14 +65,14 @@
  *     |               |<----------------------|               |
  *     +---------------+                       +---------------+
  */
-static void vrrp_backup(vrrp_rt *, char *, int);
-static void vrrp_leave_master(vrrp_rt *, char *, int);
-static void vrrp_leave_fault(vrrp_rt *, char *, int);
-static void vrrp_become_master(vrrp_rt *, char *, int);
-
-static void vrrp_goto_master(vrrp_rt *);
-static void vrrp_master(vrrp_rt *);
-static void vrrp_fault(vrrp_rt *);
+static void vrrp_backup(vrrp_t *, char *, int);
+static void vrrp_leave_master(vrrp_t *, char *, int);
+static void vrrp_leave_fault(vrrp_t *, char *, int);
+static void vrrp_become_master(vrrp_t *, char *, int);
+
+static void vrrp_goto_master(vrrp_t *);
+static void vrrp_master(vrrp_t *);
+static void vrrp_fault(vrrp_t *);
 
 static int vrrp_update_priority(thread_t * thread);
 static int vrrp_script_child_timeout_thread(thread_t * thread);
@@ -80,8 +80,8 @@ static int vrrp_script_child_thread(thre
 static int vrrp_script_thread(thread_t * thread);
 
 struct {
-	void (*read) (vrrp_rt *, char *, int);
-	void (*read_to) (vrrp_rt *);
+	void (*read) (vrrp_t *, char *, int);
+	void (*read_to) (vrrp_t *);
 } VRRP_FSM[VRRP_MAX_FSM_STATE + 1] =
 {
 /*    Stream Read Handlers      |    Stream Read_to handlers   *
@@ -131,7 +131,7 @@ struct {
  *            synced to FAULT state.
  */
 struct {
-	void (*handler) (vrrp_rt *);
+	void (*handler) (vrrp_t *);
 } VRRP_TSM[VRRP_MAX_TSM_STATE + 1][VRRP_MAX_TSM_STATE + 1] =
 {
   { {NULL}, {NULL},                      {NULL},             {NULL}            },
@@ -142,7 +142,7 @@ struct {
 
 /* SMTP alert notifier */
 static void
-vrrp_smtp_notifier(vrrp_rt * vrrp)
+vrrp_smtp_notifier(vrrp_t * vrrp)
 {
 	if (vrrp->smtp_alert) {
 		if (vrrp->state == VRRP_STATE_MAST)
@@ -157,7 +157,7 @@ vrrp_smtp_notifier(vrrp_rt * vrrp)
 }
 
 /* Log interface message */
-static void vrrp_log_int_down(vrrp_rt *vrrp)
+static void vrrp_log_int_down(vrrp_t *vrrp)
 {
 	if (!IF_ISUP(vrrp->ifp))
 		log_message(LOG_INFO, "Kernel is reporting: interface %s DOWN",
@@ -166,7 +166,7 @@ static void vrrp_log_int_down(vrrp_rt *v
 		vrrp_log_tracked_down(vrrp->track_ifp);
 }
 
-static void vrrp_log_int_up(vrrp_rt *vrrp)
+static void vrrp_log_int_up(vrrp_t *vrrp)
 {
 	if (IF_ISUP(vrrp->ifp))
 		log_message(LOG_INFO, "Kernel is reporting: interface %s UP",
@@ -182,8 +182,8 @@ static void vrrp_log_int_up(vrrp_rt *vrr
 static void
 vrrp_init_state(list l)
 {
-	vrrp_rt *vrrp;
-	vrrp_sgroup *vgroup;
+	vrrp_t *vrrp;
+	vrrp_sgroup_t *vgroup;
 	element e;
 
 	for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
@@ -194,8 +194,8 @@ vrrp_init_state(list l)
 		 */
 		if (vrrp->sync && !vrrp->sync->global_tracking) {
 			element e2;
-			tracked_sc *sc;
-			tracked_if *tip;
+			tracked_sc_t *sc;
+			tracked_if_t *tip;
 			int warning = 0;
 
 			if (!LIST_ISEMPTY(vrrp->track_ifp)) {
@@ -279,7 +279,7 @@ vrrp_init_state(list l)
 static void
 vrrp_init_sands(list l)
 {
-	vrrp_rt *vrrp;
+	vrrp_t *vrrp;
 	element e;
 
 	for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
@@ -294,7 +294,7 @@ vrrp_init_sands(list l)
 static void
 vrrp_init_script(list l)
 {
-	vrrp_script *vscript;
+	vrrp_script_t *vscript;
 	element e;
 
 	for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
@@ -316,7 +316,7 @@ vrrp_init_script(list l)
 static timeval_t
 vrrp_compute_timer(const int fd)
 {
-	vrrp_rt *vrrp;
+	vrrp_t *vrrp;
 	element e;
 	list l = &vrrp_data->vrrp_index_fd[fd%1024 + 1];
 	timeval_t timer;
@@ -349,7 +349,7 @@ vrrp_timer_fd(const int fd)
 static int
 vrrp_timer_vrid_timeout(const int fd)
 {
-	vrrp_rt *vrrp;
+	vrrp_t *vrrp;
 	element e;
 	list l = &vrrp_data->vrrp_index_fd[fd%1024 + 1];
 	timeval_t timer;
@@ -439,7 +439,7 @@ alloc_sock(sa_family_t family, list l, i
 static void
 vrrp_create_sockpool(list l)
 {
-	vrrp_rt *vrrp;
+	vrrp_t *vrrp;
 	list p = vrrp_data->vrrp;
 	element e;
 	int ifindex;
@@ -481,7 +481,7 @@ static void
 vrrp_set_fds(list l)
 {
 	sock_t *sock;
-	vrrp_rt *vrrp;
+	vrrp_t *vrrp;
 	list p = vrrp_data->vrrp;
 	element e_sock;
 	element e_vrrp;
@@ -544,22 +544,22 @@ vrrp_dispatcher_init(thread_t * thread)
 }
 
 void
-vrrp_dispatcher_release(vrrp_conf_data *conf_data)
+vrrp_dispatcher_release(vrrp_data_t *data)
 {
-	free_list(conf_data->vrrp_socket_pool);
+	free_list(data->vrrp_socket_pool);
 }
 
 static void
-vrrp_backup(vrrp_rt * vrrp, char *buffer, int len)
+vrrp_backup(vrrp_t * vrrp, char *buffer, int len)
 {
 	struct iphdr *iph;
-	ipsec_ah *ah;
+	ipsec_ah_t *ah;
 
 	if (vrrp->family == AF_INET) {
 		iph = (struct iphdr *) buffer;
 
 		if (iph->protocol == IPPROTO_IPSEC_AH) {
-			ah = (ipsec_ah *) (buffer + sizeof (struct iphdr));
+			ah = (ipsec_ah_t *) (buffer + sizeof (struct iphdr));
 			if (ntohl(ah->seq_number) >= vrrp->ipsecah_counter->seq_number)
 				vrrp->ipsecah_counter->cycle = 0;
 		}
@@ -569,10 +569,10 @@ vrrp_backup(vrrp_rt * vrrp, char *buffer
 }
 
 static void
-vrrp_become_master(vrrp_rt * vrrp, char *buffer, int len)
+vrrp_become_master(vrrp_t * vrrp, char *buffer, int len)
 {
 	struct iphdr *iph;
-	ipsec_ah *ah;
+	ipsec_ah_t *ah;
 
 	if (vrrp->family == AF_INET) {
 		iph = (struct iphdr *) buffer;
@@ -584,7 +584,7 @@ vrrp_become_master(vrrp_rt * vrrp, char
 		if (iph->protocol == IPPROTO_IPSEC_AH) {
 			log_message(LOG_INFO, "VRRP_Instance(%s) IPSEC-AH : seq_num sync",
 			       vrrp->iname);
-			ah = (ipsec_ah *) (buffer + sizeof (struct iphdr));
+			ah = (ipsec_ah_t *) (buffer + sizeof (struct iphdr));
 			vrrp->ipsecah_counter->seq_number = ntohl(ah->seq_number) + 1;
 			vrrp->ipsecah_counter->cycle = 0;
 		}
@@ -596,7 +596,7 @@ vrrp_become_master(vrrp_rt * vrrp, char
 }
 
 static void
-vrrp_leave_master(vrrp_rt * vrrp, char *buffer, int len)
+vrrp_leave_master(vrrp_t * vrrp, char *buffer, int len)
 {
 	if (!VRRP_ISUP(vrrp)) {
 		vrrp_log_int_down(vrrp);
@@ -609,7 +609,7 @@ vrrp_leave_master(vrrp_rt * vrrp, char *
 }
 
 static void
-vrrp_ah_sync(vrrp_rt *vrrp)
+vrrp_ah_sync(vrrp_t *vrrp)
 {
 	/*
 	 * Transition to BACKUP state for AH
@@ -622,7 +622,7 @@ vrrp_ah_sync(vrrp_rt *vrrp)
 }
 
 static void
-vrrp_leave_fault(vrrp_rt * vrrp, char *buffer, int len)
+vrrp_leave_fault(vrrp_t * vrrp, char *buffer, int len)
 {
 	if (!VRRP_ISUP(vrrp))
 		return;
@@ -667,7 +667,7 @@ vrrp_leave_fault(vrrp_rt * vrrp, char *b
 }
 
 static void
-vrrp_goto_master(vrrp_rt * vrrp)
+vrrp_goto_master(vrrp_t * vrrp)
 {
 	if (!VRRP_ISUP(vrrp)) {
 		vrrp_log_int_down(vrrp);
@@ -698,7 +698,7 @@ vrrp_goto_master(vrrp_rt * vrrp)
 int
 vrrp_gratuitous_arp_thread(thread_t * thread)
 {
-	vrrp_rt *vrrp = THREAD_ARG(thread);
+	vrrp_t *vrrp = THREAD_ARG(thread);
 
 	/* Simply broadcast the gratuitous ARP */
 	vrrp_send_link_update(vrrp);
@@ -712,7 +712,7 @@ vrrp_gratuitous_arp_thread(thread_t * th
 static int
 vrrp_update_priority(thread_t * thread)
 {
-	vrrp_rt *vrrp = THREAD_ARG(thread);
+	vrrp_t *vrrp = THREAD_ARG(thread);
 	int prio_offset, new_prio;
 
 	/* compute prio_offset right here */
@@ -746,7 +746,7 @@ vrrp_update_priority(thread_t * thread)
 }
 
 static void
-vrrp_master(vrrp_rt * vrrp)
+vrrp_master(vrrp_t * vrrp)
 {
 	/* Check if interface we are running on is UP */
 	if (vrrp->wantstate != VRRP_STATE_GOTO_FAULT) {
@@ -789,9 +789,9 @@ vrrp_master(vrrp_rt * vrrp)
 }
 
 static void
-vrrp_fault(vrrp_rt * vrrp)
+vrrp_fault(vrrp_t * vrrp)
 {
-	vrrp_sgroup *vgroup = vrrp->sync;
+	vrrp_sgroup_t *vgroup = vrrp->sync;
 
 	if (vgroup) {
 		if (!vrrp_sync_leave_fault(vrrp))
@@ -832,7 +832,7 @@ vrrp_fault(vrrp_rt * vrrp)
 static int
 vrrp_dispatcher_read_to(int fd)
 {
-	vrrp_rt *vrrp;
+	vrrp_t *vrrp;
 	int vrid = 0;
 	int prev_state = 0;
 
@@ -864,8 +864,8 @@ vrrp_dispatcher_read_to(int fd)
 static int
 vrrp_dispatcher_read(sock_t * sock)
 {
-	vrrp_rt *vrrp;
-	vrrp_pkt *hd;
+	vrrp_t *vrrp;
+	vrrphdr_t *hd;
 	int len = 0, prev_state = 0, proto = 0;
 	uint32_t saddr;
 
@@ -937,7 +937,7 @@ vrrp_read_dispatcher_thread(thread_t * t
 static int
 vrrp_script_thread(thread_t * thread)
 {
-	vrrp_script *vscript = THREAD_ARG(thread);
+	vrrp_script_t *vscript = THREAD_ARG(thread);
 	int status, ret;
 	pid_t pid;
 
@@ -990,7 +990,7 @@ static int
 vrrp_script_child_thread(thread_t * thread)
 {
 	int wait_status;
-	vrrp_script *vscript = THREAD_ARG(thread);
+	vrrp_script_t *vscript = THREAD_ARG(thread);
 
 	if (thread->type == THREAD_CHILD_TIMEOUT) {
 		pid_t pid;
diff -rupN keepalived-1.2.7/keepalived/vrrp/vrrp_snmp.c keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_snmp.c
--- keepalived-1.2.7/keepalived/vrrp/vrrp_snmp.c	2012-08-29 00:05:12.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_snmp.c	2013-05-24 10:12:36.626168200 +0200
@@ -45,11 +45,11 @@ vrrp_snmp_script(struct variable *vp, oi
 		 int exact, size_t *var_len, WriteMethod **write_method)
 {
         static unsigned long long_ret;
-	vrrp_script *scr;
+	vrrp_script_t *scr;
 
-	if ((scr = (vrrp_script *)snmp_header_list_table(vp, name, length, exact,
-							 var_len, write_method,
-							 vrrp_data->vrrp_script)) == NULL)
+	if ((scr = (vrrp_script_t *)snmp_header_list_table(vp, name, length, exact,
+							   var_len, write_method,
+							   vrrp_data->vrrp_script)) == NULL)
 		return NULL;
 
 	switch (vp->magic) {
@@ -146,13 +146,13 @@ vrrp_header_ar_table(struct variable *vp
 					continue;
 				}
 			}
-			l2 = ((vrrp_rt*)ELEMENT_DATA(e1))->vip;
+			l2 = ((vrrp_t *) ELEMENT_DATA(e1))->vip;
 			current[1] = 0;
 			nextstate = HEADER_STATE_EXCLUDED_VIRTUAL_ADDRESS;
 			break;
 		case HEADER_STATE_EXCLUDED_VIRTUAL_ADDRESS:
 			/* Try excluded virtual addresses */
-			l2 = ((vrrp_rt*)ELEMENT_DATA(e1))->evip;
+			l2 = ((vrrp_t *)ELEMENT_DATA(e1))->evip;
 			nextstate = HEADER_STATE_VIRTUAL_ADDRESS;
 			break;
 		case HEADER_STATE_STATIC_ROUTE:
@@ -171,7 +171,7 @@ vrrp_header_ar_table(struct variable *vp
 			curinstance++;
 			if (e1 == NULL)
 				e1 = LIST_HEAD(vrrp_data->vrrp);
-			l2 = ((vrrp_rt*)ELEMENT_DATA(e1))->vroutes;
+			l2 = ((vrrp_t *)ELEMENT_DATA(e1))->vroutes;
 			current[1] = 0;
 			nextstate = HEADER_STATE_VIRTUAL_ROUTE;
 			break;
@@ -224,10 +224,10 @@ vrrp_snmp_address(struct variable *vp, o
 		 int exact, size_t *var_len, WriteMethod **write_method)
 {
         static unsigned long long_ret;
-	ip_address *addr;
+	ip_address_t *addr;
 	int state = HEADER_STATE_STATIC_ADDRESS;
 
-	if ((addr = (ip_address *)
+	if ((addr = (ip_address_t *)
 	     vrrp_header_ar_table(vp, name, length, exact,
 				  var_len, write_method,
 				  &state)) == NULL)
@@ -290,10 +290,10 @@ vrrp_snmp_route(struct variable *vp, oid
 		 int exact, size_t *var_len, WriteMethod **write_method)
 {
         static unsigned long long_ret;
-	ip_route *route;
+	ip_route_t *route;
 	int state = HEADER_STATE_STATIC_ROUTE;
 
-	if ((route = (ip_route *)
+	if ((route = (ip_route_t *)
 	     vrrp_header_ar_table(vp, name, length, exact,
 				  var_len, write_method,
 				  &state)) == NULL)
@@ -365,9 +365,9 @@ vrrp_snmp_syncgroup(struct variable *vp,
 		 int exact, size_t *var_len, WriteMethod **write_method)
 {
         static unsigned long long_ret;
-	vrrp_sgroup *group;
+	vrrp_sgroup_t *group;
 
-	if ((group = (vrrp_sgroup *)
+	if ((group = (vrrp_sgroup_t *)
 	     snmp_header_list_table(vp, name, length, exact,
 				    var_len, write_method,
 				    vrrp_data->vrrp_sync_group)) == NULL)
@@ -430,7 +430,7 @@ vrrp_snmp_syncgroupmember(struct variabl
 	int curgroup, curinstance;
 	char *instance, *binstance = NULL;
 	element e;
-	vrrp_sgroup *group;
+	vrrp_sgroup_t *group;
 
         if ((result = snmp_oid_compare(name, *length, vp->name, vp->namelen)) < 0) {
                 memcpy(name, vp->name, sizeof(oid) * vp->namelen);
@@ -497,12 +497,12 @@ vrrp_snmp_syncgroupmember(struct variabl
 	return (u_char*)binstance;
 }
 
-static vrrp_rt*
+static vrrp_t *
 _get_instance(oid *name, size_t name_len)
 {
 	int instance;
 	element e;
-	vrrp_rt *vrrp = NULL;
+	vrrp_t *vrrp = NULL;
 
 	if (name_len < 1) return NULL;
 	instance = name[name_len - 1];
@@ -519,7 +519,7 @@ vrrp_snmp_instance_priority(int action,
 			    u_char *var_val, u_char var_val_type, size_t var_val_len,
 			    u_char *statP, oid *name, size_t name_len)
 {
-	vrrp_rt *vrrp = NULL;
+	vrrp_t *vrrp = NULL;
 	switch (action) {
 	case RESERVE1:
 		/* Check that the proposed priority is acceptable */
@@ -560,7 +560,7 @@ vrrp_snmp_instance_preempt(int action,
 			   u_char *var_val, u_char var_val_type, size_t var_val_len,
 			   u_char *statP, oid *name, size_t name_len)
 {
-	vrrp_rt *vrrp = NULL;
+	vrrp_t *vrrp = NULL;
 	switch (action) {
 	case RESERVE1:
 		/* Check that the proposed value is acceptable */
@@ -608,9 +608,9 @@ vrrp_snmp_instance(struct variable *vp,
 		   int exact, size_t *var_len, WriteMethod **write_method)
 {
         static unsigned long long_ret;
-	vrrp_rt *rt;
+	vrrp_t *rt;
 
-	if ((rt = (vrrp_rt *)snmp_header_list_table(vp, name, length, exact,
+	if ((rt = (vrrp_t *)snmp_header_list_table(vp, name, length, exact,
 						    var_len, write_method,
 						    vrrp_data->vrrp)) == NULL)
 		return NULL;
@@ -734,8 +734,8 @@ vrrp_snmp_trackedinterface(struct variab
         int result, target_len;
 	int curinstance;
 	element e1, e2;
-	vrrp_rt *instance;
-	tracked_if *ifp, *bifp = NULL;
+	vrrp_t *instance;
+	tracked_if_t *ifp, *bifp = NULL;
 
         if ((result = snmp_oid_compare(name, *length, vp->name, vp->namelen)) < 0) {
                 memcpy(name, vp->name, sizeof(oid) * vp->namelen);
@@ -817,8 +817,8 @@ vrrp_snmp_trackedscript(struct variable
         int result, target_len;
 	int curinstance, curscr;
 	element e1, e2;
-	vrrp_rt *instance;
-	tracked_sc *scr, *bscr = NULL;
+	vrrp_t *instance;
+	tracked_sc_t *scr, *bscr = NULL;
 
         if ((result = snmp_oid_compare(name, *length, vp->name, vp->namelen)) < 0) {
                 memcpy(name, vp->name, sizeof(oid) * vp->namelen);
@@ -1054,7 +1054,7 @@ vrrp_snmp_agent_close()
 }
 
 void
-vrrp_snmp_instance_trap(vrrp_rt *vrrp)
+vrrp_snmp_instance_trap(vrrp_t *vrrp)
 {
 	/* OID of the notification */
 	oid notification_oid[] = { VRRP_OID, 9, 0, 2 };
@@ -1122,7 +1122,7 @@ vrrp_snmp_instance_trap(vrrp_rt *vrrp)
 }
 
 void
-vrrp_snmp_group_trap(vrrp_sgroup *group)
+vrrp_snmp_group_trap(vrrp_sgroup_t *group)
 {
 	/* OID of the notification */
 	oid notification_oid[] = { VRRP_OID, 9, 0, 1 };
diff -rupN keepalived-1.2.7/keepalived/vrrp/vrrp_sync.c keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_sync.c
--- keepalived-1.2.7/keepalived/vrrp/vrrp_sync.c	2012-08-29 00:05:12.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_sync.c	2013-05-24 10:12:36.628168400 +0200
@@ -32,7 +32,7 @@
 
 /* Compute the new instance sands */
 void
-vrrp_init_instance_sands(vrrp_rt * vrrp)
+vrrp_init_instance_sands(vrrp_t * vrrp)
 {
 	set_time_now();
 
@@ -50,10 +50,10 @@ vrrp_init_instance_sands(vrrp_rt * vrrp)
 }
 
 /* Instance name lookup */
-vrrp_rt *
+vrrp_t *
 vrrp_get_instance(char *iname)
 {
-	vrrp_rt *vrrp;
+	vrrp_t *vrrp;
 	list l = vrrp_data->vrrp;
 	element e;
 
@@ -67,9 +67,9 @@ vrrp_get_instance(char *iname)
 
 /* Set instances group pointer */
 void
-vrrp_sync_set_group(vrrp_sgroup *vgroup)
+vrrp_sync_set_group(vrrp_sgroup_t *vgroup)
 {
-	vrrp_rt *vrrp;
+	vrrp_t *vrrp;
 	char *str;
 	int i;
 
@@ -87,9 +87,9 @@ vrrp_sync_set_group(vrrp_sgroup *vgroup)
 
 /* All interface are UP in the same group */
 int
-vrrp_sync_group_up(vrrp_sgroup * vgroup)
+vrrp_sync_group_up(vrrp_sgroup_t * vgroup)
 {
-	vrrp_rt *vrrp;
+	vrrp_t *vrrp;
 	element e;
 	list l = vgroup->index_list;
 	int is_up = 0;
@@ -110,7 +110,7 @@ vrrp_sync_group_up(vrrp_sgroup * vgroup)
 
 /* SMTP alert group notifier */
 void
-vrrp_sync_smtp_notifier(vrrp_sgroup *vgroup)
+vrrp_sync_smtp_notifier(vrrp_sgroup_t *vgroup)
 {
 	if (vgroup->smtp_alert) {
 		if (GROUP_STATE(vgroup) == VRRP_STATE_MAST)
@@ -126,9 +126,9 @@ vrrp_sync_smtp_notifier(vrrp_sgroup *vgr
 
 /* Leaving fault state */
 int
-vrrp_sync_leave_fault(vrrp_rt * vrrp)
+vrrp_sync_leave_fault(vrrp_t * vrrp)
 {
-	vrrp_sgroup *vgroup = vrrp->sync;
+	vrrp_sgroup_t *vgroup = vrrp->sync;
 
 	if (vrrp_sync_group_up(vgroup)) {
 		log_message(LOG_INFO, "VRRP_Group(%s) Leaving FAULT state",
@@ -140,10 +140,10 @@ vrrp_sync_leave_fault(vrrp_rt * vrrp)
 
 /* Check transition to master state */
 int
-vrrp_sync_goto_master(vrrp_rt * vrrp)
+vrrp_sync_goto_master(vrrp_t * vrrp)
 {
-	vrrp_rt *isync;
-	vrrp_sgroup *vgroup = vrrp->sync;
+	vrrp_t *isync;
+	vrrp_sgroup_t *vgroup = vrrp->sync;
 	list l = vgroup->index_list;
 	element e;
 
@@ -165,10 +165,10 @@ vrrp_sync_goto_master(vrrp_rt * vrrp)
 }
 
 void
-vrrp_sync_master_election(vrrp_rt * vrrp)
+vrrp_sync_master_election(vrrp_t * vrrp)
 {
-	vrrp_rt *isync;
-	vrrp_sgroup *vgroup = vrrp->sync;
+	vrrp_t *isync;
+	vrrp_sgroup_t *vgroup = vrrp->sync;
 	list l = vgroup->index_list;
 	element e;
 
@@ -195,10 +195,10 @@ vrrp_sync_master_election(vrrp_rt * vrrp
 }
 
 void
-vrrp_sync_backup(vrrp_rt * vrrp)
+vrrp_sync_backup(vrrp_t * vrrp)
 {
-	vrrp_rt *isync;
-	vrrp_sgroup *vgroup = vrrp->sync;
+	vrrp_t *isync;
+	vrrp_sgroup_t *vgroup = vrrp->sync;
 	list l = vgroup->index_list;
 	element e;
 
@@ -226,10 +226,10 @@ vrrp_sync_backup(vrrp_rt * vrrp)
 }
 
 void
-vrrp_sync_master(vrrp_rt * vrrp)
+vrrp_sync_master(vrrp_t * vrrp)
 {
-	vrrp_rt *isync;
-	vrrp_sgroup *vgroup = vrrp->sync;
+	vrrp_t *isync;
+	vrrp_sgroup_t *vgroup = vrrp->sync;
 	list l = vgroup->index_list;
 	element e;
 
@@ -261,10 +261,10 @@ vrrp_sync_master(vrrp_rt * vrrp)
 }
 
 void
-vrrp_sync_fault(vrrp_rt * vrrp)
+vrrp_sync_fault(vrrp_t * vrrp)
 {
-	vrrp_rt *isync;
-	vrrp_sgroup *vgroup = vrrp->sync;
+	vrrp_t *isync;
+	vrrp_sgroup_t *vgroup = vrrp->sync;
 	list l = vgroup->index_list;
 	element e;
 
diff -rupN keepalived-1.2.7/keepalived/vrrp/vrrp_track.c keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_track.c
--- keepalived-1.2.7/keepalived/vrrp/vrrp_track.c	2012-08-29 00:05:12.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_track.c	2013-05-24 10:12:36.629168400 +0200
@@ -31,14 +31,14 @@
 void
 dump_track(void *track_data)
 {
-	tracked_if *tip = track_data;
+	tracked_if_t *tip = track_data;
 	log_message(LOG_INFO, "     %s weight %d", IF_NAME(tip->ifp), tip->weight);
 }
 void
 alloc_track(list track_list, vector_t *strvec)
 {
-	interface *ifp = NULL;
-	tracked_if *tip = NULL;
+	interface_t *ifp = NULL;
+	tracked_if_t *tip = NULL;
 	int weight = 0;
 	char *tracked = vector_slot(strvec, 0);
 
@@ -60,18 +60,18 @@ alloc_track(list track_list, vector_t *s
 		}
 	}
 
-	tip         = (tracked_if *) MALLOC(sizeof (tracked_if));
+	tip         = (tracked_if_t *) MALLOC(sizeof(tracked_if_t));
 	tip->ifp    = ifp;
 	tip->weight = weight;
 
 	list_add(track_list, tip);
 }
 
-vrrp_script *
+vrrp_script_t *
 find_script_by_name(char *name)
 {
 	element e;
-	vrrp_script *scr;
+	vrrp_script_t *scr;
 
 	if (LIST_ISEMPTY(vrrp_data->vrrp_script))
 		return NULL;
@@ -88,14 +88,14 @@ find_script_by_name(char *name)
 void
 dump_track_script(void *track_data)
 {
-	tracked_sc *tsc = track_data;
+	tracked_sc_t *tsc = track_data;
 	log_message(LOG_INFO, "     %s weight %d", tsc->scr->sname, tsc->weight);
 }
 void
 alloc_track_script(list track_list, vector_t *strvec)
 {
-	vrrp_script *vsc = NULL;
-	tracked_sc *tsc = NULL;
+	vrrp_script_t *vsc = NULL;
+	tracked_sc_t *tsc = NULL;
 	int weight = 0;
 	char *tracked = vector_slot(strvec, 0);
 
@@ -121,7 +121,7 @@ alloc_track_script(list track_list, vect
 		}
 	}
 
-	tsc         = (tracked_sc *) MALLOC(sizeof (tracked_sc));
+	tsc         = (tracked_sc_t *) MALLOC(sizeof(tracked_sc_t));
 	tsc->scr    = vsc;
 	tsc->weight = weight;
 	vsc->inuse++;
@@ -133,7 +133,7 @@ int
 vrrp_tracked_up(list l)
 {
 	element e;
-	tracked_if *tip;
+	tracked_if_t *tip;
 
 	for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
 		tip = ELEMENT_DATA(e);
@@ -149,7 +149,7 @@ void
 vrrp_log_tracked_down(list l)
 {
 	element e;
-	tracked_if *tip;
+	tracked_if_t *tip;
 
 	for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
 		tip = ELEMENT_DATA(e);
@@ -170,7 +170,7 @@ int
 vrrp_tracked_weight(list l)
 {
 	element e;
-	tracked_if *tip;
+	tracked_if_t *tip;
 	int weight = 0;
 
 	for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
@@ -192,7 +192,7 @@ int
 vrrp_script_up(list l)
 {
 	element e;
-	tracked_sc *tsc;
+	tracked_sc_t *tsc;
 
 	for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
 		tsc = ELEMENT_DATA(e);
@@ -215,7 +215,7 @@ int
 vrrp_script_weight(list l)
 {
 	element e;
-	tracked_sc *tsc;
+	tracked_sc_t *tsc;
 	int weight = 0;
 
 	for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
diff -rupN keepalived-1.2.7/keepalived/vrrp/vrrp_vmac.c keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_vmac.c
--- keepalived-1.2.7/keepalived/vrrp/vrrp_vmac.c	2012-08-17 01:21:28.000000000 +0200
+++ keepalived-1.2.7-unicast/keepalived/vrrp/vrrp_vmac.c	2013-05-24 10:12:36.631168500 +0200
@@ -35,7 +35,7 @@ static const char *ll_kind = "macvlan";
 #ifdef _HAVE_VRRP_VMAC_
 /* Link layer handling */
 static int
-netlink_link_setlladdr(vrrp_rt *vrrp)
+netlink_link_setlladdr(vrrp_t *vrrp)
 {
 	int status = 1;
 	u_char ll_addr[ETH_ALEN] = {0x00, 0x00, 0x5e, 0x00, 0x01, vrrp->vrid};
@@ -64,7 +64,7 @@ netlink_link_setlladdr(vrrp_rt *vrrp)
 }
 
 static int
-netlink_link_setmode(vrrp_rt *vrrp)
+netlink_link_setmode(vrrp_t *vrrp)
 {
 	int status = 1;
 	struct {
@@ -108,7 +108,7 @@ netlink_link_setmode(vrrp_rt *vrrp)
 }
 
 static int
-netlink_link_up(vrrp_rt *vrrp)
+netlink_link_up(vrrp_t *vrrp)
 {
 	int status = 1;
 	struct {
@@ -135,11 +135,11 @@ netlink_link_up(vrrp_rt *vrrp)
 #endif
 
 int
-netlink_link_add_vmac(vrrp_rt *vrrp)
+netlink_link_add_vmac(vrrp_t *vrrp)
 {
 #ifdef _HAVE_VRRP_VMAC_
 	struct rtattr *linkinfo;
-	interface *ifp;
+	interface_t *ifp;
 	char ifname[IFNAMSIZ];
 	struct {
 		struct nlmsghdr n;
@@ -208,7 +208,7 @@ netlink_link_add_vmac(vrrp_rt *vrrp)
 }
 
 int
-netlink_link_del_vmac(vrrp_rt *vrrp)
+netlink_link_del_vmac(vrrp_t *vrrp)
 {
 	int status = 1;
 
diff -rupN keepalived-1.2.7/lib/buffer.c keepalived-1.2.7-unicast/lib/buffer.c
--- keepalived-1.2.7/lib/buffer.c	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/lib/buffer.c	2013-05-24 10:12:36.635168800 +0200
@@ -0,0 +1,428 @@
+/*
+ * Soft:        Keepalived is a failover program for the LVS project
+ *              <www.linuxvirtualserver.org>. It monitor & manipulate
+ *              a loadbalanced server pool using multi-layer checks.
+ *
+ * Part:        Buffer structure manipulation.
+ *		This code is coming from quagga.net.
+ *
+ * Author:      Alexandre Cassen, <acassen@linux-vs.org>
+ *
+ *              This program is distributed in the hope that it will be useful,
+ *              but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *              See the GNU General Public License for more details.
+ *
+ *              This program is free software; you can redistribute it and/or
+ *              modify it under the terms of the GNU General Public License
+ *              as published by the Free Software Foundation; either version
+ *              2 of the License, or (at your option) any later version.
+ *
+ * Copyright (C) 2001-2012 Alexandre Cassen, <acassen@linux-vs.org>
+ */
+#include <stddef.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <errno.h>
+#include <sys/uio.h>
+
+#include "buffer.h"
+#include "memory.h"
+
+/* Create a new buffer. Memory will be allocated in chunks of the given
+ * size.  If the argument is 0, the library will supply a reasonable
+ * default size suitable for buffering socket I/O.
+ */
+buffer_t *
+buffer_new(size_t size)
+{
+	buffer_t *b;
+
+	b = (buffer_t *) MALLOC(sizeof(buffer_t));
+
+	if (size) {
+		b->size = size;
+	} else {
+		static size_t default_size;
+		if (!default_size) {
+			long pgsz = sysconf(_SC_PAGESIZE);
+			default_size = ((((BUFFER_SIZE_DEFAULT-1)/pgsz)+1)*pgsz);
+		}
+		b->size = default_size;
+	}
+
+	return b;
+}
+
+/* Free all data in the buffer. */
+void
+buffer_free(buffer_t *b)
+{
+	buffer_reset(b);
+	FREE(b);
+}
+
+/* Combine all accumulated (and unflushed) data inside the buffer into a
+ * single NUL-terminated string allocated using XMALLOC(MTYPE_TMP).  Note
+ * that this function does not alter the state of the buffer, so the data
+ * is still inside waiting to be flushed.
+ */
+char *
+buffer_getstr(buffer_t *b)
+{
+	size_t totlen = 0;
+	buffer_data_t *data;
+	char *s, *p;
+
+	for (data = b->head; data; data = data->next)
+		totlen += data->cp - data->sp;
+
+	if (!(s = (char *) MALLOC(totlen+1)))
+		return NULL;
+
+	p = s;
+	for (data = b->head; data; data = data->next) {
+		memcpy(p, data->data + data->sp, data->cp - data->sp);
+		p += data->cp - data->sp;
+	}
+	*p = '\0';
+
+	return s;
+}
+
+/* Returns 1 if there is no pending data in the buffer.
+ * Otherwise returns 0.
+ */
+int
+buffer_empty(buffer_t *b)
+{
+	return (b->head == NULL);
+}
+
+/* Clear and free all allocated data. */
+void
+buffer_reset(buffer_t *b)
+{
+	buffer_data_t *data, *next;
+
+	for (data = b->head; data; data = next) {
+		next = data->next;
+		FREE(data);
+	}
+
+	b->head = b->tail = NULL;
+}
+
+/* Add buffer_data to the end of buffer. */
+static buffer_data_t *
+buffer_add(buffer_t *b)
+{
+	buffer_data_t *d;
+
+	d = (buffer_data_t *) MALLOC(offsetof(buffer_data_t, data[b->size]));
+	d->cp = d->sp = 0;
+	d->next = NULL;
+
+	if (b->tail)
+		b->tail->next = d;
+	else
+		b->head = d;
+	b->tail = d;
+
+	return d;
+}
+
+/* Add the given data to the end of the buffer. */
+void
+buffer_put(buffer_t *b, const void *p, size_t size)
+{
+	buffer_data_t *data = b->tail;
+	const char *ptr = p;
+
+	/* We use even last one byte of data buffer. */
+	while (size) {
+		size_t chunk;
+
+		/* If there is no data buffer add it. */
+		if (data == NULL || data->cp == b->size)
+			data = buffer_add(b);
+
+		chunk = ((size <= (b->size - data->cp)) ? size : (b->size - data->cp));
+		memcpy((data->data + data->cp), ptr, chunk);
+		size -= chunk;
+		ptr += chunk;
+		data->cp += chunk;
+	}
+}
+
+/* Add a single character to the end of the buffer. */
+void
+buffer_putc(buffer_t *b, uint8_t c)
+{
+	buffer_put(b, &c, 1);
+}
+
+/* Add a NUL-terminated string to the end of the buffer. */
+void
+buffer_putstr(buffer_t *b, const char *c)
+{
+	buffer_put(b, c, strlen(c));
+}
+
+/* Call buffer_flush_available repeatedly until either all data has been
+ * flushed, or an I/O error has been encountered, or the operation would
+ * block.
+ */
+buffer_status_t
+buffer_flush_all(buffer_t *b, int fd)
+{
+ 	buffer_status_t ret;
+	buffer_data_t *head;
+	size_t head_sp;
+
+	if (!b->head)
+		return BUFFER_EMPTY;
+
+	/* Flush all data. */
+	head_sp = (head = b->head)->sp;
+	while ((ret = buffer_flush_available(b, fd)) == BUFFER_PENDING) {
+		if ((b->head == head) && (head_sp == head->sp) && (errno != EINTR)) {
+			/* No data was flushed, so kernel buffer must be full. */
+			return ret;
+		}
+
+		head_sp = (head = b->head)->sp;
+	}
+
+	return ret;
+}
+
+/* Attempt to write enough data to the given fd to fill a window of the
+ * given width and height (and remove the data written from the buffer).
+ *
+ * If !no_more, then a message saying " --More-- " is appended.
+ * If erase is true, then first overwrite the previous " --More-- " message
+ * with spaces.
+ *
+ * Any write error (including EAGAIN or EINTR) will cause this function
+ * to return -1 (because the logic for handling the erase and more features
+ * is too complicated to retry the write later).
+ */
+buffer_status_t
+buffer_flush_window(buffer_t *b, int fd, int width, int height,
+                    int erase_flag, int no_more_flag)
+{
+	int nbytes = 0, iov_alloc, iov_index, column;
+	struct iovec *iov;
+	struct iovec small_iov[3];
+	char more[] = " --More-- ";
+	char erase[] = { 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+			 ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
+			 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08};
+	buffer_data_t *data;
+
+	if (!b->head)
+		return BUFFER_EMPTY;
+
+	if (height < 1) {
+		height = 1;
+	} else if (height >= 2) {
+		height--;
+	}
+
+	if (width < 1) {
+		width = 1;
+	}
+
+	/* For erase and more data add two to b's buffer_data count.*/
+	if (b->head->next == NULL) {
+		iov_alloc = sizeof(small_iov)/sizeof(small_iov[0]);
+		iov = small_iov;
+	} else {
+		iov_alloc = ((height*(width+2))/b->size)+10;
+		iov = (struct iovec *) MALLOC(iov_alloc*sizeof(*iov));
+	}
+	iov_index = 0;
+
+	/* Previously print out is performed. */
+	if (erase_flag) {
+		iov[iov_index].iov_base = erase;
+		iov[iov_index].iov_len = sizeof erase;
+		iov_index++;
+	}
+
+	/* Output data. */
+	column = 1;  /* Column position of next character displayed. */
+	for (data = b->head; data && (height > 0); data = data->next) {
+		size_t cp;
+
+		cp = data->sp;
+		while ((cp < data->cp) && (height > 0)) {
+			/* Calculate lines remaining and column position after displaying
+			 * this character. */
+			if (data->data[cp] == '\r') {
+				column = 1;
+			} else if ((data->data[cp] == '\n') || (column == width)) {
+				column = 1;
+				height--;
+			} else {
+				column++;
+			}
+			cp++;
+		}
+
+		iov[iov_index].iov_base = (char *)(data->data + data->sp);
+		iov[iov_index++].iov_len = cp-data->sp;
+		data->sp = cp;
+
+        	/* This should not ordinarily happen. */
+		if (iov_index == iov_alloc) {
+			iov_alloc *= 2;
+			if (iov != small_iov) {
+				iov = REALLOC(iov, iov_alloc*sizeof(*iov));
+			} else {
+				/* This should absolutely never occur. */
+				iov = MALLOC(iov_alloc*sizeof(*iov));
+				memcpy(iov, small_iov, sizeof(small_iov));
+			}
+		}
+	}
+
+	/* In case of `more' display need. */
+	if (b->tail && (b->tail->sp < b->tail->cp) && !no_more_flag) {
+		iov[iov_index].iov_base = more;
+		iov[iov_index].iov_len = sizeof more;
+		iov_index++;
+	}
+
+
+#ifdef IOV_MAX
+	/* IOV_MAX are normally defined in <sys/uio.h> , Posix.1g.
+	 * example: Solaris2.6 are defined IOV_MAX size at 16.
+	 */
+	{
+		struct iovec *c_iov = iov;
+
+		while (iov_index > 0) {
+			int iov_size;
+
+			iov_size = ((iov_index > IOV_MAX) ? IOV_MAX : iov_index);
+			if ((nbytes = writev(fd, c_iov, iov_size)) < 0) {
+				break;
+			}
+
+			/* move pointer io-vector */
+			c_iov += iov_size;
+			iov_index -= iov_size;
+		}
+	}
+#endif /* IOV_MAX */
+
+	/* Free printed buffer data. */
+	while (b->head && (b->head->sp == b->head->cp)) {
+		buffer_data_t *del;
+		if (!(b->head = (del = b->head)->next))
+			b->tail = NULL;
+		FREE(del);
+	}
+
+	if (iov != small_iov)
+		FREE(iov);
+
+	return (nbytes < 0) ? BUFFER_ERROR :
+			      (b->head ? BUFFER_PENDING : BUFFER_EMPTY);
+}
+
+/* This function (unlike other buffer_flush* functions above) is designed
+ * to work with non-blocking sockets.  It does not attempt to write out
+ * all of the queued data, just a "big" chunk.  It returns 0 if it was
+ * able to empty out the buffers completely, 1 if more flushing is
+ * required later, or -1 on a fatal write error.
+ */
+buffer_status_t
+buffer_flush_available(buffer_t *b, int fd)
+{
+/* These are just reasonable values to make sure a significant amount of
+ * data is written.  There's no need to go crazy and try to write it all
+ * in one shot. */
+#ifdef IOV_MAX
+#define MAX_CHUNKS ((IOV_MAX >= 16) ? 16 : IOV_MAX)
+#else
+#define MAX_CHUNKS 16
+#endif
+#define MAX_FLUSH 131072
+
+	buffer_data_t *d;
+	size_t written;
+	struct iovec iov[MAX_CHUNKS];
+	size_t iovcnt = 0, nbytes = 0;
+
+	for (d = b->head; d && (iovcnt < MAX_CHUNKS) && (nbytes < MAX_FLUSH);
+	     d = d->next, iovcnt++) {
+		iov[iovcnt].iov_base = d->data+d->sp;
+		nbytes += (iov[iovcnt].iov_len = d->cp-d->sp);
+	}
+
+	/* No data to flush: should we issue a warning message? */
+	if (!nbytes)
+		return BUFFER_EMPTY;
+
+	/* only place where written should be sign compared */
+	if ((ssize_t)(written = writev(fd,iov,iovcnt)) < 0) {
+		/* Calling code should try again later. */
+		if (ERRNO_IO_RETRY(errno))
+			return BUFFER_PENDING;
+		return BUFFER_ERROR;
+	}
+
+	/* Free printed buffer data. */
+	while (written > 0) {
+		buffer_data_t *d;
+		if (!(d = b->head))
+			break;
+		if (written < d->cp-d->sp) {
+			d->sp += written;
+			return BUFFER_PENDING;
+		}
+
+		written -= (d->cp-d->sp);
+		if (!(b->head = d->next))
+			b->tail = NULL;
+		FREE(d);
+	}
+
+	return b->head ? BUFFER_PENDING : BUFFER_EMPTY;
+
+#undef MAX_CHUNKS
+#undef MAX_FLUSH
+}
+
+/* Try to write this data to the file descriptor.
+ * Any data that cannot be written immediately is added to
+ * the buffer queue.
+ */
+buffer_status_t
+buffer_write(buffer_t *b, int fd, const void *p, size_t size)
+{
+	ssize_t nbytes;
+	size_t written;
+
+	/* Buffer is not empty, so do not attempt to write the new data. */
+	if (b->head) {
+		nbytes = 0;
+	} else if ((nbytes = write(fd, p, size)) < 0) {
+		if (ERRNO_IO_RETRY(errno)) {
+			nbytes = 0;
+		} else {
+			return BUFFER_ERROR;
+		}
+	}
+
+	/* Add any remaining data to the buffer. */
+	written = nbytes;
+	if (written < size) {
+		buffer_put(b, ((const char *)p)+written, size-written);
+	}
+
+	return b->head ? BUFFER_PENDING : BUFFER_EMPTY;
+}
diff -rupN keepalived-1.2.7/lib/buffer.h keepalived-1.2.7-unicast/lib/buffer.h
--- keepalived-1.2.7/lib/buffer.h	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/lib/buffer.h	2013-05-24 10:12:36.636168800 +0200
@@ -0,0 +1,84 @@
+/*
+ * Soft:        Keepalived is a failover program for the LVS project
+ *              <www.linuxvirtualserver.org>. It monitor & manipulate
+ *              a loadbalanced server pool using multi-layer checks.
+ *
+ * Part:        buffer.c include file.
+ *
+ * Author:      Alexandre Cassen, <acassen@linux-vs.org>
+ *
+ *              This program is distributed in the hope that it will be useful,
+ *              but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *              See the GNU General Public License for more details.
+ *
+ *              This program is free software; you can redistribute it and/or
+ *              modify it under the terms of the GNU General Public License
+ *              as published by the Free Software Foundation; either version
+ *              2 of the License, or (at your option) any later version.
+ *
+ * Copyright (C) 2001-2012 Alexandre Cassen, <acassen@linux-vs.org>
+ */
+
+#ifndef _BUFFER_H
+#define _BUFFER_H
+
+/* buffer definition */
+typedef struct _buffer_data {
+	struct _buffer_data	*next;
+
+	size_t			cp;	/* Location to add new data. */
+	size_t			sp;	/* Pointer to data not yet flushed. */
+	unsigned char		data[];	/* Actual data stream (variable length).
+					 * real dimension is buffer->size.
+					 */
+} buffer_data_t;
+
+typedef struct _buffer {
+	buffer_data_t		*head;
+	buffer_data_t		*tail;
+
+	size_t			size;	/* Size of each buffer_data chunk. */
+} buffer_t;
+
+typedef enum _buffer_status {
+	BUFFER_ERROR = -1,		/* An I/O error occurred.
+					 * The buffer should be destroyed and the
+					 * file descriptor should be closed.
+					 */
+	BUFFER_EMPTY = 0,		/* The data was written successfully,
+					 * and the buffer is now empty (there is
+					 * no pending data waiting to be flushed).
+					 */
+	BUFFER_PENDING = 1		/* There is pending data in the buffer
+					 * waiting to be flushed. Please try
+					 * flushing the buffer when select
+					 * indicates that the file descriptor
+					 * is writeable.
+					 */
+} buffer_status_t;
+
+/* Some defines */
+#define BUFFER_SIZE_DEFAULT	4096
+
+/* Some usefull macros */
+#define ERRNO_IO_RETRY(EN) \
+	(((EN) == EAGAIN) || ((EN) == EWOULDBLOCK) || ((EN) == EINTR))
+
+/* Prototypes */
+extern buffer_t *buffer_new(size_t);
+extern void buffer_reset(buffer_t *);
+extern void buffer_free(buffer_t *);
+extern void buffer_put(buffer_t *, const void *, size_t);
+extern void buffer_putc(buffer_t *, uint8_t);
+extern void buffer_putstr(buffer_t *, const char *);
+extern char *buffer_getstr(buffer_t *);
+extern int buffer_empty(buffer_t *);
+extern buffer_status_t buffer_write(buffer_t *, int fd,
+                                    const void *, size_t);
+extern buffer_status_t buffer_flush_available(buffer_t *, int fd);
+extern buffer_status_t buffer_flush_all(buffer_t *, int fd);
+extern buffer_status_t buffer_flush_window(buffer_t *, int fd, int width,
+                                           int height, int erase, int no_more);
+
+#endif
diff -rupN keepalived-1.2.7/lib/command.c keepalived-1.2.7-unicast/lib/command.c
--- keepalived-1.2.7/lib/command.c	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/lib/command.c	2013-05-24 10:12:36.639169000 +0200
@@ -0,0 +1,2693 @@
+/*
+ * Soft:        Keepalived is a failover program for the LVS project
+ *              <www.linuxvirtualserver.org>. It monitor & manipulate
+ *              a loadbalanced server pool using multi-layer checks.
+ *
+ * Part:        Command tree library.
+ *              This code is coming from quagga.net.
+ *
+ * Author:      Alexandre Cassen, <acassen@linux-vs.org>
+ *
+ *              This program is distributed in the hope that it will be useful,
+ *              but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *              See the GNU General Public License for more details.
+ *
+ *              This program is free software; you can redistribute it and/or
+ *              modify it under the terms of the GNU General Public License
+ *              as published by the Free Software Foundation; either version
+ *              2 of the License, or (at your option) any later version.
+ *
+ * Copyright (C) 2001-2012 Alexandre Cassen, <acassen@linux-vs.org>
+ */
+
+#include <ctype.h>
+#include <unistd.h>
+#include <time.h>
+#include <arpa/inet.h>
+#include <sys/stat.h>
+
+#include "memory.h"
+#include "config.h"
+#include "vector.h"
+#include "vty.h"
+#include "command.h"
+#include "timer.h"
+
+/* Command vector which includes some level of command lists. Normally
+ * each daemon maintains each own cmdvec. */
+vector_t *cmdvec = NULL;
+
+desc_t desc_cr;
+char *command_cr = NULL;
+
+/* Host information structure. */
+host_t host;
+
+/* Standard command node structures. */
+static cmd_node_t auth_node = {
+	AUTH_NODE,
+	"Password: ",
+};
+
+static cmd_node_t view_node = {
+	VIEW_NODE,
+	"%s> ",
+};
+
+static cmd_node_t auth_enable_node = {
+	AUTH_ENABLE_NODE,
+	"Password: ",
+};
+
+static cmd_node_t enable_node = {
+	ENABLE_NODE,
+	"%s# ",
+};
+
+static cmd_node_t config_node = {
+	CONFIG_NODE,
+	"%s(config)# ",
+	1
+};
+
+/* Default motd string. */
+static const char *default_motd = "\r\n Welcome to Keepalived VTY.\r\n";
+
+
+/* Utility function to concatenate argv argument into a single string
+ * with inserting ' ' character between each argument. */
+char *
+argv_concat(const char **argv, int argc, int shift)
+{
+	int i;
+	size_t len = 0, arglen;
+	char *str, *p;
+
+	for (i = shift; i < argc; i++)
+		len += strlen(argv[i])+1;
+	if (!len)
+		return NULL;
+	p = str = (char *) MALLOC(len);
+	for (i = shift; i < argc; i++) {
+		memcpy(p, argv[i], (arglen = strlen(argv[i])));
+		p += arglen;
+		*p++ = ' ';
+	}
+	*(p-1) = '\0';
+	return str;
+}
+
+/* Install top node of command vector. */
+void
+install_node(cmd_node_t *node, int (*func) (vty_t *))
+{
+	vector_set_index(cmdvec, node->node, node);
+	node->func = func;
+	node->cmd_vector = vector_init(VECTOR_DEFAULT_SIZE);
+}
+
+/* Compare two command's string.  Used in sort_node (). */
+static int
+cmp_node(const void *p, const void *q)
+{
+	const cmd_element_t *a = *(cmd_element_t * const *)p;
+	const cmd_element_t *b = *(cmd_element_t * const *)q;
+
+	return strcmp(a->string, b->string);
+}
+
+static int
+cmp_desc(const void *p, const void *q)
+{
+	const desc_t *a = *(desc_t * const *)p;
+	const desc_t *b = *(desc_t * const *)q;
+
+	return strcmp(a->cmd, b->cmd);
+}
+
+/* Sort each node's command element according to command string. */
+void
+sort_node(void)
+{
+	unsigned int i, j;
+	cmd_node_t *cnode;
+	vector_t *descvec;
+	cmd_element_t *cmd_element;
+
+	for (i = 0; i < vector_active(cmdvec); i++) {
+		if ((cnode = vector_slot(cmdvec, i)) != NULL) {	
+			vector_t *cmd_vector = cnode->cmd_vector;
+			qsort(cmd_vector->slot, vector_active(cmd_vector), 
+			      sizeof (void *), cmp_node);
+
+			for (j = 0; j < vector_active(cmd_vector); j++) {
+				if ((cmd_element = vector_slot(cmd_vector, j)) != NULL
+				    && vector_active(cmd_element->strvec)) {
+					descvec = vector_slot(cmd_element->strvec,
+							      vector_active(cmd_element->strvec) - 1);
+					qsort(descvec->slot, vector_active(descvec), 
+					      sizeof (void *), cmp_desc);
+				}
+			}
+		}
+	}
+}
+
+/* Breaking up string into each command piece. I assume given
+ * character is separated by a space character. Return value is a
+ * vector which includes char ** data element. */
+vector_t *
+cmd_make_strvec(const char *string)
+{
+	const char *cp, *start;
+	char *token;
+	int strlen;
+	vector_t *strvec;
+  
+	if (string == NULL)
+		return NULL;
+  
+	cp = string;
+
+	/* Skip white spaces. */
+	while (isspace((int) *cp) && *cp != '\0')
+		cp++;
+
+	/* Return if there is only white spaces */
+	if (*cp == '\0')
+		return NULL;
+
+	if (*cp == '!' || *cp == '#')
+		return NULL;
+
+	/* Prepare return vector. */
+	strvec = vector_init(VECTOR_DEFAULT_SIZE);
+
+	/* Copy each command piece and set into vector. */
+	while (1) {
+		start = cp;
+		while (!(isspace((int) *cp) || *cp == '\r' || *cp == '\n') &&
+		       *cp != '\0')
+			cp++;
+		strlen = cp - start;
+		token = (char *) MALLOC(strlen + 1);
+		memcpy(token, start, strlen);
+		*(token + strlen) = '\0';
+		vector_set(strvec, token);
+
+		while ((isspace ((int) *cp) || *cp == '\n' || *cp == '\r') &&
+		       *cp != '\0')
+			cp++;
+
+		if (*cp == '\0')
+			return strvec;
+	}
+}
+
+/* Free allocated string vector. */
+void
+cmd_free_strvec(vector_t *v)
+{
+	unsigned int i;
+	char *cp;
+
+	if (!v)
+		return;
+
+	for (i = 0; i < vector_active (v); i++) {
+		if ((cp = vector_slot (v, i)) != NULL) {
+			FREE(cp);
+		}
+	}
+
+	vector_free(v);
+}
+
+/* Fetch next description.  Used in cmd_make_descvec(). */
+static char *
+cmd_desc_str(const char **string)
+{
+	const char *cp, *start;
+	char *token;
+	int strlen;
+  
+	cp = *string;
+
+	if (cp == NULL)
+		return NULL;
+
+	/* Skip white spaces. */
+	while (isspace ((int) *cp) && *cp != '\0')
+		cp++;
+
+	/* Return if there is only white spaces */
+	if (*cp == '\0')
+		return NULL;
+
+	start = cp;
+
+	while (!(*cp == '\r' || *cp == '\n') && *cp != '\0')
+		cp++;
+
+	strlen = cp - start;
+	token = (char *) MALLOC(strlen + 1);
+	memcpy(token, start, strlen);
+	*(token + strlen) = '\0';
+
+	*string = cp;
+
+	return token;
+}
+
+/* New string vector. */
+static vector_t *
+cmd_make_descvec(const char *string, const char *descstr)
+{
+	int multiple = 0;
+	const char *sp;
+	char *token;
+	int len;
+	const char *cp;
+	const char *dp;
+	vector_t *allvec;
+	vector_t *strvec = NULL;
+	desc_t *desc;
+
+	cp = string;
+	dp = descstr;
+
+	if (cp == NULL)
+		return NULL;
+
+	allvec = vector_init(VECTOR_DEFAULT_SIZE);
+
+	while (1) {
+		while (isspace ((int) *cp) && *cp != '\0')
+			cp++;
+
+		if (*cp == '(') {
+			multiple = 1;
+			cp++;
+		}
+
+		if (*cp == ')') {
+			multiple = 0;
+			cp++;
+		}
+
+		if (*cp == '|') {
+			if (!multiple) {
+				fprintf (stderr, "Command parse error!: %s\n", string);
+				exit (1);
+			}
+			cp++;
+		}
+      
+		while (isspace ((int) *cp) && *cp != '\0')
+			cp++;
+
+		if (*cp == '(') {
+			multiple = 1;
+			cp++;
+		}
+
+		if (*cp == '\0') 
+			return allvec;
+
+		sp = cp;
+
+		while (!(isspace ((int) *cp) || *cp == '\r' ||
+		       *cp == '\n' || *cp == ')' || *cp == '|') && *cp != '\0')
+			cp++;
+
+		len = cp - sp;
+
+		token = (char *) MALLOC(len + 1);
+		memcpy (token, sp, len);
+		*(token + len) = '\0';
+
+		desc = (desc_t *) MALLOC(sizeof(desc_t));
+		desc->cmd = token;
+		desc->str = cmd_desc_str(&dp);
+
+		if (multiple) {
+			if (multiple == 1) {
+				strvec = vector_init(VECTOR_DEFAULT_SIZE);
+				vector_set(allvec, strvec);
+			}
+			multiple++;
+		} else {
+			strvec = vector_init(VECTOR_DEFAULT_SIZE);
+			vector_set(allvec, strvec);
+		}
+		vector_set(strvec, desc);
+	}
+}
+
+/* Count mandantory string vector size.  This is to determine inputed
+ * command has enough command length. */
+static int
+cmd_cmdsize(vector_t *strvec)
+{
+	unsigned int i;
+	int size = 0;
+	vector_t *descvec;
+	desc_t *desc;
+
+	for (i = 0; i < vector_active (strvec); i++) {
+		if ((descvec = vector_slot (strvec, i)) != NULL) {
+			if ((vector_active (descvec)) == 1
+			    && (desc = vector_slot (descvec, 0)) != NULL) {
+				if (desc->cmd == NULL || CMD_OPTION (desc->cmd))
+					return size;
+				else
+					size++;
+			} else {
+				size++;
+			}
+		}
+	}
+
+	return size;
+}
+
+/* Return prompt character of specified node. */
+const char *
+cmd_prompt(node_type_t node)
+{
+	cmd_node_t *cnode;
+
+	cnode = vector_slot(cmdvec, node);
+	return cnode->prompt;
+}
+
+/* Install a command into a node. */
+void
+install_element(node_type_t ntype, cmd_element_t *cmd)
+{
+	cmd_node_t *cnode;
+  
+	/* cmd_init hasn't been called */
+	if (!cmdvec)
+		return;
+  
+	cnode = vector_slot(cmdvec, ntype);
+
+	if (cnode == NULL) {
+		fprintf (stderr, "Command node %d doesn't exist, please check it\n",
+			 ntype);
+		exit (1);
+	}
+
+	vector_set(cnode->cmd_vector, cmd);
+
+	if (cmd->strvec == NULL)
+		cmd->strvec = cmd_make_descvec(cmd->string, cmd->doc);
+
+	cmd->cmdsize = cmd_cmdsize (cmd->strvec);
+}
+
+static const unsigned char itoa64[] =
+"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+
+static void
+to64(char *s, long v, int n)
+{
+	while (--n >= 0) {
+		*s++ = itoa64[v&0x3f];
+		v >>= 6;
+	}
+}
+
+static char *
+zencrypt (const char *passwd)
+{
+	char salt[6];
+	timeval_t tv;
+	char *crypt(const char *, const char *);
+
+	gettimeofday(&tv,0);
+  
+	to64(&salt[0], random(), 3);
+	to64(&salt[3], tv.tv_usec, 3);
+	salt[5] = '\0';
+
+	return crypt(passwd, salt);
+}
+
+/* This function write configuration of this host. */
+static int
+config_write_host(vty_t *vty)
+{
+	if (host.name)
+		vty_out(vty, "hostname %s%s", host.name, VTY_NEWLINE);
+
+	if (host.encrypt) {
+		if (host.password_encrypt)
+			vty_out(vty, "password 8 %s%s", host.password_encrypt, VTY_NEWLINE); 
+		if (host.enable_encrypt)
+			vty_out(vty, "enable password 8 %s%s", host.enable_encrypt, VTY_NEWLINE); 
+	} else {
+		if (host.password)
+			vty_out(vty, "password %s%s", host.password, VTY_NEWLINE);
+		if (host.enable)
+			vty_out(vty, "enable password %s%s", host.enable, VTY_NEWLINE);
+	}
+
+	if (host.advanced)
+		vty_out(vty, "service advanced-vty%s", VTY_NEWLINE);
+
+	if (host.encrypt)
+		vty_out(vty, "service password-encryption%s", VTY_NEWLINE);
+
+	if (host.lines >= 0)
+		vty_out(vty, "service terminal-length %d%s", host.lines,
+			VTY_NEWLINE);
+
+	if (host.motdfile)
+		vty_out(vty, "banner motd file %s%s", host.motdfile, VTY_NEWLINE);
+	else if (!host.motd)
+		vty_out(vty, "no banner motd%s", VTY_NEWLINE);
+
+	return 1;
+}
+
+/* Utility function for getting command vector. */
+static vector_t *
+cmd_node_vector(vector_t *v, node_type_t ntype)
+{
+  cmd_node_t *cnode = vector_slot(v, ntype);
+
+  return cnode->cmd_vector;
+}
+
+/* Completion match types. */
+static match_type_t
+cmd_ipv4_match(const char *str)
+{
+	const char *sp;
+	int dots = 0, nums = 0;
+	char buf[4];
+
+	if (str == NULL)
+		return partly_match;
+
+	for (;;) {
+		memset(buf, 0, sizeof(buf));
+		sp = str;
+		while (*str != '\0') {
+			if (*str == '.') {
+				if (dots >= 3)
+					return no_match;
+
+				if (*(str + 1) == '.')
+					return no_match;
+
+				if (*(str + 1) == '\0')
+					return partly_match;
+
+				dots++;
+				break;
+			}
+			if (!isdigit ((int) *str))
+				return no_match;
+
+			str++;
+		}
+
+		if (str - sp > 3)
+			return no_match;
+
+		strncpy (buf, sp, str - sp);
+		if (atoi (buf) > 255)
+			return no_match;
+
+		nums++;
+
+		if (*str == '\0')
+			break;
+
+		str++;
+    	}
+
+	if (nums < 4)
+		return partly_match;
+
+	return exact_match;
+}
+
+static match_type_t
+cmd_ipv4_prefix_match(const char *str)
+{
+	const char *sp;
+	int dots = 0;
+	char buf[4];
+
+	if (str == NULL)
+		return partly_match;
+
+	for (;;) {
+		memset (buf, 0, sizeof (buf));
+		sp = str;
+		while (*str != '\0' && *str != '/') {
+			if (*str == '.') {
+				if (dots == 3)
+					return no_match;
+
+				if (*(str + 1) == '.' || *(str + 1) == '/')
+					return no_match;
+
+				if (*(str + 1) == '\0')
+					return partly_match;
+
+				dots++;
+				break;
+			}
+
+			if (!isdigit ((int) *str))
+				return no_match;
+
+			str++;
+		}
+
+		if (str - sp > 3)
+			return no_match;
+
+		strncpy (buf, sp, str - sp);
+		if (atoi (buf) > 255)
+			return no_match;
+
+		if (dots == 3) {
+			if (*str == '/') {
+				if (*(str + 1) == '\0')
+					return partly_match;
+
+				str++;
+				break;
+			} else if (*str == '\0') {
+				return partly_match;
+			}
+		}
+
+		if (*str == '\0')
+			return partly_match;
+
+		str++;
+	}
+
+	sp = str;
+	while (*str != '\0') {
+		if (!isdigit ((int) *str))
+			return no_match;
+
+		str++;
+	}
+
+	if (atoi (sp) > 32)
+		return no_match;
+
+	return exact_match;
+}
+
+static match_type_t
+cmd_ipv6_match(const char *str)
+{
+	struct sockaddr_in6 sin6_dummy;
+	int ret;
+
+	if (str == NULL)
+		return partly_match;
+
+	if (strspn(str, IPV6_ADDR_STR) != strlen (str))
+		return no_match;
+
+	/* use inet_pton that has a better support,
+	 * for example inet_pton can support the automatic addresses:
+	 *  ::1.2.3.4
+	 */
+	ret = inet_pton(AF_INET6, str, &sin6_dummy.sin6_addr);
+	if (ret == 1)
+		return exact_match;
+
+	return no_match;
+}
+
+static match_type_t
+cmd_ipv6_prefix_match(const char *str)
+{
+	int state = STATE_START;
+	int colons = 0, nums = 0, double_colon = 0;
+	int mask;
+	const char *sp = NULL;
+	char *endptr = NULL;
+
+	if (str == NULL)
+		return partly_match;
+
+	if (strspn(str, IPV6_PREFIX_STR) != strlen (str))
+		return no_match;
+
+	while (*str != '\0' && state != STATE_MASK) {
+		switch (state) {
+		case STATE_START:
+			if (*str == ':') {
+				if (*(str + 1) != ':' && *(str + 1) != '\0')
+					return no_match;
+				colons--;
+				state = STATE_COLON;
+			} else {
+				sp = str;
+				state = STATE_ADDR;
+			}
+			continue;
+
+		case STATE_COLON:
+			colons++;
+			if (*(str + 1) == '/')
+				return no_match;
+
+			if (*(str + 1) == ':') {
+				state = STATE_DOUBLE;
+			} else {
+				sp = str + 1;
+				state = STATE_ADDR;
+			}
+			break;
+
+		case STATE_DOUBLE:
+			if (double_colon)
+				return no_match;
+
+			if (*(str + 1) == ':')
+				return no_match;
+
+			if (*(str + 1) != '\0' && *(str + 1) != '/')
+				colons++;
+			sp = str + 1;
+
+			state = (*(str + 1) == '/') ? STATE_SLASH : STATE_ADDR;
+
+			double_colon++;
+			nums += 1;
+			break;
+
+		case STATE_ADDR:
+			if (*(str + 1) == ':' || *(str + 1) == '.' ||
+			    *(str + 1) == '\0' || *(str + 1) == '/') {
+				if (str - sp > 3)
+					return no_match;
+
+				for (; sp <= str; sp++)
+					if (*sp == '/')
+						return no_match;
+
+				nums++;
+
+				if (*(str + 1) == ':') {
+					state = STATE_COLON;
+				} else if (*(str + 1) == '.') {
+					if (!(colons || double_colon))
+						return no_match;
+					state = STATE_DOT;
+				} else if (*(str + 1) == '/') {
+					state = STATE_SLASH;
+				}
+			}
+			break;
+
+		case STATE_DOT:
+			state = STATE_ADDR;
+			break;
+
+		case STATE_SLASH:
+			if (*(str + 1) == '\0')
+				return partly_match;
+
+			state = STATE_MASK;
+			break;
+
+		default:
+			break;
+		}
+
+		if (nums > 11)
+			return no_match;
+
+		if (colons > 7)
+			return no_match;
+
+		str++;
+	}
+
+	if (state < STATE_MASK)
+		return partly_match;
+
+	mask = strtol(str, &endptr, 10);
+	if (*endptr != '\0')
+		return no_match;
+
+	if (mask < 0 || mask > 128)
+		return no_match;
+  
+	return exact_match;
+}
+
+static int
+cmd_range_match(const char *range, const char *str)
+{
+	char *p;
+	char buf[DECIMAL_STRLEN_MAX + 1];
+	char *endptr = NULL;
+	unsigned long min, max, val;
+
+	if (str == NULL)
+		return 1;
+
+	val = strtoul(str, &endptr, 10);
+	if (*endptr != '\0')
+		return 0;
+
+	range++;
+	p = strchr(range, '-');
+	if (p == NULL)
+		return 0;
+	if (p - range > DECIMAL_STRLEN_MAX)
+		return 0;
+	strncpy(buf, range, p - range);
+	buf[p - range] = '\0';
+	min = strtoul(buf, &endptr, 10);
+	if (*endptr != '\0')
+		return 0;
+
+	range = p + 1;
+	p = strchr (range, '>');
+	if (p == NULL)
+		return 0;
+	if (p - range > DECIMAL_STRLEN_MAX)
+		return 0;
+	strncpy(buf, range, p - range);
+	buf[p - range] = '\0';
+	max = strtoul(buf, &endptr, 10);
+	if (*endptr != '\0')
+		return 0;
+
+	if (val < min || val > max)
+		return 0;
+
+	return 1;
+}
+
+/* Make completion match and return match type flag. */
+static match_type_t
+cmd_filter_by_completion(char *command, vector_t *v, unsigned int index)
+{
+	unsigned int i;
+	const char *str;
+	cmd_element_t *cmd_element;
+	match_type_t match_type;
+	vector_t *descvec;
+	desc_t *desc;
+
+	match_type = no_match;
+
+	/* If command and cmd_element string does not match set NULL to vector */
+	for (i = 0; i < vector_active (v); i++) {
+		if ((cmd_element = vector_slot (v, i)) != NULL) {
+			if (index >= vector_active (cmd_element->strvec)) {
+				vector_slot(v, i) = NULL;
+			} else {
+				unsigned int j;
+				int matched = 0;
+
+				descvec = vector_slot(cmd_element->strvec, index);
+
+				for (j = 0; j < vector_active(descvec); j++) {
+					if ((desc = vector_slot(descvec, j))) {
+						str = desc->cmd;
+
+						if (CMD_VARARG(str)) {
+							if (match_type < vararg_match)
+								match_type = vararg_match;
+							matched++;
+						} else if (CMD_RANGE(str)) {
+							if (cmd_range_match(str, command)) {
+								if (match_type < range_match)
+									match_type = range_match;
+								matched++;
+							}
+						} else if (CMD_IPV6(str)) {
+							if (cmd_ipv6_match(command)) {
+								if (match_type < ipv6_match)
+									match_type = ipv6_match;
+								matched++;
+							}
+						} else if (CMD_IPV6_PREFIX(str)) {
+							if (cmd_ipv6_prefix_match(command)) {
+								if (match_type < ipv6_prefix_match)
+									match_type = ipv6_prefix_match;
+								matched++;
+							}
+						} else if (CMD_IPV4(str)) {
+							if (cmd_ipv4_match(command)) {
+								if (match_type < ipv4_match)
+									match_type = ipv4_match;
+								matched++;
+							}
+						} else if (CMD_IPV4_PREFIX(str)) {
+							if (cmd_ipv4_prefix_match(command)) {
+								if (match_type < ipv4_prefix_match)
+									match_type = ipv4_prefix_match;
+								matched++;
+							}
+						} else if (CMD_OPTION(str) || CMD_VARIABLE(str)) {
+							if (match_type < extend_match)
+								match_type = extend_match;
+							matched++;
+						} else if (strncmp(command, str, strlen(command)) == 0) {
+							if (strcmp(command, str) == 0) {
+								match_type = exact_match;
+							} else {
+								if (match_type < partly_match)
+									match_type = partly_match;
+							}
+							matched++;
+						}
+					}
+				}
+
+				if (!matched)
+					vector_slot(v, i) = NULL;
+			}
+		}
+	}
+
+	return match_type;
+}
+
+/* Filter vector by command character with index. */
+static match_type_t
+cmd_filter_by_string(char *command, vector_t *v, unsigned int index)
+{
+	unsigned int i;
+	const char *str;
+	cmd_element_t *cmd_element;
+	match_type_t match_type;
+	vector_t *descvec;
+	desc_t *desc;
+
+	match_type = no_match;
+
+	/* If command and cmd_element string does not match set NULL to vector */
+	for (i = 0; i < vector_active (v); i++) {
+		if ((cmd_element = vector_slot (v, i)) != NULL) {
+			/* If given index is bigger than max string vector of command,
+			 * set NULL */
+			if (index >= vector_active (cmd_element->strvec)) {
+				vector_slot (v, i) = NULL;
+			} else {
+				unsigned int j;
+				int matched = 0;
+
+				descvec = vector_slot(cmd_element->strvec, index);
+
+				for (j = 0; j < vector_active(descvec); j++) {
+					if ((desc = vector_slot(descvec, j))) {
+						str = desc->cmd;
+
+						if (CMD_VARARG(str)) {
+							if (match_type < vararg_match)
+								match_type = vararg_match;
+							matched++;
+						} else if (CMD_RANGE (str)) {
+							if (cmd_range_match(str, command)) {
+								if (match_type < range_match)
+									match_type = range_match;
+								matched++;
+							}
+						} else if (CMD_IPV6(str)) {
+							if (cmd_ipv6_match (command) == exact_match) {
+								if (match_type < ipv6_match)
+									match_type = ipv6_match;
+								matched++;
+							}
+						} else if (CMD_IPV6_PREFIX(str)) {
+							if (cmd_ipv6_prefix_match(command) == exact_match) {
+								if (match_type < ipv6_prefix_match)
+									match_type = ipv6_prefix_match;
+								matched++;
+							}
+						} else if (CMD_IPV4(str)) {
+							if (cmd_ipv4_match (command) == exact_match) {
+								if (match_type < ipv4_match)
+									match_type = ipv4_match;
+								matched++;
+							}
+						} else if (CMD_IPV4_PREFIX(str)) {
+							if (cmd_ipv4_prefix_match(command) == exact_match) {
+								if (match_type < ipv4_prefix_match)
+									match_type = ipv4_prefix_match;
+								matched++;
+							}
+						} else if (CMD_OPTION(str) || CMD_VARIABLE(str)) {
+							if (match_type < extend_match)
+								match_type = extend_match;
+							matched++;
+						} else {
+							if (strcmp(command, str) == 0) {
+								match_type = exact_match;
+								matched++;
+							}
+						}
+					}
+				}
+
+				if (!matched)
+					vector_slot(v, i) = NULL;
+			}
+		}
+	}
+
+	return match_type;
+}
+
+/* Check ambiguous match */
+static int
+is_cmd_ambiguous(char *command, vector_t *v, int index, match_type_t type)
+{
+	unsigned int i, j;
+	const char *str = NULL;
+	cmd_element_t *cmd_element;
+	const char *matched = NULL;
+	vector_t *descvec;
+	desc_t *desc;
+
+	for (i = 0; i < vector_active(v); i++) {
+		if ((cmd_element = vector_slot(v, i)) != NULL) {
+			int match = 0;
+
+			descvec = vector_slot(cmd_element->strvec, index);
+
+			for (j = 0; j < vector_active (descvec); j++) {
+				if ((desc = vector_slot (descvec, j))) {
+					match_type_t ret;
+	      
+					str = desc->cmd;
+
+					switch (type) {
+					case exact_match:
+						if (!(CMD_OPTION(str) || CMD_VARIABLE(str)) &&
+						    strcmp(command, str) == 0)
+							match++;
+						break;
+
+					case partly_match:
+						if (!(CMD_OPTION (str) || CMD_VARIABLE (str)) &&
+						    strncmp(command, str, strlen(command)) == 0) {
+							if (matched && strcmp(matched, str) != 0)
+								return 1;	/* There is ambiguous match. */
+							else
+								matched = str;
+							match++;
+						}
+						break;
+
+					case range_match:
+						if (cmd_range_match(str, command)) {
+							if (matched && strcmp(matched, str) != 0)
+								return 1;
+							else
+								matched = str;
+							match++;
+						}
+						break;
+
+					case ipv6_match:
+						if (CMD_IPV6(str))
+							match++;
+						break;
+
+					case ipv6_prefix_match:
+						if ((ret = cmd_ipv6_prefix_match(command)) != no_match) {
+							if (ret == partly_match)
+								return 2;	/* There is incomplete match. */
+							match++;
+						}
+						break;
+
+					case ipv4_match:
+						if (CMD_IPV4(str))
+							match++;
+						break;
+
+					case ipv4_prefix_match:
+						if ((ret = cmd_ipv4_prefix_match(command)) != no_match) {
+							if (ret == partly_match)
+								return 2;	/* There is incomplete match. */
+							match++;
+						}
+						break;
+
+					case extend_match:
+						if (CMD_OPTION(str) || CMD_VARIABLE(str))
+							match++;
+						break;
+
+					case no_match:
+					default:
+						break;
+					}
+				}
+			}
+
+			if (!match)
+				vector_slot(v, i) = NULL;
+		}
+	}
+
+	return 0;
+}
+
+/* If src matches dst return dst string, otherwise return NULL */
+static const char *
+cmd_entry_function(const char *src, const char *dst)
+{
+	/* Skip variable arguments. */
+	if (CMD_OPTION(dst) || CMD_VARIABLE(dst) || CMD_VARARG(dst) ||
+	    CMD_IPV4(dst) || CMD_IPV4_PREFIX(dst) || CMD_RANGE(dst))
+		return NULL;
+
+	/* In case of 'command \t', given src is NULL string. */
+	if (src == NULL)
+		return dst;
+
+	/* Matched with input string. */
+	if (strncmp(src, dst, strlen (src)) == 0)
+		return dst;
+
+	return NULL;
+}
+
+/* If src matches dst return dst string, otherwise return NULL */
+/* This version will return the dst string always if it is
+   CMD_VARIABLE for '?' key processing */
+static const char *
+cmd_entry_function_desc(const char *src, const char *dst)
+{
+	if (CMD_VARARG(dst))
+		return dst;
+
+	if (CMD_RANGE(dst)) {
+		if (cmd_range_match(dst, src))
+			return dst;
+		return NULL;
+	}
+
+	if (CMD_IPV6 (dst)) {
+		if (cmd_ipv6_match(src))
+			return dst;
+		return NULL;
+	}
+
+	if (CMD_IPV6_PREFIX(dst)) {
+		if (cmd_ipv6_prefix_match(src))
+			return dst;
+		return NULL;
+	}
+
+	if (CMD_IPV4(dst)) {
+		if (cmd_ipv4_match(src))
+			return dst;
+		return NULL;
+	}
+
+	if (CMD_IPV4_PREFIX(dst)) {
+		if (cmd_ipv4_prefix_match(src))
+			return dst;
+		return NULL;
+	}
+
+	/* Optional or variable commands always match on '?' */
+	if (CMD_OPTION(dst) || CMD_VARIABLE(dst))
+		return dst;
+
+	/* In case of 'command \t', given src is NULL string. */
+	if (src == NULL)
+		return dst;
+
+	if (strncmp(src, dst, strlen(src)) == 0)
+		return dst;
+
+	return NULL;
+}
+
+/* Check same string element existence.  If it isn't there return
+ *  1. */
+static int
+cmd_unique_string(vector_t *v, const char *str)
+{
+	unsigned int i;
+	char *match;
+
+	for (i = 0; i < vector_active (v); i++) {
+		if ((match = vector_slot (v, i)) != NULL) {
+			if (strcmp (match, str) == 0) {
+				return 0;
+			}
+		}
+	}
+
+	return 1;
+}
+
+/* Compare string to description vector.  If there is same string
+ * return 1 else return 0. */
+static int
+desc_unique_string(vector_t *v, const char *str)
+{
+	unsigned int i;
+	desc_t *desc;
+
+	for (i = 0; i < vector_active (v); i++) {
+		if ((desc = vector_slot (v, i)) != NULL) {
+			if (strcmp (desc->cmd, str) == 0) {
+				return 1;
+			}
+		}
+	}
+
+	return 0;
+}
+
+static int 
+cmd_try_do_shortcut(node_type_t node, char* first_word)
+{
+	if (first_word != NULL && node != AUTH_NODE &&
+	    node != VIEW_NODE && node != AUTH_ENABLE_NODE &&
+	    node != ENABLE_NODE &&
+	    strcmp("do", first_word) == 0)
+		return 1;
+
+	return 0;
+}
+
+/* '?' describe command support. */
+static vector_t *
+cmd_describe_command_real(vector_t *vline, vty_t *vty, int *status)
+{
+	vector_t *cmd_vector;
+	vector_t *matchvec;
+	cmd_element_t *cmd_element;
+	unsigned int index, i;
+	int ret;
+	match_type_t match;
+	char *command;
+
+	/* Set index. */
+	if (vector_active(vline) == 0) {
+		*status = CMD_ERR_NO_MATCH;
+		return NULL;
+	}
+
+	index = vector_active (vline) - 1;
+  
+	/* Make copy vector of current node's command vector. */
+	cmd_vector = vector_copy(cmd_node_vector(cmdvec, vty->node));
+
+	/* Prepare match vector */
+	matchvec = vector_init(INIT_MATCHVEC_SIZE);
+
+	/* Filter commands. */
+	/* Only words precedes current word will be checked in this loop. */
+	for (i = 0; i < index; i++) {
+		if ((command = vector_slot(vline, i))) {
+			match = cmd_filter_by_completion(command, cmd_vector, i);
+	
+			if (match == vararg_match) {
+				cmd_element_t *cmd_element;
+				vector_t *descvec;
+				unsigned int j, k;
+
+				for (j = 0; j < vector_active(cmd_vector); j++)
+					if ((cmd_element = vector_slot(cmd_vector, j)) != NULL
+					    && (vector_active(cmd_element->strvec))) {
+						descvec = vector_slot(cmd_element->strvec,
+								      vector_active(cmd_element->strvec) - 1);
+						for (k = 0; k < vector_active(descvec); k++) {
+							desc_t *desc = vector_slot(descvec, k);
+							vector_set(matchvec, desc);
+						}
+					}
+            
+					vector_set(matchvec, &desc_cr);
+					vector_free(cmd_vector);
+
+					return matchvec;
+			}
+
+			if ((ret = is_cmd_ambiguous(command, cmd_vector, i, match)) == 1) {
+				vector_free(cmd_vector);
+				vector_free(matchvec);
+				*status = CMD_ERR_AMBIGUOUS;
+				return NULL;
+			} else if (ret == 2) {
+				vector_free(cmd_vector);
+				vector_free(matchvec);
+				*status = CMD_ERR_NO_MATCH;
+				return NULL;
+			}
+		}
+	}
+
+	/* Prepare match vector:
+	 *  matchvec = vector_init (INIT_MATCHVEC_SIZE); */
+
+	/* Make sure that cmd_vector is filtered based on current word */
+	command = vector_slot(vline, index);
+	if (command)
+		match = cmd_filter_by_completion(command, cmd_vector, index);
+
+	/* Make description vector. */
+	for (i = 0; i < vector_active(cmd_vector); i++) {
+		if ((cmd_element = vector_slot(cmd_vector, i)) != NULL) {
+			vector_t *strvec = cmd_element->strvec;
+
+			/* if command is NULL, index may be equal to vector_active */
+			if (command && index >= vector_active(strvec)) {
+				vector_slot(cmd_vector, i) = NULL;
+			} else {
+				/* Check if command is completed. */
+				if (command == NULL && index == vector_active(strvec)) {
+					if (!desc_unique_string(matchvec, command_cr))
+						vector_set(matchvec, &desc_cr);
+				} else {
+					unsigned int j;
+					vector_t *descvec = vector_slot(strvec, index);
+					desc_t *desc;
+
+					for (j = 0; j < vector_active (descvec); j++) {
+						if ((desc = vector_slot (descvec, j))) {
+							const char *string;
+
+							string = cmd_entry_function_desc(command, desc->cmd);
+							if (string) {
+								/* Uniqueness check */
+								if (!desc_unique_string(matchvec, string))
+									vector_set(matchvec, desc);
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+
+	vector_free(cmd_vector);
+
+	if (vector_slot(matchvec, 0) == NULL) {
+		vector_free(matchvec);
+		*status = CMD_ERR_NO_MATCH;
+		return NULL;
+	}
+
+	*status = CMD_SUCCESS;
+	return matchvec;
+}
+
+vector_t *
+cmd_describe_command(vector_t *vline, vty_t *vty, int *status)
+{
+	vector_t *ret;
+
+	if (cmd_try_do_shortcut(vty->node, vector_slot(vline, 0))) {
+		node_type_t onode;
+		vector_t *shifted_vline;
+		unsigned int index;
+
+		onode = vty->node;
+		vty->node = ENABLE_NODE;
+		/* We can try it on enable node, cos' the vty is authenticated */
+
+		shifted_vline = vector_init(vector_count(vline));
+		/* use memcpy? */
+		for (index = 1; index < vector_active(vline); index++) {
+			vector_set_index(shifted_vline, index-1, vector_lookup(vline, index));
+		}
+
+		ret = cmd_describe_command_real(shifted_vline, vty, status);
+
+		vector_free(shifted_vline);
+		vty->node = onode;
+		return ret;
+	}
+
+
+	return cmd_describe_command_real(vline, vty, status);
+}
+
+
+/* Check LCD of matched command. */
+static int
+cmd_lcd(char **matched)
+{
+	int i, j, lcd = -1;
+	char *s1, *s2;
+	char c1, c2;
+
+	if (matched[0] == NULL || matched[1] == NULL)
+		return 0;
+
+	for (i = 1; matched[i] != NULL; i++) {
+		s1 = matched[i - 1];
+		s2 = matched[i];
+
+		for (j = 0; (c1 = s1[j]) && (c2 = s2[j]); j++) {
+			if (c1 != c2)
+				break;
+		}
+
+		if (lcd < 0) {
+			lcd = j;
+		} else {
+			if (lcd > j)
+				lcd = j;
+		}
+	}
+
+	return lcd;
+}
+
+/* Command line completion support. */
+static char **
+cmd_complete_command_real(vector_t *vline, vty_t *vty, int *status)
+{
+	vector_t *cmd_vector = vector_copy(cmd_node_vector(cmdvec, vty->node));
+	vector_t *matchvec;
+	cmd_element_t *cmd_element;
+	unsigned int index, i;
+	char **match_str;
+	desc_t *desc;
+	vector_t *descvec;
+	char *command;
+	int lcd;
+
+	if (vector_active(vline) == 0) {
+		vector_free(cmd_vector);
+		*status = CMD_ERR_NO_MATCH;
+		return NULL;
+	}
+
+	index = vector_active (vline) - 1;
+
+	/* First, filter by preceeding command string */
+	for (i = 0; i < index; i++) {
+		if ((command = vector_slot(vline, i))) {
+			match_type_t match;
+			int ret;
+
+			/* First try completion match, if there is exactly match return 1 */
+			match = cmd_filter_by_completion (command, cmd_vector, i);
+
+			/* If there is exact match then filter ambiguous match else check
+			 * ambiguousness. */
+			if ((ret = is_cmd_ambiguous(command, cmd_vector, i, match)) == 1) {
+				vector_free(cmd_vector);
+				*status = CMD_ERR_AMBIGUOUS;
+				return NULL;
+			}
+		}
+	}
+  
+	/* Prepare match vector. */
+	matchvec = vector_init(INIT_MATCHVEC_SIZE);
+
+	/* Now we got into completion */
+	for (i = 0; i < vector_active (cmd_vector); i++) {
+		if ((cmd_element = vector_slot (cmd_vector, i))) {
+			const char *string;
+			vector_t *strvec = cmd_element->strvec;
+
+			/* Check field length */
+			if (index >= vector_active(strvec)) {
+				vector_slot(cmd_vector, i) = NULL;
+			} else {
+				unsigned int j;
+
+				descvec = vector_slot(strvec, index);
+				for (j = 0; j < vector_active(descvec); j++) {
+					if ((desc = vector_slot(descvec, j))) {
+						if ((string = 
+							cmd_entry_function(vector_slot(vline, index),
+									   desc->cmd)))
+								if (cmd_unique_string (matchvec, string))
+									vector_set(matchvec, strdup(string));
+					}
+				}
+			}
+		}
+	}
+
+	/* We don't need cmd_vector any more. */
+	vector_free(cmd_vector);
+
+	/* No matched command */
+	if (vector_slot(matchvec, 0) == NULL) {
+		vector_free(matchvec);
+
+		/* In case of 'command \t' pattern.  Do you need '?' command at
+		 * the end of the line. */
+		if (vector_slot(vline, index) == '\0')
+			*status = CMD_ERR_NOTHING_TODO;
+		else
+			*status = CMD_ERR_NO_MATCH;
+		return NULL;
+	}
+
+	/* Only one matched */
+	if (vector_slot(matchvec, 1) == NULL) {
+		match_str = (char **) matchvec->slot;
+		vector_only_wrapper_free(matchvec);
+		*status = CMD_COMPLETE_FULL_MATCH;
+		return match_str;
+	}
+
+	/* Make it sure last element is NULL. */
+	vector_set(matchvec, NULL);
+
+	/* Check LCD of matched strings. */
+	if (vector_slot (vline, index) != NULL) {
+		lcd = cmd_lcd((char **) matchvec->slot);
+
+		if (lcd) {
+			int len = strlen(vector_slot(vline, index));
+
+			if (len < lcd) {
+				char *lcdstr;
+
+				lcdstr = MALLOC(lcd + 1);
+				memcpy(lcdstr, matchvec->slot[0], lcd);
+				lcdstr[lcd] = '\0';
+
+				/* Free matchvec. */
+				for (i = 0; i < vector_active(matchvec); i++) {
+					if (vector_slot(matchvec, i))
+						FREE(vector_slot(matchvec, i));
+				}
+				vector_free(matchvec);
+
+				/* Make new matchvec. */
+				matchvec = vector_init(INIT_MATCHVEC_SIZE);
+				vector_set(matchvec, lcdstr);
+				match_str = (char **) matchvec->slot;
+				vector_only_wrapper_free(matchvec);
+
+				*status = CMD_COMPLETE_MATCH;
+				return match_str;
+			}
+		}
+	}
+
+	match_str = (char **) matchvec->slot;
+	vector_only_wrapper_free(matchvec);
+	*status = CMD_COMPLETE_LIST_MATCH;
+	return match_str;
+}
+
+char **
+cmd_complete_command(vector_t *vline, vty_t *vty, int *status)
+{
+	char **ret;
+
+	if (cmd_try_do_shortcut(vty->node, vector_slot(vline, 0))) {
+		node_type_t onode;
+		vector_t *shifted_vline;
+		unsigned int index;
+
+		onode = vty->node;
+		vty->node = ENABLE_NODE;
+		/* We can try it on enable node, cos' the vty is authenticated */
+
+		shifted_vline = vector_init(vector_count(vline));
+		/* use memcpy? */
+		for (index = 1; index < vector_active(vline); index++) {
+			vector_set_index (shifted_vline, index-1, vector_lookup(vline, index));
+		}
+
+		ret = cmd_complete_command_real(shifted_vline, vty, status);
+
+		vector_free(shifted_vline);
+		vty->node = onode;
+		return ret;
+	}
+
+	return cmd_complete_command_real(vline, vty, status);
+}
+
+/* return parent node */
+/* MUST eventually converge on CONFIG_NODE */
+node_type_t
+node_parent(node_type_t node)
+{
+#if 0
+	node_type_t ret;
+
+	assert(node > CONFIG_NODE);
+
+	switch (node) {
+	case BGP_VPNV4_NODE:
+	case BGP_IPV4_NODE:
+	case BGP_IPV4M_NODE:
+	case BGP_IPV6_NODE:
+	case BGP_IPV6M_NODE:
+		ret = BGP_NODE;
+		break;
+	case KEYCHAIN_KEY_NODE:
+		ret = KEYCHAIN_NODE;
+		break;
+	default:
+		ret = CONFIG_NODE;
+	}
+
+	return ret;
+#endif
+	return CONFIG_NODE;
+}
+
+/* Execute command by argument vline vector. */
+static int
+cmd_execute_command_real(vector_t *vline, vty_t *vty, cmd_element_t **cmd)
+{
+	unsigned int index, i;
+	vector_t *cmd_vector;
+	cmd_element_t *cmd_element;
+	cmd_element_t *matched_element;
+	unsigned int matched_count, incomplete_count;
+	int argc;
+	const char *argv[CMD_ARGC_MAX];
+	match_type_t match = 0;
+	int varflag;
+	char *command;
+
+	/* Make copy of command elements. */
+	cmd_vector = vector_copy(cmd_node_vector(cmdvec, vty->node));
+
+	for (index = 0; index < vector_active(vline); index++) {
+		if ((command = vector_slot(vline, index))) {
+			int ret;
+
+			match = cmd_filter_by_completion(command, cmd_vector, index);
+
+			if (match == vararg_match)
+				break;
+        
+			ret = is_cmd_ambiguous(command, cmd_vector, index, match);
+			if (ret == 1) {
+				vector_free(cmd_vector);
+				return CMD_ERR_AMBIGUOUS;
+			} else if (ret == 2) {
+				vector_free(cmd_vector);
+				return CMD_ERR_NO_MATCH;
+			}
+		}
+	}
+
+	/* Check matched count. */
+	matched_element = NULL;
+	matched_count = 0;
+	incomplete_count = 0;
+
+	for (i = 0; i < vector_active (cmd_vector); i++) {
+		if ((cmd_element = vector_slot (cmd_vector, i))) {
+			if (match == vararg_match || index >= cmd_element->cmdsize) {
+				matched_element = cmd_element;
+				matched_count++;
+			} else {
+				incomplete_count++;
+			}
+		}
+	}
+
+	/* Finish of using cmd_vector. */
+	vector_free(cmd_vector);
+
+	/* To execute command, matched_count must be 1. */
+	if (matched_count == 0) {
+		if (incomplete_count)
+			return CMD_ERR_INCOMPLETE;
+		return CMD_ERR_NO_MATCH;
+	}
+
+	if (matched_count > 1)
+		return CMD_ERR_AMBIGUOUS;
+
+	/* Argument treatment */
+	varflag = argc = 0;
+
+	for (i = 0; i < vector_active(vline); i++) {
+		if (varflag) {
+			argv[argc++] = vector_slot(vline, i);
+		} else {
+			vector_t *descvec = vector_slot(matched_element->strvec, i);
+
+			if (vector_active(descvec) == 1) {
+				desc_t *desc = vector_slot (descvec, 0);
+
+				if (CMD_VARARG(desc->cmd))
+					varflag = 1;
+
+				if (varflag || CMD_VARIABLE(desc->cmd) || CMD_OPTION(desc->cmd))
+					argv[argc++] = vector_slot (vline, i);
+			} else {
+				argv[argc++] = vector_slot (vline, i);
+			}
+		}
+
+		if (argc >= CMD_ARGC_MAX)
+			return CMD_ERR_EXEED_ARGC_MAX;
+	}
+
+	/* For vtysh execution. */
+	if (cmd)
+		*cmd = matched_element;
+
+	if (matched_element->daemon)
+		return CMD_SUCCESS_DAEMON;
+
+	/* Execute matched command. */
+	return (*matched_element->func) (matched_element, vty, argc, argv);
+}
+
+int
+cmd_execute_command(vector_t *vline, vty_t *vty, cmd_element_t **cmd, int vtysh)
+{
+	int ret, saved_ret, tried = 0;
+	node_type_t onode, try_node;
+
+	onode = try_node = vty->node;
+
+	if (cmd_try_do_shortcut(vty->node, vector_slot(vline, 0))) {
+		vector_t *shifted_vline;
+		unsigned int index;
+
+		vty->node = ENABLE_NODE;
+		/* We can try it on enable node, cos' the vty is authenticated */
+
+		shifted_vline = vector_init(vector_count(vline));
+		/* use memcpy? */
+		for (index = 1; index < vector_active (vline); index++) {
+			vector_set_index(shifted_vline, index-1, vector_lookup(vline, index));
+		}
+
+		ret = cmd_execute_command_real(shifted_vline, vty, cmd);
+
+		vector_free(shifted_vline);
+		vty->node = onode;
+		return ret;
+	}
+
+
+	saved_ret = ret = cmd_execute_command_real (vline, vty, cmd);
+
+	if (vtysh)
+		return saved_ret;
+
+	/* This assumes all nodes above CONFIG_NODE are childs of CONFIG_NODE */
+	while (ret != CMD_SUCCESS && ret != CMD_WARNING  && vty->node > CONFIG_NODE) {
+		try_node = node_parent(try_node);
+		vty->node = try_node;
+		ret = cmd_execute_command_real(vline, vty, cmd);
+		tried = 1;
+		if (ret == CMD_SUCCESS || ret == CMD_WARNING) {
+			/* succesfull command, leave the node as is */
+			return ret;
+		}
+	}
+
+	/* no command succeeded, reset the vty to the original node and
+	 * return the error for this node */
+	if (tried)
+		vty->node = onode;
+
+	return saved_ret;
+}
+
+/* Execute command by argument readline. */
+int
+cmd_execute_command_strict(vector_t *vline, vty_t *vty, cmd_element_t **cmd)
+{
+	unsigned int index, i;
+	vector_t *cmd_vector;
+	cmd_element_t *cmd_element;
+	cmd_element_t *matched_element;
+	unsigned int matched_count, incomplete_count;
+	int argc;
+	const char *argv[CMD_ARGC_MAX];
+	int varflag;
+	match_type_t match = 0;
+	char *command;
+
+	/* Make copy of command element */
+	cmd_vector = vector_copy(cmd_node_vector(cmdvec, vty->node));
+
+	for (index = 0; index < vector_active (vline); index++) {
+		if ((command = vector_slot(vline, index))) {
+			int ret;
+	
+			match = cmd_filter_by_string(vector_slot(vline, index),
+						     cmd_vector, index);
+
+			/* If command meets '.VARARG' then finish matching. */
+			if (match == vararg_match)
+				break;
+        
+			ret = is_cmd_ambiguous(command, cmd_vector, index, match);
+			if (ret == 1) {
+				vector_free(cmd_vector);
+				return CMD_ERR_AMBIGUOUS;
+			} else if (ret == 2) {
+				vector_free(cmd_vector);
+				return CMD_ERR_NO_MATCH;
+			}
+		}
+	}
+
+	/* Check matched count. */
+	matched_element = NULL;
+	matched_count = 0;
+	incomplete_count = 0;
+	for (i = 0; i < vector_active (cmd_vector); i++) {
+		if (vector_slot (cmd_vector, i) != NULL) {
+			cmd_element = vector_slot (cmd_vector, i);
+
+			if (match == vararg_match || index >= cmd_element->cmdsize) {
+				matched_element = cmd_element;
+				matched_count++;
+			} else {
+				incomplete_count++;
+			}
+		}
+	}
+
+	/* Finish of using cmd_vector. */
+	vector_free(cmd_vector);
+
+	/* To execute command, matched_count must be 1. */
+	if (matched_count == 0) {
+		if (incomplete_count)
+			return CMD_ERR_INCOMPLETE;
+		return CMD_ERR_NO_MATCH;
+	}
+
+	if (matched_count > 1)
+		return CMD_ERR_AMBIGUOUS;
+
+	/* Argument treatment */
+	varflag = argc = 0;
+
+	for (i = 0; i < vector_active(vline); i++) {
+		if (varflag) {
+			argv[argc++] = vector_slot(vline, i);
+		} else {
+			vector_t *descvec = vector_slot(matched_element->strvec, i);
+
+			if (vector_active(descvec) == 1) {
+				desc_t *desc = vector_slot(descvec, 0);
+
+				if (CMD_VARARG(desc->cmd))
+					varflag = 1;
+
+				if (varflag || CMD_VARIABLE(desc->cmd) || CMD_OPTION(desc->cmd))
+					argv[argc++] = vector_slot (vline, i);
+				} else {
+					argv[argc++] = vector_slot (vline, i);
+				}
+		}
+
+		if (argc >= CMD_ARGC_MAX)
+			return CMD_ERR_EXEED_ARGC_MAX;
+	}
+
+	/* For vtysh execution. */
+	if (cmd)
+		*cmd = matched_element;
+
+	if (matched_element->daemon)
+		return CMD_SUCCESS_DAEMON;
+
+	/* Now execute matched command */
+	return (*matched_element->func) (matched_element, vty, argc, argv);
+}
+
+/* Configration make from file. */
+int
+config_from_file(vty_t *vty, FILE *fp)
+{
+	int ret;
+	vector_t *vline;
+
+	while (fgets(vty->buf, VTY_BUFSIZ, fp)) {
+		vline = cmd_make_strvec(vty->buf);
+
+		/* In case of comment line */
+		if (vline == NULL)
+			continue;
+
+		/* Execute configuration command : this is strict match */
+		ret = cmd_execute_command_strict(vline, vty, NULL);
+
+		/* Try again with setting node to CONFIG_NODE */
+		while (ret != CMD_SUCCESS && ret != CMD_WARNING &&
+		       ret != CMD_ERR_NOTHING_TODO && vty->node != CONFIG_NODE) {
+			vty->node = node_parent(vty->node);
+			ret = cmd_execute_command_strict (vline, vty, NULL);
+		}
+
+		cmd_free_strvec(vline);
+
+		if (ret != CMD_SUCCESS && ret != CMD_WARNING &&
+		    ret != CMD_ERR_NOTHING_TODO)
+			return ret;
+	}
+
+	return CMD_SUCCESS;
+}
+
+/* Configration from terminal */
+DEFUN(config_terminal,
+      config_terminal_cmd,
+      "configure terminal",
+      "Configuration from vty interface\n"
+      "Configuration terminal\n")
+{
+	if (vty_config_lock (vty)) {
+		vty->node = CONFIG_NODE;
+	} else {
+		vty_out(vty, "VTY configuration is locked by other VTY%s", VTY_NEWLINE);
+			return CMD_WARNING;
+	}
+
+	return CMD_SUCCESS;
+}
+
+/* Enable command */
+DEFUN(enable, 
+      config_enable_cmd,
+      "enable",
+      "Turn on privileged mode command\n")
+{
+	/* If enable password is NULL, change to ENABLE_NODE */
+	if ((host.enable == NULL && host.enable_encrypt == NULL) ||
+	    vty->type == VTY_SHELL_SERV)
+		vty->node = ENABLE_NODE;
+	else
+		vty->node = AUTH_ENABLE_NODE;
+
+	return CMD_SUCCESS;
+}
+
+/* Disable command */
+DEFUN(disable, 
+      config_disable_cmd,
+      "disable",
+      "Turn off privileged mode command\n")
+{
+	if (vty->node == ENABLE_NODE)
+		vty->node = VIEW_NODE;
+	return CMD_SUCCESS;
+}
+
+/* Down vty node level. */
+DEFUN(config_exit,
+      config_exit_cmd,
+      "exit",
+      "Exit current mode and down to previous mode\n")
+{
+	switch (vty->node) {
+	case VIEW_NODE:
+	case ENABLE_NODE:
+		if (vty_shell(vty))
+			exit (0);
+		vty->status = VTY_CLOSE;
+		break;
+	case CONFIG_NODE:
+		vty->node = ENABLE_NODE;
+		vty_config_unlock(vty);
+		break;
+	case VTY_NODE:
+	case CFG_LOG_NODE:
+		vty->node = CONFIG_NODE;
+		break;
+	default:
+		break;
+	}
+
+	return CMD_SUCCESS;
+}
+
+/* quit is alias of exit. */
+ALIAS (config_exit,
+       config_quit_cmd,
+       "quit",
+       "Exit current mode and down to previous mode\n")
+       
+/* End of configuration. */
+DEFUN(config_end,
+      config_end_cmd,
+      "end",
+      "End current mode and change to enable mode.")
+{
+	switch (vty->node) {
+	case VIEW_NODE:
+	case ENABLE_NODE:
+		/* Nothing to do. */
+		break;
+	case CFG_LOG_NODE:
+	case CONFIG_NODE:
+	case VTY_NODE:
+		vty_config_unlock (vty);
+		vty->node = ENABLE_NODE;
+		break;
+	default:
+		break;
+	}
+
+	return CMD_SUCCESS;
+}
+
+/* Show version. */
+DEFUN(show_version,
+      show_version_cmd,
+      "show version",
+      SHOW_STR
+      "Displays Keepalived version\n")
+{
+	vty_out(vty, "%s (%s).%s", VERSION_STRING, host.name?host.name:"",
+		VTY_NEWLINE);
+	vty_out(vty, "%s%s", COPYRIGHT_STRING, VTY_NEWLINE);
+
+	return CMD_SUCCESS;
+}
+
+/* Help display function for all node. */
+DEFUN(config_help,
+      config_help_cmd,
+      "help",
+      "Description of the interactive help system\n")
+{
+	vty_out(vty, "This VTY provides advanced help feature.  When you need help,%s\
+anytime at the command line please press '?'.%s\
+%s\
+If nothing matches, the help list will be empty and you must backup%s\
+ until entering a '?' shows the available options.%s\
+Two styles of help are provided:%s\
+1. Full help is available when you are ready to enter a%s\
+   command argument (e.g. 'show ?') and describes each possible%s\
+   argument.%s\
+2. Partial help is provided when an abbreviated argument is entered%s\
+   and you want to know what arguments match the input%s\
+   (e.g. 'show me?'.)%s%s"
+		   , VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE
+		   , VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE
+		   , VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE
+		   , VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
+
+	return CMD_SUCCESS;
+}
+
+/* Help display function for all node. */
+DEFUN(config_list,
+      config_list_cmd,
+      "list",
+      "Print command list\n")
+{
+	unsigned int i;
+	cmd_node_t *cnode = vector_slot(cmdvec, vty->node);
+	cmd_element_t *cmd;
+
+	for (i = 0; i < vector_active (cnode->cmd_vector); i++)
+		if ((cmd = vector_slot (cnode->cmd_vector, i)) != NULL &&
+		    !(cmd->attr == CMD_ATTR_DEPRECATED || cmd->attr == CMD_ATTR_HIDDEN))
+			vty_out(vty, "  %s%s", cmd->string, VTY_NEWLINE);
+
+	return CMD_SUCCESS;
+}
+
+/* Write current configuration into file. */
+DEFUN(config_write_file, 
+      config_write_file_cmd,
+      "write file",  
+      "Write running configuration to memory, network, or terminal\n"
+      "Write to configuration file\n")
+{
+	unsigned int i;
+	int fd;
+	cmd_node_t *node;
+	char *config_file;
+	char *config_file_tmp = NULL;
+	char *config_file_sav = NULL;
+	int ret = CMD_WARNING;
+	vty_t *file_vty;
+
+	/* Check and see if we are operating under vtysh configuration */
+	if (host.config == NULL) {
+		vty_out(vty, "Can't save to configuration file, using vtysh.%s"
+			   , VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+
+	/* Get filename. */
+	config_file = host.config;
+  
+	config_file_sav = MALLOC(strlen(config_file) + strlen(CONF_BACKUP_EXT) + 1);
+	strcpy(config_file_sav, config_file);
+	strcat(config_file_sav, CONF_BACKUP_EXT);
+
+	config_file_tmp = MALLOC(strlen(config_file) + 8);
+	sprintf(config_file_tmp, "%s.XXXXXX", config_file);
+  
+	/* Open file to configuration write. */
+	fd = mkstemp(config_file_tmp);
+	if (fd < 0) {
+		vty_out(vty, "Can't open configuration file %s.%s", config_file_tmp
+			   , VTY_NEWLINE);
+		goto finished;
+	}
+  
+	/* Make vty for configuration file. */
+	file_vty = vty_new();
+	file_vty->fd = fd;
+	file_vty->type = VTY_FILE;
+
+	/* Config file header print. */
+	vty_out(file_vty, "!\n! Keepalived configuration saved from vty\n!   ");
+	vty_time_print(file_vty, 1);
+	vty_out(file_vty, "!\n");
+
+	for (i = 0; i < vector_active(cmdvec); i++) {
+		if ((node = vector_slot(cmdvec, i)) && node->func) {
+			if ((*node->func) (file_vty))
+				vty_out(file_vty, "!\n");
+		}
+	}
+
+	vty_close (file_vty);
+
+	if (unlink(config_file_sav) != 0) {
+		if (errno != ENOENT) {
+			vty_out(vty, "Can't unlink backup configuration file %s.%s", config_file_sav
+				   , VTY_NEWLINE);
+			goto finished;
+		}
+	}
+
+	if (link(config_file, config_file_sav) != 0) {
+		vty_out(vty, "Can't backup old configuration file %s.%s", config_file_sav
+			   , VTY_NEWLINE);
+		goto finished;
+	}
+
+	sync();
+
+	if (unlink(config_file) != 0) {
+		vty_out(vty, "Can't unlink configuration file %s.%s", config_file
+			   , VTY_NEWLINE);
+		goto finished;
+	}
+
+	if (link(config_file_tmp, config_file) != 0) {
+		vty_out(vty, "Can't save configuration file %s.%s", config_file
+			   , VTY_NEWLINE);
+		goto finished;
+	}
+
+	sync();
+  
+	if (chmod(config_file, 0600) != 0) {
+		vty_out(vty, "Can't chmod configuration file %s: %s (%d).%s" 
+			   , config_file, strerror(errno), errno, VTY_NEWLINE);
+		goto finished;
+	}
+
+	vty_out(vty, "Configuration saved to %s%s", config_file, VTY_NEWLINE);
+	ret = CMD_SUCCESS;
+
+  finished:
+	unlink(config_file_tmp);
+	FREE(config_file_tmp);
+	FREE(config_file_sav);
+	return ret;
+}
+
+ALIAS(config_write_file, 
+      config_write_cmd,
+      "write",  
+      "Write running configuration to memory, network, or terminal\n")
+
+ALIAS(config_write_file, 
+      config_write_memory_cmd,
+      "write memory",  
+      "Write running configuration to memory, network, or terminal\n"
+      "Write configuration to the file (same as write file)\n")
+
+ALIAS(config_write_file, 
+      copy_runningconfig_startupconfig_cmd,
+      "copy running-config startup-config",  
+      "Copy configuration\n"
+      "Copy running config to... \n"
+      "Copy running config to startup config (same as write file)\n")
+
+/* Write current configuration into the terminal. */
+DEFUN(config_write_terminal,
+      config_write_terminal_cmd,
+      "write terminal",
+      "Write running configuration to memory, network, or terminal\n"
+      "Write to terminal\n")
+{
+	unsigned int i;
+	cmd_node_t *node;
+
+	if (vty->type == VTY_SHELL_SERV) {
+		for (i = 0; i < vector_active(cmdvec); i++) {
+			if ((node = vector_slot(cmdvec, i)) && node->func && node->vtysh) {
+				if ((*node->func) (vty))
+					vty_out(vty, "!%s", VTY_NEWLINE);
+			}
+		}
+	} else {
+		vty_out(vty, "%sCurrent configuration:%s", VTY_NEWLINE, VTY_NEWLINE);
+		vty_out(vty, "!%s", VTY_NEWLINE);
+
+		for (i = 0; i < vector_active(cmdvec); i++) {
+			if ((node = vector_slot(cmdvec, i)) && node->func) {
+				if ((*node->func) (vty))
+					vty_out(vty, "!%s", VTY_NEWLINE);
+			}
+		}
+		vty_out (vty, "end%s",VTY_NEWLINE);
+	}
+
+	return CMD_SUCCESS;
+}
+
+/* Write current configuration into the terminal. */
+ALIAS(config_write_terminal,
+      show_running_config_cmd,
+      "show running-config",
+      SHOW_STR
+      "running configuration\n")
+
+/* Write startup configuration into the terminal. */
+DEFUN(show_startup_config,
+      show_startup_config_cmd,
+      "show startup-config",
+      SHOW_STR
+      "Contentes of startup configuration\n")
+{
+	char buf[BUFSIZ];
+	FILE *confp;
+
+	confp = fopen(host.config, "r");
+	if (confp == NULL) {
+		vty_out(vty, "Can't open configuration file [%s]%s"
+			   , host.config, VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+
+	while (fgets(buf, BUFSIZ, confp)) {
+		char *cp = buf;
+
+		while (*cp != '\r' && *cp != '\n' && *cp != '\0')
+			cp++;
+		*cp = '\0';
+
+		vty_out(vty, "%s%s", buf, VTY_NEWLINE);
+	}
+
+	fclose(confp);
+
+	return CMD_SUCCESS;
+}
+
+/* Hostname configuration */
+DEFUN(config_hostname, 
+      hostname_cmd,
+      "hostname WORD",
+      "Set system's network name\n"
+      "This system's network name\n")
+{
+	if (!isalpha((int) *argv[0])) {
+		vty_out(vty, "Please specify string starting with alphabet%s", VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+
+	FREE_PTR(host.name);
+    
+	host.name = strdup(argv[0]);
+	return CMD_SUCCESS;
+}
+
+DEFUN (config_no_hostname, 
+       no_hostname_cmd,
+       "no hostname [HOSTNAME]",
+       NO_STR
+       "Reset system's network name\n"
+       "Host name of this router\n")
+{
+	FREE_PTR(host.name);
+	host.name = NULL;
+	return CMD_SUCCESS;
+}
+
+/* VTY interface password set. */
+DEFUN(config_password, password_cmd,
+      "password (8|) WORD",
+      "Assign the terminal connection password\n"
+      "Specifies a HIDDEN password will follow\n"
+      "dummy string \n"
+      "The HIDDEN line password string\n")
+{
+	/* Argument check. */
+	if (argc == 0) {
+		vty_out(vty, "Please specify password.%s", VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+
+	if (argc == 2) {
+		if (*argv[0] == '8') {
+			FREE_PTR(host.password);
+			host.password = NULL;
+			FREE_PTR(host.password_encrypt);
+			host.password_encrypt = strdup(argv[1]);
+			return CMD_SUCCESS;
+		} else {
+			vty_out(vty, "Unknown encryption type.%s", VTY_NEWLINE);
+			return CMD_WARNING;
+		}
+	}
+
+	if (!isalnum ((int) *argv[0])) {
+		vty_out(vty, "Please specify string starting with alphanumeric%s"
+			   , VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+
+	FREE_PTR(host.password);
+	host.password = NULL;
+
+	if (host.encrypt) {
+		FREE_PTR(host.password_encrypt);
+		host.password_encrypt = strdup(zencrypt(argv[0]));
+	} else
+		host.password = strdup(argv[0]);
+
+	return CMD_SUCCESS;
+}
+
+ALIAS(config_password, password_text_cmd,
+      "password LINE",
+      "Assign the terminal connection password\n"
+      "The UNENCRYPTED (cleartext) line password\n")
+
+/* VTY enable password set. */
+DEFUN(config_enable_password, enable_password_cmd,
+      "enable password (8|) WORD",
+      "Modify enable password parameters\n"
+      "Assign the privileged level password\n"
+      "Specifies a HIDDEN password will follow\n"
+      "dummy string \n"
+      "The HIDDEN 'enable' password string\n")
+{
+	/* Argument check. */
+	if (argc == 0) {
+		vty_out(vty, "Please specify password.%s", VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+
+	/* Crypt type is specified. */
+	if (argc == 2) {
+		if (*argv[0] == '8') {
+			FREE_PTR(host.enable);
+			host.enable = NULL;
+
+			FREE_PTR(host.enable_encrypt);
+			host.enable_encrypt = strdup(argv[1]);
+
+			return CMD_SUCCESS;
+		} else {
+			vty_out(vty, "Unknown encryption type.%s", VTY_NEWLINE);
+			return CMD_WARNING;
+		}
+	}
+
+	if (!isalnum ((int) *argv[0])) {
+		vty_out(vty, "Please specify string starting with alphanumeric%s", VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+
+	FREE_PTR(host.enable);
+	host.enable = NULL;
+
+	/* Plain password input. */
+	if (host.encrypt) {
+		FREE_PTR(host.enable_encrypt);
+		host.enable_encrypt = strdup(zencrypt(argv[0]));
+	} else {
+		host.enable = strdup(argv[0]);
+	}
+
+	return CMD_SUCCESS;
+}
+
+ALIAS(config_enable_password,
+      enable_password_text_cmd,
+      "enable password LINE",
+      "Modify enable password parameters\n"
+      "Assign the privileged level password\n"
+      "The UNENCRYPTED (cleartext) 'enable' password\n")
+
+/* VTY enable password delete. */
+DEFUN(no_config_enable_password, no_enable_password_cmd,
+      "no enable password",
+      NO_STR
+      "Modify enable password parameters\n"
+      "Assign the privileged level password\n")
+{
+	FREE_PTR(host.enable);
+	host.enable = NULL;
+
+	FREE_PTR(host.enable_encrypt);
+	host.enable_encrypt = NULL;
+
+	return CMD_SUCCESS;
+}
+	
+DEFUN(service_password_encrypt,
+      service_password_encrypt_cmd,
+      "service password-encryption",
+      "Set up miscellaneous service\n"
+      "Enable encrypted passwords\n")
+{
+	if (host.encrypt)
+		return CMD_SUCCESS;
+
+	host.encrypt = 1;
+
+	if (host.password) {
+		FREE_PTR(host.password_encrypt);
+		host.password_encrypt = strdup(zencrypt(host.password));
+	}
+
+	if (host.enable) {
+		FREE_PTR(host.enable_encrypt);
+		host.enable_encrypt = strdup(zencrypt(host.enable));
+	}
+
+	return CMD_SUCCESS;
+}
+
+DEFUN(no_service_password_encrypt,
+      no_service_password_encrypt_cmd,
+      "no service password-encryption",
+      NO_STR
+      "Set up miscellaneous service\n"
+      "Enable encrypted passwords\n")
+{
+	if (!host.encrypt)
+		return CMD_SUCCESS;
+
+	host.encrypt = 0;
+
+	FREE_PTR(host.password_encrypt);
+	host.password_encrypt = NULL;
+
+	FREE_PTR(host.enable_encrypt);
+	host.enable_encrypt = NULL;
+
+	return CMD_SUCCESS;
+}
+
+DEFUN(config_terminal_length, config_terminal_length_cmd,
+      "terminal length <0-512>",
+      "Set terminal line parameters\n"
+      "Set number of lines on a screen\n"
+      "Number of lines on screen (0 for no pausing)\n")
+{
+	int lines;
+	char *endptr = NULL;
+
+	lines = strtol(argv[0], &endptr, 10);
+	if (lines < 0 || lines > 512 || *endptr != '\0') {
+		vty_out(vty, "length is malformed%s", VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+	vty->lines = lines;
+
+	return CMD_SUCCESS;
+}
+
+DEFUN(config_terminal_no_length, config_terminal_no_length_cmd,
+      "terminal no length",
+      "Set terminal line parameters\n"
+      NO_STR
+      "Set number of lines on a screen\n")
+{
+	vty->lines = -1;
+	return CMD_SUCCESS;
+}
+
+DEFUN(service_terminal_length, service_terminal_length_cmd,
+      "service terminal-length <0-512>",
+      "Set up miscellaneous service\n"
+      "System wide terminal length configuration\n"
+      "Number of lines of VTY (0 means no line control)\n")
+{
+	int lines;
+	char *endptr = NULL;
+
+	lines = strtol(argv[0], &endptr, 10);
+	if (lines < 0 || lines > 512 || *endptr != '\0') {
+		vty_out(vty, "length is malformed%s", VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+	host.lines = lines;
+
+	return CMD_SUCCESS;
+}
+
+DEFUN(no_service_terminal_length, no_service_terminal_length_cmd,
+      "no service terminal-length [<0-512>]",
+      NO_STR
+      "Set up miscellaneous service\n"
+      "System wide terminal length configuration\n"
+      "Number of lines of VTY (0 means no line control)\n")
+{
+	host.lines = -1;
+	return CMD_SUCCESS;
+}
+
+DEFUN_HIDDEN(do_echo,
+	     echo_cmd,
+	     "echo .MESSAGE",
+	     "Echo a message back to the vty\n"
+	     "The message to echo\n")
+{
+	char *message;
+
+	vty_out(vty, "%s%s", ((message = argv_concat(argv, argc, 0)) ? message : "")
+		   , VTY_NEWLINE);
+	FREE_PTR(message);
+	return CMD_SUCCESS;
+}
+
+DEFUN(banner_motd_file,
+      banner_motd_file_cmd,
+      "banner motd file [FILE]",
+      "Set banner\n"
+      "Banner for motd\n"
+      "Banner from a file\n"
+      "Filename\n")
+{
+	FREE_PTR(host.motdfile);
+	host.motdfile = strdup(argv[0]);
+
+	return CMD_SUCCESS;
+}
+
+DEFUN(banner_motd_default,
+      banner_motd_default_cmd,
+      "banner motd default",
+      "Set banner string\n"
+      "Strings for motd\n"
+      "Default string\n")
+{
+	host.motd = default_motd;
+	return CMD_SUCCESS;
+}
+
+DEFUN(no_banner_motd,
+      no_banner_motd_cmd,
+      "no banner motd",
+      NO_STR
+      "Set banner string\n"
+      "Strings for motd\n")
+{
+	host.motd = NULL;
+	FREE_PTR(host.motdfile);
+	host.motdfile = NULL;
+	return CMD_SUCCESS;
+}
+
+/* Set config filename.  Called from vty.c */
+void
+host_config_set(char *filename)
+{
+	FREE_PTR(host.config);
+	host.config = strdup(filename);
+}
+
+void
+install_default(node_type_t node)
+{
+	install_element(node, &config_exit_cmd);
+	install_element(node, &config_quit_cmd);
+	install_element(node, &config_end_cmd);
+	install_element(node, &config_help_cmd);
+	install_element(node, &config_list_cmd);
+
+	install_element(node, &config_write_terminal_cmd);
+	install_element(node, &config_write_file_cmd);
+	install_element(node, &config_write_memory_cmd);
+	install_element(node, &config_write_cmd);
+	install_element(node, &show_running_config_cmd);
+}
+
+/* Initialize command interface. Install basic nodes and commands. */
+void
+cmd_init(void)
+{
+	command_cr = strdup("<cr>");
+	desc_cr.cmd = command_cr;
+	desc_cr.str = strdup("");
+
+	/* Allocate initial top vector of commands. */
+	cmdvec = vector_init(VECTOR_DEFAULT_SIZE);
+
+	/* Default host value settings. */
+	host.name = NULL;
+	host.password = NULL;
+	host.enable = NULL;
+	host.logfile = NULL;
+	host.config = NULL;
+	host.lines = -1;
+	host.motd = default_motd;
+	host.motdfile = NULL;
+
+	/* Install top nodes. */
+	install_node(&view_node, NULL);
+	install_node(&enable_node, NULL);
+	install_node(&auth_node, NULL);
+	install_node(&auth_enable_node, NULL);
+	install_node(&config_node, config_write_host);
+
+	/* Each node's basic commands. */
+	install_element(VIEW_NODE, &show_version_cmd);
+	install_element(VIEW_NODE, &config_list_cmd);
+	install_element(VIEW_NODE, &config_exit_cmd);
+	install_element(VIEW_NODE, &config_quit_cmd);
+	install_element(VIEW_NODE, &config_help_cmd);
+	install_element(VIEW_NODE, &config_enable_cmd);
+	install_element(VIEW_NODE, &config_terminal_length_cmd);
+	install_element(VIEW_NODE, &config_terminal_no_length_cmd);
+	install_element(VIEW_NODE, &echo_cmd);
+
+//	install_element(ENABLE_NODE, &config_exit_cmd);
+	install_default(ENABLE_NODE);
+	install_element(ENABLE_NODE, &config_disable_cmd);
+	install_element(ENABLE_NODE, &config_terminal_cmd);
+	install_element(ENABLE_NODE, &copy_runningconfig_startupconfig_cmd);
+
+	install_element(ENABLE_NODE, &show_startup_config_cmd);
+	install_element(ENABLE_NODE, &show_version_cmd);
+
+	install_element(ENABLE_NODE, &config_terminal_length_cmd);
+	install_element(ENABLE_NODE, &config_terminal_no_length_cmd);
+	install_element(ENABLE_NODE, &echo_cmd);
+
+	install_default(CONFIG_NODE);
+//	install_element(CONFIG_NODE, &config_exit_cmd);
+
+  
+	install_element(CONFIG_NODE, &hostname_cmd);
+	install_element(CONFIG_NODE, &no_hostname_cmd);
+
+	install_element(CONFIG_NODE, &password_cmd);
+	install_element(CONFIG_NODE, &password_text_cmd);
+	install_element(CONFIG_NODE, &enable_password_cmd);
+	install_element(CONFIG_NODE, &enable_password_text_cmd);
+	install_element(CONFIG_NODE, &no_enable_password_cmd);
+
+	install_element(CONFIG_NODE, &service_password_encrypt_cmd);
+	install_element(CONFIG_NODE, &no_service_password_encrypt_cmd);
+	install_element(CONFIG_NODE, &banner_motd_default_cmd);
+	install_element(CONFIG_NODE, &banner_motd_file_cmd);
+	install_element(CONFIG_NODE, &no_banner_motd_cmd);
+	install_element(CONFIG_NODE, &service_terminal_length_cmd);
+	install_element(CONFIG_NODE, &no_service_terminal_length_cmd);
+
+	srand(time(NULL));
+}
+
+void
+cmd_terminate(void)
+{
+	unsigned int i, j, k, l;
+	cmd_node_t *cmd_node;
+	cmd_element_t *cmd_element;
+	desc_t *desc;
+	vector_t *cmd_node_v, *cmd_element_v, *desc_v;
+
+	if (cmdvec) {
+		for (i = 0; i < vector_active(cmdvec); i++) {
+			if ((cmd_node = vector_slot(cmdvec, i)) != NULL) {
+				cmd_node_v = cmd_node->cmd_vector;
+
+				for (j = 0; j < vector_active(cmd_node_v); j++) {
+					if ((cmd_element = vector_slot(cmd_node_v, j)) != NULL &&
+					    cmd_element->strvec != NULL) {
+						cmd_element_v = cmd_element->strvec;
+
+						for (k = 0; k < vector_active(cmd_element_v); k++) {
+							if ((desc_v = vector_slot(cmd_element_v, k)) != NULL) {
+								for (l = 0; l < vector_active(desc_v); l++)
+									if ((desc = vector_slot(desc_v, l)) != NULL) {
+										FREE_PTR(desc->cmd);
+										FREE_PTR(desc->str);
+										FREE(desc);
+									}
+									vector_free(desc_v);
+							}
+						}
+
+						cmd_element->strvec = NULL;
+						vector_free(cmd_element_v);
+					}
+				}
+
+				vector_free(cmd_node_v);
+			}
+		}
+
+		vector_free (cmdvec);
+		cmdvec = NULL;
+	}
+
+	FREE_PTR(command_cr);
+	FREE_PTR(desc_cr.str);
+	FREE_PTR(host.name);
+	FREE_PTR(host.password);
+	FREE_PTR(host.password_encrypt);
+	FREE_PTR(host.enable);
+	FREE_PTR(host.enable_encrypt);
+	FREE_PTR(host.motdfile);
+	FREE_PTR(host.config);
+}
diff -rupN keepalived-1.2.7/lib/command.h keepalived-1.2.7-unicast/lib/command.h
--- keepalived-1.2.7/lib/command.h	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/lib/command.h	2013-05-24 10:12:36.641169100 +0200
@@ -0,0 +1,306 @@
+/*
+ * Soft:        Keepalived is a failover program for the LVS project
+ *              <www.linuxvirtualserver.org>. It monitor & manipulate
+ *              a loadbalanced server pool using multi-layer checks.
+ *
+ * Part:        command.c include file.
+ *
+ * Author:      Alexandre Cassen, <acassen@linux-vs.org>
+ *
+ *              This program is distributed in the hope that it will be useful,
+ *              but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *              See the GNU General Public License for more details.
+ *
+ *              This program is free software; you can redistribute it and/or
+ *              modify it under the terms of the GNU General Public License
+ *              as published by the Free Software Foundation; either version
+ *              2 of the License, or (at your option) any later version.
+ *
+ * Copyright (C) 2001-2012 Alexandre Cassen, <acassen@linux-vs.org>
+ */
+
+#ifndef _COMMAND_H
+#define _COMMAND_H
+
+#include "vector.h"
+#include "vty.h"
+
+/*
+ *	command definition
+ */
+typedef struct _host {
+	char			*name;			/* Host name of this router. */
+
+	char			*password;		/* Password for vty interface. */
+	char			*password_encrypt;
+
+	char			*enable;		/* Enable password */
+	char			*enable_encrypt;
+
+	int			lines;			/* System wide terminal lines. */
+
+	char			*logfile;		/* Log filename. */
+
+	char			*config;		/* config file name of this host */
+
+	int			advanced;		/* Flags for services */
+	int			encrypt;
+
+	const char		*motd;			/* Banner configuration. */
+	char			*motdfile;
+} host_t;
+
+/* There are some command levels which called from command node. */
+typedef enum _node_type {
+	AUTH_NODE,					/* Authentication mode of vty interface. */
+	VIEW_NODE,					/* View node. Default mode of vty interface. */
+	AUTH_ENABLE_NODE,				/* Authentication mode for change enable. */
+	ENABLE_NODE,					/* Enable node. */
+	CONFIG_NODE,					/* Config node. Default mode of config file. */
+	SERVICE_NODE,					/* Service node. */
+	DEBUG_NODE,					/* Debug node. */
+	CFG_LOG_NODE,					/* Configure the logging */
+
+	VTY_NODE,					/* Vty node. */
+
+	CHECK_NODE,					/* Checker framework commands. */
+	VRRP_NODE,					/* VRRP framework commands. */
+} node_type_t;
+
+/* Completion match types. */
+typedef enum _match_type {
+	no_match,
+	extend_match,
+	ipv4_prefix_match,
+	ipv4_match,
+	ipv6_prefix_match,
+	ipv6_match,
+	range_match,
+	vararg_match,
+	partly_match,
+	exact_match
+} match_type_t;
+
+/* Node which has some commands and prompt string and configuration
+ * function pointer . */
+typedef struct _cmd_node {
+	node_type_t		node;			/* Node index. */
+	const char		*prompt;		/* Prompt character at vty interface. */
+	int			vtysh;			/* Is this node's configuration goes to vtysh ? */
+	int			(*func) (vty_t *);	/* Node's configuration write function */
+	vector_t		*cmd_vector;		/* Vector of this node's command list. */
+} cmd_node_t;
+
+/* Structure of command element. */
+typedef struct _cmd_element {
+	const char		*string;		/* Command specification by string. */
+	int			(*func) (struct _cmd_element *,
+					 vty_t *, int, const char *[]);
+	const char		*doc;			/* Documentation of this command. */
+	int			daemon;			/* Daemon to which this command belong. */
+	vector_t		*strvec;		/* Pointing out each description vector. */
+	unsigned int		cmdsize;		/* Command index count. */
+	char			*config;		/* Configuration string */
+	vector_t		*subconfig;		/* Sub configuration string */
+	uint8_t			attr;			/* Command attributes */
+} cmd_element_t;
+
+/* Command description structure. */
+typedef struct _desc {
+	char			*cmd;			/* Command string. */
+	char			*str;			/* Command's description. */
+} desc_t;
+
+
+/*
+ *	Some defines
+ */
+
+enum {
+	CMD_ATTR_DEPRECATED = 1,
+	CMD_ATTR_HIDDEN,
+};
+
+#define CMD_SUCCESS		0
+#define CMD_WARNING		1
+#define CMD_ERR_NO_MATCH	2
+#define CMD_ERR_AMBIGUOUS	3
+#define CMD_ERR_INCOMPLETE	4
+#define CMD_ERR_EXEED_ARGC_MAX	5
+#define CMD_ERR_NOTHING_TODO	6
+#define CMD_COMPLETE_FULL_MATCH	7
+#define CMD_COMPLETE_MATCH	8
+#define CMD_COMPLETE_LIST_MATCH	9
+#define CMD_SUCCESS_DAEMON	10
+
+#define CMD_ARGC_MAX		256
+
+#define IPV6_ADDR_STR		"0123456789abcdefABCDEF:.%"
+#define IPV6_PREFIX_STR		"0123456789abcdefABCDEF:.%/"
+#define STATE_START		1
+#define STATE_COLON		2
+#define STATE_DOUBLE		3
+#define STATE_ADDR		4
+#define STATE_DOT		5
+#define STATE_SLASH		6
+#define STATE_MASK		7
+
+#define DECIMAL_STRLEN_MAX	10
+#define INIT_MATCHVEC_SIZE	10
+
+
+/*
+ *	Some usefull macros
+ */
+
+/* helper defines for end-user DEFUN* macros */
+#define DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attrs, dnum)	\
+	cmd_element_t cmdname = {						\
+		.string = cmdstr,						\
+		.func = funcname,						\
+		.doc = helpstr,							\
+		.attr = attrs,							\
+		.daemon = dnum,							\
+	};
+
+#define DEFUN_CMD_FUNC_DECL(funcname) \
+	static int funcname(cmd_element_t *, vty_t *, int, const char *[]);
+
+#define DEFUN_CMD_FUNC_TEXT(funcname)						\
+	static int funcname(cmd_element_t *self __attribute__ ((unused)),	\
+			    vty_t *vty __attribute__ ((unused)),		\
+			    int argc __attribute__ ((unused)),			\
+			    const char *argv[] __attribute__ ((unused)))
+
+/* DEFUN for vty command interafce. Little bit hacky ;-). */
+#define DEFUN(funcname, cmdname, cmdstr, helpstr)				\
+	DEFUN_CMD_FUNC_DECL(funcname)						\
+	DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0)		\
+	DEFUN_CMD_FUNC_TEXT(funcname)
+
+#define DEFUN_ATTR(funcname, cmdname, cmdstr, helpstr, attr)			\
+	DEFUN_CMD_FUNC_DECL(funcname)						\
+	DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, 0)		\
+	DEFUN_CMD_FUNC_TEXT(funcname)
+
+#define DEFUN_HIDDEN(funcname, cmdname, cmdstr, helpstr)			\
+	DEFUN_ATTR (funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN)
+
+#define DEFUN_DEPRECATED(funcname, cmdname, cmdstr, helpstr)			\
+	DEFUN_ATTR (funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED)
+
+/* DEFUN_NOSH for commands that vtysh should ignore */
+#define DEFUN_NOSH(funcname, cmdname, cmdstr, helpstr)				\
+	DEFUN(funcname, cmdname, cmdstr, helpstr)
+
+/* DEFSH for vtysh. */
+#define DEFSH(daemon, cmdname, cmdstr, helpstr)					\
+	DEFUN_CMD_ELEMENT(NULL, cmdname, cmdstr, helpstr, 0, daemon)
+
+/* DEFUN + DEFSH */
+#define DEFUNSH(daemon, funcname, cmdname, cmdstr, helpstr)			\
+	DEFUN_CMD_FUNC_DECL(funcname)						\
+	DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, daemon)	\
+	DEFUN_CMD_FUNC_TEXT(funcname)
+
+/* DEFUN + DEFSH with attributes */
+#define DEFUNSH_ATTR(daemon, funcname, cmdname, cmdstr, helpstr, attr)		\
+	DEFUN_CMD_FUNC_DECL(funcname)						\
+	DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, daemon)	\
+	DEFUN_CMD_FUNC_TEXT(funcname)
+
+#define DEFUNSH_HIDDEN(daemon, funcname, cmdname, cmdstr, helpstr)		\
+	DEFUNSH_ATTR (daemon, funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN)
+
+#define DEFUNSH_DEPRECATED(daemon, funcname, cmdname, cmdstr, helpstr)		\
+	DEFUNSH_ATTR (daemon, funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED)
+
+/* ALIAS macro which define existing command's alias. */
+#define ALIAS(funcname, cmdname, cmdstr, helpstr)				\
+	DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0)
+
+#define ALIAS_ATTR(funcname, cmdname, cmdstr, helpstr, attr)			\
+	DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, 0)
+
+#define ALIAS_HIDDEN(funcname, cmdname, cmdstr, helpstr)			\
+	DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, 0)
+
+#define ALIAS_DEPRECATED(funcname, cmdname, cmdstr, helpstr)			\
+	DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED, 0)
+
+#define ALIAS_SH(daemon, funcname, cmdname, cmdstr, helpstr)			\
+	DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, daemon)
+
+#define ALIAS_SH_HIDDEN(daemon, funcname, cmdname, cmdstr, helpstr)		\
+	DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, daemon)
+
+#define ALIAS_SH_DEPRECATED(daemon, funcname, cmdname, cmdstr, helpstr)		\
+	DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED, daemon)
+
+#define CMD_OPTION(S)	((S[0]) == '[')
+#define CMD_VARIABLE(S)	(((S[0]) >= 'A' && (S[0]) <= 'Z') || ((S[0]) == '<'))
+#define CMD_VARARG(S)	((S[0]) == '.')
+#define CMD_RANGE(S)	((S[0] == '<'))
+
+#define CMD_IPV4(S)		((strcmp ((S), "A.B.C.D") == 0))
+#define CMD_IPV4_PREFIX(S)	((strcmp ((S), "A.B.C.D/M") == 0))
+#define CMD_IPV6(S)		((strcmp ((S), "X:X::X:X") == 0))
+#define CMD_IPV6_PREFIX(S)	((strcmp ((S), "X:X::X:X/M") == 0))
+
+/* Common descriptions. */
+#define SHOW_STR "Show running system information\n"
+#define IP_STR "IP information\n"
+#define IPV6_STR "IPv6 information\n"
+#define NO_STR "Negate a command or set its defaults\n"
+#define CLEAR_STR "Reset functions\n"
+#define DEBUG_STR "Debugging functions (see also 'undebug')\n"
+#define UNDEBUG_STR "Disable debugging functions (see also 'debug')\n"
+#define ROUTER_STR "Enable a routing process\n"
+#define MATCH_STR "Match values from routing table\n"
+#define SET_STR "Set values in destination routing protocol\n"
+#define OUT_STR "Filter outgoing routing updates\n"
+#define IN_STR  "Filter incoming routing updates\n"
+#define V4NOTATION_STR "specify by IPv4 address notation(e.g. 0.0.0.0)\n"
+#define IP6_STR "IPv6 Information\n"
+#define SECONDS_STR "<1-65535> Seconds\n"
+#define ROUTE_STR "Routing Table\n"
+#define PREFIX_LIST_STR "Build a prefix list\n"
+
+#define CONF_BACKUP_EXT ".sav"
+
+
+/*
+ *	Global vars
+ */
+extern cmd_element_t config_exit_cmd;
+extern cmd_element_t config_help_cmd;
+extern cmd_element_t config_list_cmd;
+extern host_t host;
+extern char *command_cr;
+
+
+/*
+ *	Prototypes
+ */
+extern void install_node(cmd_node_t *, int (*) (vty_t *));
+extern void install_default(node_type_t);
+extern void install_element(node_type_t, cmd_element_t *);
+extern void sort_node(void);
+extern char *argv_concat(const char **, int, int);
+extern vector_t *cmd_make_strvec(const char *);
+extern void cmd_free_strvec(vector_t *);
+extern vector_t *cmd_describe_command(vector_t *, vty_t *, int *);
+extern char **cmd_complete_command(vector_t *, vty_t *, int *);
+extern const char *cmd_prompt(node_type_t);
+extern int config_from_file(vty_t *, FILE *);
+extern node_type_t node_parent(node_type_t);
+extern int cmd_execute_command(vector_t *, vty_t *, cmd_element_t **, int);
+extern int cmd_execute_command_strict(vector_t *, vty_t *, cmd_element_t **);
+extern void config_replace_string(cmd_element_t *, char *, ...);
+extern void cmd_init(void);
+extern void cmd_terminate(void);
+extern char *host_config_file(void);
+extern void host_config_set(char *);
+
+#endif
diff -rupN keepalived-1.2.7/lib/config.h.in keepalived-1.2.7-unicast/lib/config.h.in
--- keepalived-1.2.7/lib/config.h.in	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/lib/config.h.in	2013-05-24 10:12:36.642169200 +0200
@@ -0,0 +1,31 @@
+/*
+ * Soft:        Keepalived is a failover program for the LVS project
+ *              <www.linuxvirtualserver.org>. It monitor & manipulate
+ *              a loadbalanced server pool using multi-layer checks.
+ *
+ * Part:        Global configuration elements.
+ *
+ * Author:      Alexandre Cassen, <acassen@linux-vs.org>
+ *
+ *              This program is distributed in the hope that it will be useful,
+ *              but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *              See the GNU General Public License for more details.
+ *
+ *              This program is free software; you can redistribute it and/or
+ *              modify it under the terms of the GNU General Public License
+ *              as published by the Free Software Foundation; either version
+ *              2 of the License, or (at your option) any later version.
+ *
+ * Copyright (C) 2001-2012 Alexandre Cassen, <acassen@linux-vs.org>
+ */
+#ifndef _CONFIG_H
+#define _CONFIG_H
+
+#define LOG_FACILITY_MAX        7
+#define PROG                    "Keepalived"
+#define VERSION_STRING PROG" v@VERSION@ (@VERSION_DATE@)\n"
+#define COPYRIGHT_STRING	"Copyright (C) 2001-2012 Alexandre Cassen, <acassen@gmail.com>"
+
+
+#endif
diff -rupN keepalived-1.2.7/lib/logger.c keepalived-1.2.7-unicast/lib/logger.c
--- keepalived-1.2.7/lib/logger.c	2012-08-29 00:05:12.000000000 +0200
+++ keepalived-1.2.7-unicast/lib/logger.c	2013-05-24 10:12:36.650169600 +0200
@@ -28,7 +28,8 @@
 static int log_console = 0;
 
 void
-enable_console_log(void) {
+enable_console_log(void)
+{
 	log_console = 1;
 }
 
diff -rupN keepalived-1.2.7/lib/Makefile.in keepalived-1.2.7-unicast/lib/Makefile.in
--- keepalived-1.2.7/lib/Makefile.in	2012-08-29 00:05:12.000000000 +0200
+++ keepalived-1.2.7-unicast/lib/Makefile.in	2013-05-24 10:12:36.633168600 +0200
@@ -13,7 +13,7 @@ COMPILE	 = $(CC) $(CFLAGS) $(DEFS)
 
 OBJS = 	memory.o utils.o notify.o timer.o scheduler.o \
 	vector.o list.o html.o parser.o signals.o logger.o \
-	list_head.o
+	list_head.o buffer.o command.o vty.o
 HEADERS = $(OBJS:.o=.h)
 
 .c.o:
@@ -25,6 +25,7 @@ clean:
 	rm -f *.a *.o *~
 
 distclean: clean
+	rm -f config.h
 	rm -f Makefile
 
 memory.o: memory.c memory.h utils.h
@@ -39,3 +40,8 @@ parser.o: parser.c parser.h memory.h
 signals.o: signals.c signals.h
 logger.o: logger.c logger.h
 list_head.o: list_head.c list_head.h
+buffer.o: buffer.c buffer.h memory.h
+command.o: command.c command.h vector.h memory.h vty.h timer.h \
+	config.h
+vty.o: vty.c vty.h scheduler.h timer.h utils.h command.h logger.h \
+	memory.h
diff -rupN keepalived-1.2.7/lib/vty.c keepalived-1.2.7-unicast/lib/vty.c
--- keepalived-1.2.7/lib/vty.c	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/lib/vty.c	2013-05-24 10:12:36.669170700 +0200
@@ -0,0 +1,2142 @@
+/*
+ * Soft:        Keepalived is a failover program for the LVS project
+ *              <www.linuxvirtualserver.org>. It monitor & manipulate
+ *              a loadbalanced server pool using multi-layer checks.
+ *
+ * Part:        Virtual Terminal.
+ *              This code is coming from quagga.net.
+ *
+ * Author:      Alexandre Cassen, <acassen@linux-vs.org>
+ *
+ *              This program is distributed in the hope that it will be useful,
+ *              but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *              See the GNU General Public License for more details.
+ *
+ *              This program is free software; you can redistribute it and/or
+ *              modify it under the terms of the GNU General Public License
+ *              as published by the Free Software Foundation; either version
+ *              2 of the License, or (at your option) any later version.
+ *
+ * Copyright (C) 2001-2012 Alexandre Cassen, <acassen@linux-vs.org>
+ */
+#include <errno.h>
+#include <ctype.h>
+#include <termios.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <time.h>
+#include <arpa/telnet.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <netinet/tcp.h>
+
+#include "scheduler.h"
+#include "vty.h"
+#include "timer.h"
+#include "utils.h"
+#include "command.h"
+#include "memory.h"
+#include "logger.h"
+
+
+static void vty_event(event_t, int, vty_t *);
+
+/* Extern host structure from command.c */
+extern host_t host;
+
+/* Vector which store each vty structure. */
+static vector_t *vtyvec;
+
+/* Vty timeout value. */
+static unsigned long vty_timeout_val = VTY_TIMEOUT_DEFAULT;
+
+/* VTY server thread. */
+vector_t *Vvty_serv_thread;
+
+/* Current directory. */
+char *vty_cwd = NULL;
+
+/* Configure lock. */
+static int vty_config;
+
+/* Login password check. */
+static int no_password_check = 0;
+
+/* Integrated configuration file path */
+#define SYSCONFDIR	"/etc/keepalived"
+char integrate_default[] = SYSCONFDIR INTEGRATE_DEFAULT_CONFIG;
+
+/* VTY standard output function. */
+int
+vty_out(vty_t *vty, const char *format, ...)
+{
+	va_list args;
+	int len = 0;
+	int size = 1024;
+	char buf[1024];
+	char *p = NULL;
+
+	if (vty_shell (vty)) {
+		va_start(args, format);
+		vprintf(format, args);
+		va_end(args);
+	} else {
+		/* Try to write to initial buffer.  */
+		va_start(args, format);
+		len = vsnprintf(buf, sizeof buf, format, args);
+		va_end(args);
+
+		/* Initial buffer is not enough.  */
+		if (len < 0 || len >= size) {
+		for (;;) {
+			if (len > -1)
+				size = len + 1;
+			else
+				size = size * 2;
+
+			p = REALLOC(p, size);
+			if (! p)
+				return -1;
+
+			va_start(args, format);
+			len = vsnprintf(p, size, format, args);
+			va_end(args);
+
+			if (len > -1 && len < size)
+				break;
+		}
+	}
+
+	/* When initial buffer is enough to store all output.  */
+	if (! p)
+		p = buf;
+
+	/* Pointer p must point out buffer. */
+	buffer_put(vty->obuf, (u_char *) p, len);
+
+	/* If p is not different with buf, it is allocated buffer.  */
+	if (p != buf)
+		FREE(p);
+	}
+
+	return len;
+}
+
+/* Output current time to vty. */
+void
+vty_time_print(vty_t *vty, int cr)
+{
+	struct tm tmp;
+	time_t current_time;
+	char buf[25];
+
+	/* Get current time */
+	current_time = time(NULL);
+	memset(&tmp, 0, sizeof(struct tm));
+	tmp.tm_isdst = -1;
+	localtime_r(&current_time, &tmp);
+	strftime(buf, sizeof(buf), "%Y/%m/%d %H:%M:%S", &tmp);
+
+	vty_out(vty, "%s%s", buf, (cr)?"\n":" ");
+}
+
+/* Say hello to vty interface. */
+void
+vty_hello (vty_t *vty)
+{
+	if (host.motdfile) {
+		FILE *f;
+		char buf[4096];
+
+		f = fopen(host.motdfile, "r");
+		if (f) {
+			while (fgets(buf, sizeof(buf), f)) {
+				char *s;
+				/* work backwards to ignore trailling isspace() */
+				for (s = buf + strlen(buf); (s > buf) && isspace((int)*(s - 1));
+				     s--);
+					*s = '\0';
+				vty_out(vty, "%s%s", buf, VTY_NEWLINE);
+			}
+			fclose (f);
+		} else {
+			vty_out(vty, "MOTD file not found%s", VTY_NEWLINE);
+		}
+	} else if (host.motd) {
+		vty_out(vty, "%s", host.motd);
+	}
+}
+
+/* Put out prompt and wait input from user. */
+static void
+vty_prompt(vty_t *vty)
+{
+	struct utsname names;
+	const char*hostname;
+
+	if (vty->type == VTY_TERM) {
+		hostname = host.name;
+		if (!hostname) {
+			uname(&names);
+			hostname = names.nodename;
+		}
+		vty_out(vty, cmd_prompt (vty->node), hostname);
+	}
+}
+
+/* Send WILL TELOPT_ECHO to remote server. */
+static void
+vty_will_echo(vty_t *vty)
+{
+	unsigned char cmd[] = { IAC, WILL, TELOPT_ECHO, '\0' };
+	vty_out(vty, "%s", cmd);
+}
+
+/* Make suppress Go-Ahead telnet option. */
+static void
+vty_will_suppress_go_ahead(vty_t *vty)
+{
+	unsigned char cmd[] = { IAC, WILL, TELOPT_SGA, '\0' };
+	vty_out(vty, "%s", cmd);
+}
+
+/* Make don't use linemode over telnet. */
+static void
+vty_dont_linemode(vty_t *vty)
+{
+	unsigned char cmd[] = { IAC, DONT, TELOPT_LINEMODE, '\0' };
+	vty_out(vty, "%s", cmd);
+}
+
+/* Use window size. */
+static void
+vty_do_window_size(vty_t *vty)
+{
+	unsigned char cmd[] = { IAC, DO, TELOPT_NAWS, '\0' };
+	vty_out(vty, "%s", cmd);
+}
+
+/* Allocate new vty struct. */
+vty_t *
+vty_new(void)
+{
+	vty_t *new = (vty_t *) MALLOC(sizeof(vty_t));
+
+	new->obuf = buffer_new(0);	/* Use default buffer size. */
+	new->buf = (char *) MALLOC(VTY_BUFSIZ);
+	new->max = VTY_BUFSIZ;
+
+	return new;
+}
+
+/* Authentication of vty */
+static void
+vty_auth(vty_t *vty, char *buf)
+{
+	char *passwd = NULL;
+	node_type_t next_node = 0;
+	int fail;
+	char *crypt (const char *, const char *);
+
+	switch (vty->node) {
+	case AUTH_NODE:
+		if (host.encrypt)
+			passwd = host.password_encrypt;
+		else
+			passwd = host.password;
+		if (host.advanced)
+			next_node = host.enable ? VIEW_NODE : ENABLE_NODE;
+		else
+			next_node = VIEW_NODE;
+		break;
+	case AUTH_ENABLE_NODE:
+		if (host.encrypt)
+			passwd = host.enable_encrypt;
+		else
+			passwd = host.enable;
+		next_node = ENABLE_NODE;
+		break;
+	}
+
+	if (passwd) {
+		if (host.encrypt)
+			fail = strcmp (crypt(buf, passwd), passwd);
+		else
+			fail = strcmp (buf, passwd);
+	} else {
+		fail = 1;
+	}
+
+	if (!fail) {
+		vty->fail = 0;
+		vty->node = next_node;	/* Success ! */
+	} else {
+		vty->fail++;
+		if (vty->fail >= 3) {
+			if (vty->node == AUTH_NODE) {
+				vty_out(vty, "%% Bad passwords, too many failures!%s", VTY_NEWLINE);
+				vty->status = VTY_CLOSE;
+			} else {
+				/* AUTH_ENABLE_NODE */
+				vty->fail = 0;
+				vty_out(vty, "%% Bad enable passwords, too many failures!%s", VTY_NEWLINE);
+				vty->node = VIEW_NODE;
+			}
+		}
+	}
+}
+
+/* Command execution over the vty interface. */
+static int
+vty_command(vty_t *vty, char *buf)
+{
+	int ret;
+	vector_t *vline;
+
+	/* Split readline string up into the vector */
+	vline = cmd_make_strvec(buf);
+
+	if (vline == NULL)
+		return CMD_SUCCESS;
+
+	ret = cmd_execute_command(vline, vty, NULL, 0);
+
+	if (ret != CMD_SUCCESS) {
+		switch (ret) {
+		case CMD_WARNING:
+			if (vty->type == VTY_FILE)
+				vty_out(vty, "Warning...%s", VTY_NEWLINE);
+			break;
+		case CMD_ERR_AMBIGUOUS:
+			vty_out(vty, "%% Ambiguous command.%s", VTY_NEWLINE);
+			break;
+		case CMD_ERR_NO_MATCH:
+			vty_out(vty, "%% Unknown command: %s%s", buf, VTY_NEWLINE);
+			break;
+		case CMD_ERR_INCOMPLETE:
+			vty_out(vty, "%% Command incomplete.%s", VTY_NEWLINE);
+			break;
+		}
+	}
+
+	cmd_free_strvec(vline);
+
+	return ret;
+}
+
+static const char telnet_backward_char = 0x08;
+static const char telnet_space_char = ' ';
+
+/* Basic function to write buffer to vty. */
+static void
+vty_write(vty_t *vty, const char *buf, size_t nbytes)
+{
+	if ((vty->node == AUTH_NODE) || (vty->node == AUTH_ENABLE_NODE))
+		return;
+
+	/* Should we do buffering here ?  And make vty_flush (vty) ? */
+	buffer_put(vty->obuf, buf, nbytes);
+}
+
+/* Ensure length of input buffer.  Is buffer is short, double it. */
+static void
+vty_ensure(vty_t *vty, int length)
+{
+	if (vty->max <= length) {
+		vty->max *= 2;
+		vty->buf = REALLOC(vty->buf, vty->max);
+	}
+}
+
+/* Basic function to insert character into vty. */
+static void
+vty_self_insert(vty_t *vty, char c)
+{
+	int i, length;
+
+	vty_ensure(vty, vty->length + 1);
+	length = vty->length - vty->cp;
+	memmove(&vty->buf[vty->cp + 1], &vty->buf[vty->cp], length);
+	vty->buf[vty->cp] = c;
+
+	vty_write(vty, &vty->buf[vty->cp], length + 1);
+	for (i = 0; i < length; i++)
+		vty_write(vty, &telnet_backward_char, 1);
+
+	vty->cp++;
+	vty->length++;
+}
+
+/* Self insert character 'c' in overwrite mode. */
+static void
+vty_self_insert_overwrite(vty_t *vty, char c)
+{
+	vty_ensure(vty, vty->length + 1);
+	vty->buf[vty->cp++] = c;
+
+	if (vty->cp > vty->length)
+		vty->length++;
+
+	if ((vty->node == AUTH_NODE) || (vty->node == AUTH_ENABLE_NODE))
+		return;
+
+	vty_write(vty, &c, 1);
+}
+
+/* Insert a word into vty interface with overwrite mode. */
+static void
+vty_insert_word_overwrite(vty_t *vty, char *str)
+{
+	int len = strlen (str);
+	vty_write(vty, str, len);
+	strcpy(&vty->buf[vty->cp], str);
+	vty->cp += len;
+	vty->length = vty->cp;
+}
+
+/* Forward character. */
+static void
+vty_forward_char(vty_t *vty)
+{
+	if (vty->cp < vty->length) {
+		vty_write(vty, &vty->buf[vty->cp], 1);
+		vty->cp++;
+	}
+}
+
+/* Backward character. */
+static void
+vty_backward_char(vty_t *vty)
+{
+	if (vty->cp > 0) {
+		vty->cp--;
+		vty_write(vty, &telnet_backward_char, 1);
+	}
+}
+
+/* Move to the beginning of the line. */
+static void
+vty_beginning_of_line(vty_t *vty)
+{
+	while (vty->cp) {
+		vty_backward_char(vty);
+	}
+}
+
+/* Move to the end of the line. */
+static void
+vty_end_of_line(vty_t *vty)
+{
+  while (vty->cp < vty->length)
+    vty_forward_char (vty);
+}
+
+static void vty_kill_line_from_beginning(vty_t *);
+static void vty_redraw_line(vty_t *);
+
+/* Print command line history.  This function is called from
+ * vty_next_line and vty_previous_line. */
+static void
+vty_history_print(vty_t *vty)
+{
+	int length;
+
+	vty_kill_line_from_beginning(vty);
+
+	/* Get previous line from history buffer */
+	length = strlen(vty->hist[vty->hp]);
+	memcpy(vty->buf, vty->hist[vty->hp], length);
+	vty->cp = vty->length = length;
+
+	/* Redraw current line */
+	vty_redraw_line(vty);
+}
+
+/* Show next command line history. */
+static void
+vty_next_line(vty_t *vty)
+{
+	int try_index;
+
+	if (vty->hp == vty->hindex)
+		return;
+
+	/* Try is there history exist or not. */
+	try_index = vty->hp;
+	if (try_index == (VTY_MAXHIST - 1)) {
+		try_index = 0;
+	} else {
+		try_index++;
+	}
+
+	/* If there is not history return. */
+	if (vty->hist[try_index] == NULL) {
+		return;
+	} else {
+		vty->hp = try_index;
+	}
+
+	vty_history_print(vty);
+}
+
+/* Show previous command line history. */
+static void
+vty_previous_line(vty_t *vty)
+{
+	int try_index;
+
+	try_index = vty->hp;
+	if (try_index == 0) {
+		try_index = VTY_MAXHIST - 1;
+	} else {
+		try_index--;
+	}
+
+	if (vty->hist[try_index] == NULL) {
+		return;
+	} else {
+		vty->hp = try_index;
+	}
+
+	vty_history_print(vty);
+}
+
+/* This function redraw all of the command line character. */
+static void
+vty_redraw_line(vty_t *vty)
+{
+	vty_write(vty, vty->buf, vty->length);
+	vty->cp = vty->length;
+}
+
+/* Forward word. */
+static void
+vty_forward_word(vty_t *vty)
+{
+	while (vty->cp != vty->length && vty->buf[vty->cp] != ' ')
+		vty_forward_char(vty);
+  
+	while (vty->cp != vty->length && vty->buf[vty->cp] == ' ')
+		vty_forward_char(vty);
+}
+
+/* Backward word without skipping training space. */
+static void
+vty_backward_pure_word(vty_t *vty)
+{
+	while (vty->cp > 0 && vty->buf[vty->cp - 1] != ' ')
+		vty_backward_char(vty);
+}
+
+/* Backward word. */
+static void
+vty_backward_word(vty_t *vty)
+{
+	while (vty->cp > 0 && vty->buf[vty->cp - 1] == ' ')
+		vty_backward_char(vty);
+
+	while (vty->cp > 0 && vty->buf[vty->cp - 1] != ' ')
+		vty_backward_char(vty);
+}
+
+/* When '^D' is typed at the beginning of the line we move to the down
+ * level. */
+static void
+vty_down_level(vty_t *vty)
+{
+	vty_out(vty, "%s", VTY_NEWLINE);
+		(*config_exit_cmd.func) (NULL, vty, 0, NULL);
+	vty_prompt(vty);
+	vty->cp = 0;
+}
+
+/* When '^Z' is received from vty, move down to the enable mode. */
+static void
+vty_end_config(vty_t *vty)
+{
+	vty_out(vty, "%s", VTY_NEWLINE);
+
+	switch (vty->node) {
+	case VIEW_NODE:
+	case ENABLE_NODE:
+		/* Nothing to do. */
+		break;
+	case CONFIG_NODE:
+	case VTY_NODE:
+		vty_config_unlock(vty);
+		vty->node = ENABLE_NODE;
+		break;
+	default:
+		/* Unknown node, we have to ignore it. */
+		break;
+	}
+
+	vty_prompt(vty);
+	vty->cp = 0;
+}
+
+/* Delete a charcter at the current point. */
+static void
+vty_delete_char(vty_t *vty)
+{
+	int i, size;
+
+	if (vty->length == 0) {
+		vty_down_level(vty);
+		return;
+	}
+
+	if (vty->cp == vty->length)
+		return;			/* completion need here? */
+
+	size = vty->length - vty->cp;
+
+	vty->length--;
+	memmove(&vty->buf[vty->cp], &vty->buf[vty->cp + 1], size - 1);
+	vty->buf[vty->length] = '\0';
+  
+	if (vty->node == AUTH_NODE || vty->node == AUTH_ENABLE_NODE)
+		return;
+
+	vty_write(vty, &vty->buf[vty->cp], size - 1);
+	vty_write(vty, &telnet_space_char, 1);
+
+	for (i = 0; i < size; i++)
+		vty_write (vty, &telnet_backward_char, 1);
+}
+
+/* Delete a character before the point. */
+static void
+vty_delete_backward_char(vty_t *vty)
+{
+	if (vty->cp == 0)
+		return;
+
+	vty_backward_char(vty);
+	vty_delete_char(vty);
+}
+
+/* Kill rest of line from current point. */
+static void
+vty_kill_line(vty_t *vty)
+{
+	int i, size;
+
+	size = vty->length - vty->cp;
+  
+	if (size == 0)
+		return;
+
+	for (i = 0; i < size; i++)
+		vty_write(vty, &telnet_space_char, 1);
+	for (i = 0; i < size; i++)
+		vty_write(vty, &telnet_backward_char, 1);
+
+	memset (&vty->buf[vty->cp], 0, size);
+	vty->length = vty->cp;
+}
+
+/* Kill line from the beginning. */
+static void
+vty_kill_line_from_beginning(vty_t *vty)
+{
+  vty_beginning_of_line (vty);
+  vty_kill_line (vty);
+}
+
+/* Delete a word before the point. */
+static void
+vty_forward_kill_word(vty_t *vty)
+{
+	while (vty->cp != vty->length && vty->buf[vty->cp] == ' ')
+		vty_delete_char(vty);
+	while (vty->cp != vty->length && vty->buf[vty->cp] != ' ')
+		vty_delete_char(vty);
+}
+
+/* Delete a word before the point. */
+static void
+vty_backward_kill_word(vty_t *vty)
+{
+	while (vty->cp > 0 && vty->buf[vty->cp - 1] == ' ')
+		vty_delete_backward_char(vty);
+	while (vty->cp > 0 && vty->buf[vty->cp - 1] != ' ')
+		vty_delete_backward_char(vty);
+}
+
+/* Transpose chars before or at the point. */
+static void
+vty_transpose_chars(vty_t *vty)
+{
+	char c1, c2;
+
+	/* If length is short or point is near by the beginning of line then
+	 * return. */
+	if (vty->length < 2 || vty->cp < 1)
+		return;
+
+	/* In case of point is located at the end of the line. */
+	if (vty->cp == vty->length) {
+		c1 = vty->buf[vty->cp - 1];
+		c2 = vty->buf[vty->cp - 2];
+
+		vty_backward_char(vty);
+		vty_backward_char(vty);
+		vty_self_insert_overwrite(vty, c1);
+		vty_self_insert_overwrite(vty, c2);
+	} else {
+		c1 = vty->buf[vty->cp];
+		c2 = vty->buf[vty->cp - 1];
+
+		vty_backward_char(vty);
+		vty_self_insert_overwrite(vty, c1);
+		vty_self_insert_overwrite(vty, c2);
+	}
+}
+
+/* Do completion at vty interface. */
+static void
+vty_complete_command(vty_t *vty)
+{
+	int i, ret;
+	char **matched = NULL;
+	vector_t *vline;
+
+	if (vty->node == AUTH_NODE || vty->node == AUTH_ENABLE_NODE)
+		return;
+
+	vline = cmd_make_strvec(vty->buf);
+	if (vline == NULL)
+		return;
+
+	/* In case of 'help \t'. */
+	if (isspace ((int) vty->buf[vty->length - 1]))
+		vector_set(vline, '\0');
+
+	matched = cmd_complete_command(vline, vty, &ret);
+  
+	cmd_free_strvec(vline);
+
+	vty_out(vty, "%s", VTY_NEWLINE);
+	switch (ret) {
+	case CMD_ERR_AMBIGUOUS:
+		vty_out(vty, "%% Ambiguous command.%s", VTY_NEWLINE);
+		vty_prompt(vty);
+		vty_redraw_line(vty);
+		break;
+	case CMD_ERR_NO_MATCH:
+		/* vty_out (vty, "%% There is no matched command.%s", VTY_NEWLINE); */
+		vty_prompt(vty);
+		vty_redraw_line(vty);
+		break;
+	case CMD_COMPLETE_FULL_MATCH:
+		vty_prompt(vty);
+		vty_redraw_line(vty);
+		vty_backward_pure_word(vty);
+		vty_insert_word_overwrite(vty, matched[0]);
+		vty_self_insert(vty, ' ');
+		FREE(matched[0]);
+		break;
+	case CMD_COMPLETE_MATCH:
+		vty_prompt (vty);
+		vty_redraw_line (vty);
+		vty_backward_pure_word (vty);
+		vty_insert_word_overwrite (vty, matched[0]);
+		FREE(matched[0]);
+		vector_only_index_free (matched);
+		return;
+		break;
+	case CMD_COMPLETE_LIST_MATCH:
+		for (i = 0; matched[i] != NULL; i++) {
+			if (i != 0 && ((i % 6) == 0))
+				vty_out(vty, "%s", VTY_NEWLINE);
+			vty_out(vty, "%-10s ", matched[i]);
+			FREE(matched[i]);
+		}
+		vty_out(vty, "%s", VTY_NEWLINE);
+
+		vty_prompt(vty);
+		vty_redraw_line(vty);
+		break;
+	case CMD_ERR_NOTHING_TODO:
+		vty_prompt(vty);
+		vty_redraw_line(vty);
+		break;
+	default:
+		break;
+	}
+	if (matched)
+		vector_only_index_free(matched);
+}
+
+static void
+vty_describe_fold(vty_t *vty, int cmd_width, unsigned int desc_width, desc_t *desc)
+{
+	char *buf;
+	const char *cmd, *p;
+	int pos;
+
+	cmd = desc->cmd[0] == '.' ? desc->cmd + 1 : desc->cmd;
+
+	if (desc_width <= 0) {
+		vty_out(vty, "  %-*s  %s%s", cmd_width, cmd, desc->str, VTY_NEWLINE);
+		return;
+	}
+
+	buf = (char *) MALLOC(strlen (desc->str) + 1);
+
+	for (p = desc->str; strlen (p) > desc_width; p += pos + 1) {
+		for (pos = desc_width; pos > 0; pos--)
+			if (*(p + pos) == ' ')
+				break;
+
+		if (pos == 0)
+			break;
+
+		strncpy (buf, p, pos);
+		buf[pos] = '\0';
+		vty_out(vty, "  %-*s  %s%s", cmd_width, cmd, buf, VTY_NEWLINE);
+
+		cmd = "";
+	}
+
+	vty_out(vty, "  %-*s  %s%s", cmd_width, cmd, p, VTY_NEWLINE);
+
+	FREE(buf);
+}
+
+/* Describe matched command function. */
+static void
+vty_describe_command(vty_t *vty)
+{
+	int ret;
+	vector_t *vline, *describe;
+	unsigned int i, width, desc_width;
+	desc_t *desc, *desc_cr = NULL;
+
+	vline = cmd_make_strvec(vty->buf);
+
+	/* In case of '> ?'. */
+	if (vline == NULL) {
+		vline = vector_init(1);
+		vector_set(vline, '\0');
+	} else {
+		if (isspace ((int) vty->buf[vty->length - 1])) {
+			vector_set(vline, '\0');
+		}
+	}
+
+	describe = cmd_describe_command(vline, vty, &ret);
+
+	vty_out(vty, "%s", VTY_NEWLINE);
+
+	/* Ambiguous error. */
+	switch (ret) {
+	case CMD_ERR_AMBIGUOUS:
+		vty_out(vty, "%% Ambiguous command.%s", VTY_NEWLINE);
+		goto out;
+		break;
+	case CMD_ERR_NO_MATCH:
+		vty_out(vty, "%% There is no matched command.%s", VTY_NEWLINE);
+		goto out;
+		break;
+	}  
+
+	/* Get width of command string. */
+	width = 0;
+	for (i = 0; i < vector_active (describe); i++) {
+		if ((desc = vector_slot (describe, i)) != NULL) {
+			unsigned int len;
+
+			if (desc->cmd[0] == '\0')
+				continue;
+
+			len = strlen (desc->cmd);
+			if (desc->cmd[0] == '.')
+				len--;
+
+			if (width < len)
+				width = len;
+		}
+	}
+
+	/* Get width of description string. */
+	desc_width = vty->width - (width + 6);
+
+	/* Print out description. */
+	for (i = 0; i < vector_active (describe); i++) {
+		if ((desc = vector_slot(describe, i)) != NULL) {
+			if (desc->cmd[0] == '\0')
+				continue;
+	
+			if (strcmp (desc->cmd, command_cr) == 0) {
+				desc_cr = desc;
+				continue;
+			}
+
+			if (!desc->str) {
+				vty_out(vty, "  %-s%s",
+					desc->cmd[0] == '.' ? desc->cmd + 1 : desc->cmd,
+					VTY_NEWLINE);
+			} else if (desc_width >= strlen (desc->str)) {
+				vty_out(vty, "  %-*s  %s%s", width,
+					desc->cmd[0] == '.' ? desc->cmd + 1 : desc->cmd,
+					desc->str, VTY_NEWLINE);
+			} else {
+				vty_describe_fold(vty, width, desc_width, desc);
+			}
+		}
+	}
+
+	if ((desc = desc_cr)) {
+		if (!desc->str) {
+			vty_out(vty, "  %-s%s",
+				desc->cmd[0] == '.' ? desc->cmd + 1 : desc->cmd,
+				VTY_NEWLINE);
+		} else if (desc_width >= strlen (desc->str)) {
+			vty_out(vty, "  %-*s  %s%s", width,
+				desc->cmd[0] == '.' ? desc->cmd + 1 : desc->cmd,
+				desc->str, VTY_NEWLINE);
+		} else {
+			vty_describe_fold(vty, width, desc_width, desc);
+		}
+    }
+
+out:
+	cmd_free_strvec(vline);
+	if (describe)
+		vector_free(describe);
+
+	vty_prompt(vty);
+	vty_redraw_line(vty);
+}
+
+static void
+vty_clear_buf(vty_t *vty)
+{
+	memset(vty->buf, 0, vty->max);
+}
+
+/* ^C stop current input and do not add command line to the history. */
+static void
+vty_stop_input(vty_t *vty)
+{
+	vty->cp = vty->length = 0;
+	vty_clear_buf(vty);
+	vty_out(vty, "%s", VTY_NEWLINE);
+
+	switch (vty->node) {
+	case VIEW_NODE:
+	case ENABLE_NODE:
+		/* Nothing to do. */
+		break;
+	case CONFIG_NODE:
+	case VTY_NODE:
+		vty_config_unlock(vty);
+		vty->node = ENABLE_NODE;
+		break;
+	default:
+		/* Unknown node, we have to ignore it. */
+		break;
+	}
+	vty_prompt(vty);
+
+	/* Set history pointer to the latest one. */
+	vty->hp = vty->hindex;
+}
+
+/* Add current command line to the history buffer. */
+static void
+vty_hist_add(vty_t *vty)
+{
+	int index;
+
+	if (vty->length == 0)
+		return;
+
+	index = vty->hindex ? vty->hindex - 1 : VTY_MAXHIST - 1;
+
+	/* Ignore the same string as previous one. */
+	if (vty->hist[index]) {
+		if (strcmp (vty->buf, vty->hist[index]) == 0) {
+			vty->hp = vty->hindex;
+			return;
+		}
+	}
+
+	/* Insert history entry. */
+	FREE_PTR(vty->hist[vty->hindex]);
+	vty->hist[vty->hindex] = strdup(vty->buf);
+
+	/* History index rotation. */
+	vty->hindex++;
+	if (vty->hindex == VTY_MAXHIST)
+		vty->hindex = 0;
+
+	vty->hp = vty->hindex;
+}
+
+/* Get telnet window size. */
+static int
+vty_telnet_option(vty_t *vty, unsigned char *buf, int nbytes)
+{
+	switch (buf[0]) {
+	case SB:
+		vty->sb_len = 0;
+		vty->iac_sb_in_progress = 1;
+		return 0;
+		break;
+	case SE: 
+	{
+		if (!vty->iac_sb_in_progress)
+			return 0;
+
+		if ((vty->sb_len == 0) || (vty->sb_buf[0] == '\0')) {
+			vty->iac_sb_in_progress = 0;
+			return 0;
+		}
+
+		switch (vty->sb_buf[0]) {
+		case TELOPT_NAWS:
+			if (vty->sb_len != TELNET_NAWS_SB_LEN) {
+				log_message(LOG_ERR, "RFC 1073 violation detected: telnet NAWS option "
+						     "should send %d characters, but we received %lu"
+						   , TELNET_NAWS_SB_LEN, (u_long)vty->sb_len);
+			} else if (sizeof(vty->sb_buf) < TELNET_NAWS_SB_LEN) {
+				log_message(LOG_ERR, "Bug detected: sizeof(vty->sb_buf) %lu < %d, "
+						     "too small to handle the telnet NAWS option"
+						   , (u_long)sizeof(vty->sb_buf), TELNET_NAWS_SB_LEN);
+			} else {
+				vty->width = ((vty->sb_buf[1] << 8)|vty->sb_buf[2]);
+				vty->height = ((vty->sb_buf[3] << 8)|vty->sb_buf[4]);
+			}
+			break;
+		}
+		vty->iac_sb_in_progress = 0;
+		return 0;
+		break;
+	}
+	default:
+		break;
+	}
+
+	return 1;
+}
+
+/* Execute current command line. */
+static int
+vty_execute(vty_t *vty)
+{
+	int ret;
+
+	ret = CMD_SUCCESS;
+
+	switch (vty->node) {
+	case AUTH_NODE:
+	case AUTH_ENABLE_NODE:
+		vty_auth(vty, vty->buf);
+		break;
+	default:
+		ret = vty_command(vty, vty->buf);
+		if (vty->type == VTY_TERM)
+			vty_hist_add(vty);
+		break;
+	}
+
+	/* Clear command line buffer. */
+	vty->cp = vty->length = 0;
+	vty_clear_buf(vty);
+
+	if (vty->status != VTY_CLOSE)
+		vty_prompt(vty);
+
+	return ret;
+}
+
+#define CONTROL(X)  ((X) - '@')
+#define VTY_NORMAL     0
+#define VTY_PRE_ESCAPE 1
+#define VTY_ESCAPE     2
+
+/* Escape character command map. */
+static void
+vty_escape_map(unsigned char c, vty_t *vty)
+{
+	switch (c) {
+	case ('A'):
+		vty_previous_line(vty);
+		break;
+	case ('B'):
+		vty_next_line(vty);
+		break;
+	case ('C'):
+		vty_forward_char(vty);
+		break;
+	case ('D'):
+		vty_backward_char(vty);
+		break;
+	default:
+		break;
+	}
+
+	/* Go back to normal mode. */
+	vty->escape = VTY_NORMAL;
+}
+
+/* Quit print out to the buffer. */
+static void
+vty_buffer_reset(vty_t *vty)
+{
+	buffer_reset(vty->obuf);
+	vty_prompt(vty);
+	vty_redraw_line(vty);
+}
+
+/* Read data via vty socket. */
+static int
+vty_read(thread_t *thread)
+{
+	int i, nbytes;
+	unsigned char buf[VTY_READ_BUFSIZ];
+
+	int vty_sock = THREAD_FD(thread);
+	vty_t *vty = THREAD_ARG(thread);
+	vty->t_read = NULL;
+
+	/* Handle Read Timeout */
+	if (thread->type == THREAD_READ_TIMEOUT) {
+		vty_event(VTY_READ, vty_sock, vty);
+		return 0;
+	}
+
+	/* Read raw data from socket */
+	if ((nbytes = read(vty->fd, buf, VTY_READ_BUFSIZ)) <= 0) {
+		if (nbytes < 0) {
+			if (ERRNO_IO_RETRY(errno)) {
+				vty_event(VTY_READ, vty_sock, vty);
+				return 0;
+			}
+			vty->monitor = 0; /* disable monitoring to avoid infinite recursion */
+			log_message(LOG_WARNING, "%s: read error on vty client fd %d, closing: %s"
+					       , __func__, vty->fd, strerror(errno));
+		}
+		buffer_reset(vty->obuf);
+		vty->status = VTY_CLOSE;
+	}
+
+	for (i = 0; i < nbytes; i++) {
+		if (buf[i] == IAC) {
+			if (!vty->iac) {
+				vty->iac = 1;
+				continue;
+			} else {
+				vty->iac = 0;
+			}
+		}
+      
+		if (vty->iac_sb_in_progress && !vty->iac) {
+			if (vty->sb_len < sizeof(vty->sb_buf))
+				vty->sb_buf[vty->sb_len] = buf[i];
+			vty->sb_len++;
+			continue;
+		}
+
+		if (vty->iac) {
+			/* In case of telnet command */
+			int ret = 0;
+			ret = vty_telnet_option(vty, buf + i, nbytes - i);
+			vty->iac = 0;
+			i += ret;
+			continue;
+		}
+	        
+		if (vty->status == VTY_MORE) {
+			switch (buf[i]) {
+			case CONTROL('C'):
+			case 'q':
+			case 'Q':
+				vty_buffer_reset(vty);
+				break;
+			default:
+				break;
+			}
+			continue;
+		}
+
+		/* Escape character. */
+		if (vty->escape == VTY_ESCAPE) {
+			vty_escape_map(buf[i], vty);
+			continue;
+		}
+
+		/* Pre-escape status. */
+		if (vty->escape == VTY_PRE_ESCAPE) {
+			switch (buf[i]) {
+			case '[':
+				vty->escape = VTY_ESCAPE;
+				break;
+			case 'b':
+				vty_backward_word(vty);
+				vty->escape = VTY_NORMAL;
+				break;
+			case 'f':
+				vty_forward_word(vty);
+				vty->escape = VTY_NORMAL;
+				break;
+			case 'd':
+				vty_forward_kill_word(vty);
+				vty->escape = VTY_NORMAL;
+				break;
+			case CONTROL('H'):
+			case 0x7f:
+				vty_backward_kill_word(vty);
+				vty->escape = VTY_NORMAL;
+				break;
+			default:
+				vty->escape = VTY_NORMAL;
+				break;
+			}
+			continue;
+		}
+
+		switch (buf[i]) {
+		case CONTROL('A'):
+			vty_beginning_of_line(vty);
+			break;
+		case CONTROL('B'):
+			vty_backward_char(vty);
+			break;
+		case CONTROL('C'):
+			vty_stop_input(vty);
+			break;
+		case CONTROL('D'):
+			vty_delete_char(vty);
+			break;
+		case CONTROL('E'):
+			vty_end_of_line(vty);
+			break;
+		case CONTROL('F'):
+			vty_forward_char (vty);
+			break;
+		case CONTROL('H'):
+		case 0x7f:
+			vty_delete_backward_char(vty);
+			break;
+		case CONTROL('K'):
+			vty_kill_line(vty);
+			break;
+		case CONTROL('N'):
+			vty_next_line(vty);
+			break;
+		case CONTROL('P'):
+			vty_previous_line(vty);
+			break;
+		case CONTROL('T'):
+			vty_transpose_chars(vty);
+			break;
+		case CONTROL('U'):
+			vty_kill_line_from_beginning(vty);
+			break;
+		case CONTROL('W'):
+			vty_backward_kill_word(vty);
+			break;
+		case CONTROL('Z'):
+			vty_end_config(vty);
+			break;
+		case '\n':
+		case '\r':
+			vty_out(vty, "%s", VTY_NEWLINE);
+			vty_execute(vty);
+			break;
+		case '\t':
+			vty_complete_command(vty);
+			break;
+		case '?':
+			if (vty->node == AUTH_NODE || vty->node == AUTH_ENABLE_NODE) {
+				vty_self_insert(vty, buf[i]);
+			} else {
+				vty_describe_command(vty);
+			}
+			break;
+		case '\033':
+			if (i + 1 < nbytes && buf[i + 1] == '[') {
+				vty->escape = VTY_ESCAPE;
+				i++;
+			} else {
+				vty->escape = VTY_PRE_ESCAPE;
+			}
+			break;
+		default:
+			if (buf[i] > 31 && buf[i] < 127)
+				vty_self_insert(vty, buf[i]);
+			break;
+		}
+	}
+
+	/* Check status. */
+	if (vty->status == VTY_CLOSE) {
+		vty_close (vty);
+	} else {
+		vty_event(VTY_WRITE, vty_sock, vty);
+		vty_event(VTY_READ, vty_sock, vty);
+	}
+
+	return 0;
+}
+
+/* Flush buffer to the vty. */
+static int
+vty_flush(thread_t *thread)
+{
+	int erase;
+	buffer_status_t flushrc;
+	int vty_sock = THREAD_FD(thread);
+	vty_t *vty = THREAD_ARG(thread);
+
+	vty->t_write = NULL;
+
+	/* Handle Write Timeout */
+	if (thread->type == THREAD_WRITE_TIMEOUT) {
+		vty_event(VTY_WRITE, vty_sock, vty);
+		return 0;
+	}
+
+	/* Tempolary disable read thread. */
+	if ((vty->lines == 0) && vty->t_read) {
+		thread_cancel(vty->t_read);
+		vty->t_read = NULL;
+	}
+
+	/* Function execution continue. */
+	erase = ((vty->status == VTY_MORE || vty->status == VTY_MORELINE));
+
+	/* N.B. if width is 0, that means we don't know the window size. */
+	if ((vty->lines == 0) || (vty->width == 0)) {
+		flushrc = buffer_flush_available(vty->obuf, vty->fd);
+	} else if (vty->status == VTY_MORELINE) {
+		flushrc = buffer_flush_window(vty->obuf, vty->fd, vty->width,
+					      1, erase, 0);
+	} else {
+		flushrc = buffer_flush_window(vty->obuf, vty->fd, vty->width,
+					      vty->lines >= 0 ? vty->lines :
+							        vty->height,
+					      erase, 0);
+	}
+
+	switch (flushrc) {
+	case BUFFER_ERROR:
+		vty->monitor = 0; /* disable monitoring to avoid infinite recursion */
+		log_message(LOG_WARNING, "buffer_flush failed on vty client fd %d, closing"
+				       , vty->fd);
+		buffer_reset(vty->obuf);
+		vty_close(vty);
+		return 0;
+	case BUFFER_EMPTY:
+		if (vty->status == VTY_CLOSE) {
+			vty_close (vty);
+		} else {
+			vty->status = VTY_NORMAL;
+			if (vty->lines == 0) {
+				vty_event(VTY_READ, vty_sock, vty);
+			}
+		}
+		break;
+	case BUFFER_PENDING:
+		/* There is more data waiting to be written. */
+		vty->status = VTY_MORE;
+		if (vty->lines == 0) {
+			vty_event(VTY_WRITE, vty_sock, vty);
+		}
+		break;
+	}
+
+	return 0;
+}
+
+/* Create new vty structure. */
+static vty_t *
+vty_create(int vty_sock, struct sockaddr_storage *addr)
+{
+	vty_t *vty;
+
+	/* Allocate new vty structure and set up default values. */
+	vty = vty_new();
+	vty->fd = vty_sock;
+	vty->type = VTY_TERM;
+	vty->address = *addr;
+	if (no_password_check) {
+		vty->node = (host.advanced) ? ENABLE_NODE : VIEW_NODE;
+	} else {
+		vty->node = AUTH_NODE;
+	}
+
+	vty->fail = 0;
+	vty->cp = 0;
+	vty_clear_buf(vty);
+	vty->length = 0;
+	memset(vty->hist, 0, sizeof(vty->hist));
+	vty->hp = 0;
+	vty->hindex = 0;
+	vector_set_index(vtyvec, vty_sock, vty);
+	vty->status = VTY_NORMAL;
+	vty->v_timeout = vty_timeout_val;
+	vty->lines = (host.lines >= 0) ? host.lines: -1;
+	vty->iac = 0;
+	vty->iac_sb_in_progress = 0;
+	vty->sb_len = 0;
+
+	if (!no_password_check) {
+		/* Vty is not available if password isn't set. */
+		if (host.password == NULL && host.password_encrypt == NULL) {
+			vty_out(vty, "Vty password is not set.%s", VTY_NEWLINE);
+			vty->status = VTY_CLOSE;
+			vty_close(vty);
+			return NULL;
+		}
+	}
+
+	/* Say hello to the world. */
+	vty_hello(vty);
+	if (!no_password_check) {
+		vty_out(vty, "%sUser Access Verification%s%s"
+			   , VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
+	}
+
+	/* Setting up terminal. */
+	vty_will_echo(vty);
+	vty_will_suppress_go_ahead(vty);
+
+	vty_dont_linemode(vty);
+	vty_do_window_size(vty);
+
+	vty_prompt(vty);
+
+	/* Add read/write thread. */
+	vty_event(VTY_WRITE, vty_sock, vty);
+	vty_event(VTY_READ, vty_sock, vty);
+
+	return vty;
+}
+
+/* Accept connection from the network. */
+static int
+vty_accept(thread_t *thread)
+{
+	struct sockaddr_storage sock;
+	socklen_t len;
+	int vty_sock, ret, val;
+	unsigned int on = 1;
+	int accept_sock = THREAD_FD(thread);
+
+	/* Handle Read Timeout */
+	if (thread->type == THREAD_READ_TIMEOUT) {
+		vty_event(VTY_SERV, accept_sock, NULL);
+		return 0;
+	}
+
+	/* We continue hearing vty socket. */
+	vty_event(VTY_SERV, accept_sock, NULL);
+
+	/* We can handle IPv4 or IPv6 socket. */
+	memset(&sock, 0, sizeof(struct sockaddr_storage));
+	len = sizeof(struct sockaddr_storage);
+	vty_sock = accept(accept_sock, (struct sockaddr *) &sock, &len);
+	if (vty_sock < 0) {
+		log_message(LOG_WARNING, "can't accept vty socket : %s"
+				       , strerror(errno));
+		return -1;
+	}
+
+	/* Make socket non-block. */
+	val = fcntl(vty_sock, F_GETFL, 0);
+	fcntl(vty_sock, F_SETFL, val | O_NONBLOCK);
+
+	/* Set NODELAY */
+	ret = setsockopt(vty_sock, IPPROTO_TCP, TCP_NODELAY, 
+			 (char *) &on, sizeof(on));
+	if (ret < 0) {
+		log_message(LOG_INFO, "can't set sockopt to vty_sock : %s"
+				    , strerror(errno));
+	}
+
+	log_message(LOG_INFO, "Vty connection from %s"
+			    , inet_sockaddrtos(&sock));
+
+	vty_create(vty_sock, &sock);
+	return 0;
+}
+
+/* Start listner thread */
+int
+vty_listen(struct sockaddr_storage *addr)
+{
+	int accept_sock, ret, on = 1;
+	socklen_t len;
+	mode_t old_mask;
+
+	/* Mask */
+	old_mask = umask(0077);
+
+	/* Socket */
+	accept_sock = socket(addr->ss_family, SOCK_STREAM, 0);
+	if (accept_sock < 0) {
+		log_message(LOG_INFO, "Vty error creating listening socket on [%s]:%d (%s)"
+				    , inet_sockaddrtos(addr)
+				    , ntohs(inet_sockaddrport(addr))
+				    , strerror(errno));
+		return -1;
+	}
+
+	/* Socket tweaking */
+	ret = setsockopt(accept_sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
+	if (ret < 0) {
+		log_message(LOG_INFO, "Vty error cant do SO_REUSEADDR errno=%d (%s)"
+				    , errno
+				    , strerror(errno));
+		close(accept_sock);
+		return -1;
+	}
+
+	/* Socket bind */
+	len = sizeof(*addr);
+	ret = bind(accept_sock, (struct sockaddr *) addr, len);
+	if (ret < 0) {
+		log_message(LOG_INFO, "Vty error cant bind to [%s]:%d (%s)"
+				    , inet_sockaddrtos(addr)
+				    , ntohs(inet_sockaddrport(addr))
+				    , strerror(errno));
+		close(accept_sock);
+		return -1;
+	}
+
+	/* Socket listen */
+	ret = listen(accept_sock, 3);
+	if (ret < 0) {
+		log_message(LOG_INFO, "Vty error cant listen to [%s]:%d (%s)"
+				    , inet_sockaddrtos(addr)
+				    , ntohs(inet_sockaddrport(addr))
+				    , strerror(errno));
+		close(accept_sock);
+		return -1;
+
+	}
+
+	/* Restore old mask */
+	umask(old_mask);
+
+	log_message(LOG_INFO, "Vty start listening on [%s]:%d"
+			    , inet_sockaddrtos(addr)
+			    , ntohs(inet_sockaddrport(addr)));
+
+	vty_event(VTY_SERV, accept_sock, NULL);
+	return accept_sock;
+}
+
+/* Close vty interface.  Warning: call this only from functions that
+ * will be careful not to access the vty afterwards (since it has
+ * now been freed).  This is safest from top-level functions (called
+ * directly by the thread dispatcher). */
+void
+vty_close(vty_t *vty)
+{
+	int i;
+
+	/* Cancel threads.*/
+	if (vty->t_read)
+		thread_cancel(vty->t_read);
+	if (vty->t_write)
+		thread_cancel(vty->t_write);
+	if (vty->t_timeout)
+		thread_cancel(vty->t_timeout);
+
+	/* Flush buffer. */
+	buffer_flush_all(vty->obuf, vty->fd);
+
+	/* Free input buffer. */
+	buffer_free(vty->obuf);
+
+	/* Free command history. */
+	for (i = 0; i < VTY_MAXHIST; i++) {
+		FREE_PTR(vty->hist[i]);
+	}
+
+	/* Unset vector. */
+	vector_unset(vtyvec, vty->fd);
+
+	/* Close socket. */
+	if (vty->fd > 0)
+		close(vty->fd);
+
+	FREE_PTR(vty->buf);
+
+	/* Check configure. */
+	vty_config_unlock(vty);
+
+	/* OK free vty. */
+	FREE(vty);
+}
+
+/* When time out occur output message then close connection. */
+static int
+vty_timeout(thread_t *thread)
+{
+	vty_t *vty;
+
+	vty = THREAD_ARG(thread);
+	vty->t_timeout = NULL;
+	vty->v_timeout = 0;
+
+	/* Clear buffer*/
+	buffer_reset(vty->obuf);
+	vty_out(vty, "%sVty connection is timed out.%s", VTY_NEWLINE, VTY_NEWLINE);
+
+	/* Close connection. */
+	vty->status = VTY_CLOSE;
+	vty_close(vty);
+
+	return 0;
+}
+
+/* Read up configuration file from file_name. */
+static void
+vty_read_file(FILE *confp)
+{
+	int ret;
+	vty_t *vty;
+
+	vty = vty_new();
+	vty->fd = 0;			/* stdout */
+	vty->type = VTY_TERM;
+	vty->node = CONFIG_NODE;
+  
+	/* Execute configuration file */
+	ret = config_from_file(vty, confp);
+
+	if (!((ret == CMD_SUCCESS) || (ret == CMD_ERR_NOTHING_TODO))) {
+		switch (ret) {
+		case CMD_ERR_AMBIGUOUS:
+			fprintf(stderr, "Ambiguous command.\n");
+			break;
+		case CMD_ERR_NO_MATCH:
+			fprintf(stderr, "There is no such command.\n");
+			break;
+		}
+		fprintf(stderr, "Error occured during reading below line.\n%s\n"
+			      , vty->buf);
+		vty_close(vty);
+		exit(1);
+	}
+
+	vty_close(vty);
+}
+
+static FILE *
+vty_use_backup_config(char *fullpath)
+{
+	char *fullpath_sav, *fullpath_tmp;
+	FILE *ret = NULL;
+	struct stat buf;
+	int tmp, sav;
+	int c, retval;
+	char buffer[512];
+  
+	fullpath_sav = MALLOC(strlen(fullpath) + strlen (CONF_BACKUP_EXT) + 1);
+	strcpy(fullpath_sav, fullpath);
+	strcat(fullpath_sav, CONF_BACKUP_EXT);
+	if (stat (fullpath_sav, &buf) == -1) {
+		FREE(fullpath_sav);
+		return NULL;
+	}
+
+	fullpath_tmp = MALLOC(strlen(fullpath) + 8);
+	sprintf(fullpath_tmp, "%s.XXXXXX", fullpath);
+  
+	/* Open file to configuration write. */
+	tmp = mkstemp(fullpath_tmp);
+	if (tmp < 0) {
+		FREE(fullpath_sav);
+		FREE(fullpath_tmp);
+		return NULL;
+	}
+
+	sav = open(fullpath_sav, O_RDONLY);
+	if (sav < 0) {
+		unlink(fullpath_tmp);
+		FREE(fullpath_sav);
+		FREE(fullpath_tmp);
+		return NULL;
+	}
+  
+	while((c = read(sav, buffer, 512)) > 0)
+		retval = write(tmp, buffer, c);
+  
+	close(sav);
+	close(tmp);
+  
+	if (chmod(fullpath_tmp, 0600) != 0) {
+		unlink(fullpath_tmp);
+		FREE(fullpath_sav);
+		FREE(fullpath_tmp);
+		return NULL;
+	}
+  
+	if (link(fullpath_tmp, fullpath) == 0)
+		ret = fopen(fullpath, "r");
+
+	unlink(fullpath_tmp);
+  
+	FREE(fullpath_sav);
+	FREE(fullpath_tmp);
+	return ret;
+}
+
+/* Read up configuration file from file_name. */
+void
+vty_read_config(char *config_file, char *config_default_dir)
+{
+	char cwd[MAXPATHLEN];
+	FILE *confp = NULL;
+	char *fullpath;
+	char *tmp = NULL;
+	char *retpath;
+
+	/* If -f flag specified. */
+	if (config_file != NULL) {
+		if (!IS_DIRECTORY_SEP(config_file[0])) {
+			retpath = getcwd(cwd, MAXPATHLEN);
+			tmp = MALLOC(strlen(cwd) + strlen(config_file) + 2);
+			sprintf(tmp, "%s/%s", cwd, config_file);
+			fullpath = tmp;
+		} else {
+			fullpath = config_file;
+		}
+
+		confp = fopen(fullpath, "r");
+
+		if (confp == NULL) {
+			fprintf(stderr, "%s: failed to open configuration file %s: %s\n"
+				      , __func__, fullpath, strerror (errno));
+          
+			confp = vty_use_backup_config(fullpath);
+			if (confp) {
+				fprintf(stderr, "WARNING: using backup configuration file!\n");
+			} else {
+				fprintf(stderr, "can't open configuration file [%s]\n"
+					      , config_file);
+				exit(1);
+			}
+		}
+	} else {
+		confp = fopen(config_default_dir, "r");
+		if (confp == NULL) {
+			fprintf(stderr, "%s: failed to open configuration file %s: %s\n"
+				      , __func__, config_default_dir, strerror(errno));
+          
+			confp = vty_use_backup_config(config_default_dir);
+			if (confp) {
+				fprintf(stderr, "WARNING: using backup configuration file!\n");
+				fullpath = config_default_dir;
+			} else {
+				fprintf(stderr, "can't open configuration file [%s]\n"
+					      , config_default_dir);
+				exit (1);
+			}
+		} else {
+			fullpath = config_default_dir;
+		}
+	}
+
+	vty_read_file(confp);
+
+	fclose(confp);
+
+	host_config_set(fullpath);
+  
+	FREE_PTR(tmp);
+}
+
+int
+vty_config_lock(vty_t *vty)
+{
+	if (vty_config == 0) {
+		vty->config = 1;
+		vty_config = 1;
+	}
+
+	return vty->config;
+}
+
+int
+vty_config_unlock(vty_t *vty)
+{
+	if (vty_config == 1 && vty->config == 1) {
+		vty->config = 0;
+		vty_config = 0;
+	}
+
+	return vty->config;
+}
+
+/* Master of the threads. */
+static void
+vty_event(event_t event, int sock, vty_t *vty)
+{
+	thread_t *vty_serv_thread;
+
+	switch (event) {
+	case VTY_SERV:
+		vty_serv_thread = thread_add_read(master, vty_accept, vty, sock,
+						  VTY_IO_TIMEOUT);
+		vector_set_index(Vvty_serv_thread, sock, vty_serv_thread);
+		break;
+
+	case VTY_READ:
+		vty->t_read = thread_add_read(master, vty_read, vty, sock, VTY_IO_TIMEOUT);
+
+		/* Time out treatment. */
+		if (vty->v_timeout) {
+			if (vty->t_timeout)
+				thread_cancel(vty->t_timeout);
+			vty->t_timeout = thread_add_timer(master, vty_timeout, vty,
+							  vty->v_timeout*TIMER_HZ);
+		}
+		break;
+
+	case VTY_WRITE:
+		if (!vty->t_write)
+			vty->t_write = thread_add_write(master, vty_flush, vty, sock,
+							VTY_IO_TIMEOUT);
+		break;
+
+	case VTY_TIMEOUT_RESET:
+		if (vty->t_timeout) {
+			thread_cancel(vty->t_timeout);
+			vty->t_timeout = NULL;
+		}
+
+		if (vty->v_timeout) {
+			vty->t_timeout = thread_add_timer(master, vty_timeout, vty,
+							  vty->v_timeout*TIMER_HZ);
+		}
+		break;
+	}
+}
+
+DEFUN(config_who,
+      config_who_cmd,
+      "who",
+      "Display who is on vty\n")
+{
+	char ipaddr[INET6_ADDRSTRLEN];
+	unsigned int i;
+	vty_t *v;
+
+	for (i = 0; i < vector_active(vtyvec); i++) {
+		if ((v = vector_slot(vtyvec, i)) != NULL) {
+			vty_out(vty, "%svty[%d] connected from %s.%s"
+				   , v->config ? "*" : " "
+				   , i, inet_sockaddrtos2(&v->address, ipaddr)
+				   , VTY_NEWLINE);
+		}
+	}
+	return CMD_SUCCESS;
+}
+
+/* Move to vty configuration mode. */
+DEFUN(line_vty,
+      line_vty_cmd,
+      "line vty",
+      "Configure a terminal line\n"
+      "Virtual terminal\n")
+{
+	vty->node = VTY_NODE;
+	return CMD_SUCCESS;
+}
+
+/* Set time out value. */
+static int
+exec_timeout(vty_t *vty, const char *min_str, const char *sec_str)
+{
+	unsigned long timeout = 0;
+
+	/* min_str and sec_str are already checked by parser.  So it must be
+	  all digit string. */
+	if (min_str) {
+		timeout = strtol(min_str, NULL, 10);
+		timeout *= 60;
+	}
+
+	if (sec_str) {
+		timeout += strtol(sec_str, NULL, 10);
+	}
+
+	vty_timeout_val = timeout;
+	vty->v_timeout = timeout;
+	vty_event(VTY_TIMEOUT_RESET, 0, vty);
+
+	return CMD_SUCCESS;
+}
+
+DEFUN(exec_timeout_min,
+      exec_timeout_min_cmd,
+      "exec-timeout <0-35791>",
+      "Set timeout value\n"
+      "Timeout value in minutes\n")
+{
+	return exec_timeout(vty, argv[0], NULL);
+}
+
+DEFUN(exec_timeout_sec,
+      exec_timeout_sec_cmd,
+      "exec-timeout <0-35791> <0-2147483>",
+      "Set the EXEC timeout\n"
+      "Timeout in minutes\n"
+      "Timeout in seconds\n")
+{
+	return exec_timeout(vty, argv[0], argv[1]);
+}
+
+DEFUN(no_exec_timeout,
+      no_exec_timeout_cmd,
+      "no exec-timeout",
+      NO_STR
+      "Set the EXEC timeout\n")
+{
+	return exec_timeout(vty, NULL, NULL);
+}
+
+/* vty login. */
+DEFUN(vty_login,
+      vty_login_cmd,
+      "login",
+      "Enable password checking\n")
+{
+	no_password_check = 0;
+	return CMD_SUCCESS;
+}
+
+DEFUN(no_vty_login,
+      no_vty_login_cmd,
+      "no login",
+      NO_STR
+      "Enable password checking\n")
+{
+	no_password_check = 1;
+	return CMD_SUCCESS;
+}
+
+/* initial mode. */
+DEFUN(service_advanced_vty,
+      service_advanced_vty_cmd,
+      "service advanced-vty",
+      "Set up miscellaneous service\n"
+      "Enable advanced mode vty interface\n")
+{
+	host.advanced = 1;
+	return CMD_SUCCESS;
+}
+
+DEFUN(no_service_advanced_vty,
+      no_service_advanced_vty_cmd,
+      "no service advanced-vty",
+      NO_STR
+      "Set up miscellaneous service\n"
+      "Enable advanced mode vty interface\n")
+{
+	host.advanced = 0;
+	return CMD_SUCCESS;
+}
+
+DEFUN(terminal_monitor,
+      terminal_monitor_cmd,
+      "terminal monitor",
+      "Set terminal line parameters\n"
+      "Copy debug output to the current terminal line\n")
+{
+	vty->monitor = 1;
+	return CMD_SUCCESS;
+}
+
+DEFUN(terminal_no_monitor,
+      terminal_no_monitor_cmd,
+      "terminal no monitor",
+      "Set terminal line parameters\n"
+      NO_STR
+      "Copy debug output to the current terminal line\n")
+{
+	vty->monitor = 0;
+	return CMD_SUCCESS;
+}
+
+ALIAS(terminal_no_monitor,
+      no_terminal_monitor_cmd,
+      "no terminal monitor",
+      NO_STR
+      "Set terminal line parameters\n"
+      "Copy debug output to the current terminal line\n")
+
+DEFUN(show_history,
+      show_history_cmd,
+      "show history",
+      SHOW_STR
+      "Display the session command history\n")
+{
+	int index;
+
+	for (index = vty->hindex + 1; index != vty->hindex;) {
+		if (index == VTY_MAXHIST) {
+			index = 0;
+			continue;
+		}
+
+		if (vty->hist[index] != NULL) {
+			vty_out(vty, "  %s%s", vty->hist[index], VTY_NEWLINE);
+		}
+
+		index++;
+	}
+
+	return CMD_SUCCESS;
+}
+
+/* Display current configuration. */
+static int
+vty_config_write(vty_t *vty)
+{
+	vty_out(vty, "line vty%s", VTY_NEWLINE);
+
+	/* exec-timeout */
+	if (vty_timeout_val != VTY_TIMEOUT_DEFAULT) {
+		vty_out(vty, " exec-timeout %ld %ld%s", 
+			vty_timeout_val / 60,
+			vty_timeout_val % 60, VTY_NEWLINE);
+	}
+
+	/* login */
+	if (no_password_check)
+		vty_out(vty, " no login%s", VTY_NEWLINE);
+    
+	vty_out(vty, "!%s", VTY_NEWLINE);
+
+	return CMD_SUCCESS;
+}
+
+cmd_node_t vty_node =
+{
+	VTY_NODE,
+	"%s(config-line)# ",
+	1,
+};
+
+/* Reset all VTY status. */
+void
+vty_reset(void)
+{
+	unsigned int i;
+	vty_t *vty;
+	thread_t *vty_serv_thread;
+
+	for (i = 0; i < vector_active(vtyvec); i++) {
+		if ((vty = vector_slot(vtyvec, i)) != NULL) {
+			buffer_reset(vty->obuf);
+			vty->status = VTY_CLOSE;
+			vty_close(vty);
+		}
+	}
+
+	for (i = 0; i < vector_active(Vvty_serv_thread); i++) {
+		if ((vty_serv_thread = vector_slot(Vvty_serv_thread, i)) != NULL) {
+			thread_cancel(vty_serv_thread);
+			vector_slot(Vvty_serv_thread, i) = NULL;
+			close(i);
+		}
+	}
+
+	vty_timeout_val = VTY_TIMEOUT_DEFAULT;
+}
+
+static void
+vty_save_cwd(void)
+{
+	char cwd[MAXPATHLEN];
+	char *c;
+	int retval;
+	char *retpath;
+
+	c = getcwd(cwd, MAXPATHLEN);
+
+	if (!c) {
+		retval = chdir(SYSCONFDIR);
+		retpath = getcwd(cwd, MAXPATHLEN);
+	}
+
+	vty_cwd = MALLOC(strlen(cwd) + 1);
+	strcpy(vty_cwd, cwd);
+}
+
+char *
+vty_get_cwd(void)
+{
+	return vty_cwd;
+}
+
+int
+vty_shell(vty_t *vty)
+{
+	return vty->type == VTY_SHELL ? 1 : 0;
+}
+
+int
+vty_shell_serv(vty_t *vty)
+{
+	return vty->type == VTY_SHELL_SERV ? 1 : 0;
+}
+
+/* Install vty's own commands like `who' command. */
+void
+vty_init(void)
+{
+	/* For further configuration read, preserve current directory. */
+	vty_save_cwd();
+
+	vtyvec = vector_init(VECTOR_DEFAULT_SIZE);
+
+	/* Initilize server thread vector. */
+	Vvty_serv_thread = vector_init(VECTOR_DEFAULT_SIZE);
+
+	/* Install basic node. */
+	install_node(&vty_node, vty_config_write);
+
+	install_element(VIEW_NODE, &config_who_cmd);
+	install_element(VIEW_NODE, &show_history_cmd);
+	install_element(ENABLE_NODE, &config_who_cmd);
+	install_element(CONFIG_NODE, &line_vty_cmd);
+	install_element(CONFIG_NODE, &service_advanced_vty_cmd);
+	install_element(CONFIG_NODE, &no_service_advanced_vty_cmd);
+	install_element(CONFIG_NODE, &show_history_cmd);
+	install_element(ENABLE_NODE, &terminal_monitor_cmd);
+	install_element(ENABLE_NODE, &terminal_no_monitor_cmd);
+	install_element(ENABLE_NODE, &no_terminal_monitor_cmd);
+	install_element(ENABLE_NODE, &show_history_cmd);
+
+	install_default(VTY_NODE);
+	install_element(VTY_NODE, &exec_timeout_min_cmd);
+	install_element(VTY_NODE, &exec_timeout_sec_cmd);
+	install_element(VTY_NODE, &no_exec_timeout_cmd);
+	install_element(VTY_NODE, &vty_login_cmd);
+	install_element(VTY_NODE, &no_vty_login_cmd);
+}
+
+void
+vty_terminate(void)
+{
+	FREE_PTR(vty_cwd);
+
+	if (vtyvec && Vvty_serv_thread) {
+		vty_reset();
+		vector_free(vtyvec);
+		vector_free(Vvty_serv_thread);
+	}
+}
diff -rupN keepalived-1.2.7/lib/vty.h keepalived-1.2.7-unicast/lib/vty.h
--- keepalived-1.2.7/lib/vty.h	1970-01-01 01:00:00.000000000 +0100
+++ keepalived-1.2.7-unicast/lib/vty.h	2013-05-24 10:12:36.671170800 +0200
@@ -0,0 +1,196 @@
+/*
+ * Soft:        Keepalived is a failover program for the LVS project
+ *              <www.linuxvirtualserver.org>. It monitor & manipulate
+ *              a loadbalanced server pool using multi-layer checks.
+ *
+ * Part:        vty.c include file.
+ *
+ * Author:      Alexandre Cassen, <acassen@linux-vs.org>
+ *
+ *              This program is distributed in the hope that it will be useful,
+ *              but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *              See the GNU General Public License for more details.
+ *
+ *              This program is free software; you can redistribute it and/or
+ *              modify it under the terms of the GNU General Public License
+ *              as published by the Free Software Foundation; either version
+ *              2 of the License, or (at your option) any later version.
+ *
+ * Copyright (C) 2001-2012 Alexandre Cassen, <acassen@linux-vs.org>
+ */
+
+#ifndef _VTY_H
+#define _VTY_H
+
+#include <netinet/in.h>
+#include "timer.h"
+#include "scheduler.h"
+#include "buffer.h"
+
+#define VTY_BUFSIZ 512
+#define VTY_MAXHIST 20
+#define TELNET_NAWS_SB_LEN 5
+
+typedef enum _event {
+	VTY_SERV,
+	VTY_READ,
+	VTY_WRITE,
+	VTY_TIMEOUT_RESET
+} event_t;
+
+typedef enum _vty_type {
+	VTY_TERM,
+	VTY_FILE,
+	VTY_SHELL,
+	VTY_SHELL_SERV
+} vty_type_t;
+
+typedef enum _vty_status {
+	VTY_NORMAL,
+	VTY_CLOSE,
+	VTY_MORE,
+	VTY_MORELINE
+} vty_status_t;
+
+
+/* VTY struct. */
+typedef struct _vty {
+	int			fd;				/* File descripter of this vty. */
+	vty_type_t		type;				/* Is this vty connect to file or not */
+	int			node;				/* Node status of this vty */
+	int			fail;				/* Failure count */
+	buffer_t		*obuf;				/* Output buffer */
+	char			*buf;				/* Command input buffer */
+	int			cp;				/* Command cursor point */
+	int			length;				/* Command length */
+	int			max;				/* Command max length */
+	char			*hist[VTY_MAXHIST];		/* Histry of command */
+	int			hp;				/* History lookup current point */
+	int			hindex;				/* History insert end point */
+	void			*index;				/* For current referencing point */
+	void			*index_sub;			/* For multiple level index treatment such
+								 * as key chain and key.
+								 */
+	unsigned char		escape;				/* For escape character. */
+	vty_status_t		status;				/* Current vty status. */
+	unsigned char		iac;				/* IAC handling: was the last character received
+								 * the IAC (interpret-as-command) escape character
+								 * (and therefore the next character will be the
+								 * command code)?  Refer to Telnet RFC 854.
+								 */
+	unsigned char		iac_sb_in_progress;		/* IAC SB (option subnegotiation) handling */
+	unsigned char		sb_buf[TELNET_NAWS_SB_LEN];	/* At the moment, we care only about the NAWS
+								 * (window size) negotiation, and that requires
+								 * just a 5-character buffer (RFC 1073):
+								 * <NAWS char> <16-bit width> <16-bit height>
+								 */
+	size_t			sb_len;				/* How many subnegotiation characters have we
+								 * received?  We just drop those that do not
+								 * fit in the buffer.
+								 */
+	int			width;				/* Window width */
+	int			height;				/* Window height */
+	int			lines;				/* Configure lines */
+	int			monitor;			/* Terminal monitor */
+	int			config;				/* In configure mode */
+	thread_t		*t_read;			/* Read thread */
+	thread_t		*t_write;			/* Write thread */
+	unsigned long		v_timeout;			/* Timeout seconds */
+	thread_t		*t_timeout;			/* Timeout thread */
+	struct sockaddr_storage	address;			/* What address is this vty comming from. */
+} vty_t;
+
+/* Integrated configuration file. */
+#define INTEGRATE_DEFAULT_CONFIG "keepalived.conf"
+
+/* Small macro to determine newline is newline only or linefeed needed. */
+#define VTY_NEWLINE	((vty->type == VTY_TERM) ? "\r\n" : "\n")
+
+/* Default time out value */
+#define VTY_TIMEOUT_DEFAULT	600
+#define VTY_IO_TIMEOUT		(10 * TIMER_HZ)
+
+/* Vty read buffer size. */
+#define VTY_READ_BUFSIZ 512
+
+/* Directory separator. */
+#define DIRECTORY_SEP '/'
+#define IS_DIRECTORY_SEP(c) ((c) == DIRECTORY_SEP)
+
+/* GCC have printf type attribute check.  */
+#ifdef __GNUC__
+#define PRINTF_ATTRIBUTE(a,b) __attribute__ ((__format__ (__printf__, a, b)))
+#else
+#define PRINTF_ATTRIBUTE(a,b)
+#endif
+
+/* Utility macros to convert VTY argument to unsigned long or integer. */
+#define VTY_GET_LONG(NAME,V,STR)					\
+do {									\
+  char *endptr = NULL;							\
+  errno = 0;								\
+  (V) = strtoul((STR), &endptr, 10);					\
+  if (*(STR) == '-' || *endptr != '\0' || errno) {			\
+      vty_out(vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE);		\
+      return CMD_WARNING;						\
+    }									\
+} while (0)
+
+#define VTY_GET_INTEGER_RANGE(NAME,V,STR,MIN,MAX)			\
+do {									\
+  unsigned long tmpl;							\
+  VTY_GET_LONG(NAME, tmpl, STR);					\
+  if ((tmpl < (MIN)) || (tmpl > (MAX))) {				\
+      vty_out(vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE);		\
+      return CMD_WARNING;						\
+    }									\
+  (V) = tmpl;								\
+} while (0)
+
+#define VTY_GET_INTEGER(NAME,V,STR) \
+	VTY_GET_INTEGER_RANGE(NAME,V,STR,0U,UINT32_MAX)
+
+#define VTY_GET_IPV4_ADDRESS(NAME,V,STR)				\
+do {									\
+  int retv;								\
+  retv = inet_aton((STR), &(V));					\
+  if (!retv) {								\
+      vty_out(vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE);		\
+      return CMD_WARNING;						\
+    }									\
+} while (0)
+
+#define VTY_GET_IPV4_PREFIX(NAME,V,STR)					\
+do {									\
+  int retv;								\
+  retv = str2prefix_ipv4((STR), &(V));					\
+  if (retv <= 0) {							\
+      vty_out(vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE);		\
+      return CMD_WARNING;						\
+    }									\
+} while (0)
+
+/* Exported variables */
+extern char integrate_default[];
+
+/* Prototypes. */
+extern void vty_init(void);
+extern void vty_terminate(void);
+extern int vty_listen(struct sockaddr_storage *);
+extern void vty_reset(void);
+extern vty_t *vty_new(void);
+extern int vty_out(vty_t *, const char *, ...) PRINTF_ATTRIBUTE(2, 3);
+extern void vty_read_config(char *, char *);
+extern void vty_time_print(vty_t *, int);
+extern void vty_serv_sock(const char *, unsigned short, const char *);
+extern void vty_close(vty_t *);
+extern char *vty_get_cwd(void);
+extern int vty_config_lock(vty_t *);
+extern int vty_config_unlock(vty_t *);
+extern int vty_shell(vty_t *);
+extern int vty_shell_serv(vty_t *);
+extern void vty_time_print(vty_t *, int);
+extern void vty_hello(vty_t *);
+
+#endif
