[Kea-users] Kea LFC not executed anymore after some time (Kea 1.2.0)

Mike the.lists at mgm51.com
Sat Nov 18 16:39:21 UTC 2017


On 11/17/2017 11:58 AM, Chaigneau, Nicolas wrote:
> 
> 
> 
> So this is confirmed: LFC is really not executed anymore at some point, for a reason yet to be determined.
> 
> I'll have a look at the changes between Kea 0.9.1 and 1.2.0.
> 
> 
> If you think of anything that could help, I'm all ears :)
> 


I'm not sure if this will help, but I have seen a similar (the same?)
issue.   LFC has not worked for me in a very long time.  To the point
that I wrote a script (below) to clean out the old leases, run by cron
weekly.

The lfc config portions of kea.conf are:

	"lease-database": {
		"type": "memfile",
		"persist": true,
		"name": "/var/db/kea/kea-leases4.csv",
		"lfc-interval": 4000
	},

and

	"lease-database": {
		"type": "memfile",
		"persist": true,
		"name": "/var/db/kea/kea-leases6.csv",
		"lfc-interval": 4000
	},

Maybe I have some simple error in the config that my eyes keep
overlooking, I don't know.

In any case, here's the script I run weekly:


#!/bin/sh

set -e
#set -xv

DBBaseDir=/var/db/kea

NowSecs=$(date +%s)

# IPv4 - expire is column 5
# IPv6 - expire is column 4

keactrl stop

for IPFam in 4 6
do
	MainFile=${DBBaseDir}/kea-leases${IPFam}.csv
	TmpFile=${DBBaseDir}/kea-leases${IPFam}.tmp
	OldFile=${DBBaseDir}/kea-leases${IPFam}.old

	echo " "
	echo Processing ${MainFile}

	test -e ${TmpFile} && rm ${TmpFile}
	while IFS="," read f1 f2 f3 f4 f5 f6
	do
		ExpireSecs=${NowSecs}
		test ${IPFam} = 4 && ExpireSecs=${f5}
		test ${IPFam} = 6 && ExpireSecs=${f4}

		if [ ${f1}x = "addressx" -o  ${ExpireSecs} -gt ${NowSecs} ]
		then
			echo "${f1},${f2},${f3},${f4},${f5},${f6}" >> ${TmpFile}
		fi

	done < ${MainFile}

	cp -p ${MainFile} ${OldFile}
	cp -p ${TmpFile} ${MainFile}
	test -e ${TmpFile} && rm ${TmpFile}

	echo "   record count (including header record)"
	wc -l ${OldFile}
	wc -l ${MainFile}
done

echo " "
ls -al ${DBBaseDir}

echo " "
keactrl start

exit 0




More information about the Kea-users mailing list