On 12/03/13 18:54, Kenneth R Westerback wrote:
On Tue, Mar 12, 2013 at 06:15:27PM +0200, Kapetanakis Giannis wrote:
Hi,
I'm testing dhcpd sync features and I'm getting errors due to wrong
HMAC calculation.
(not getting back note("DHCP_SYNC_LEASE from....).
sync_recv() is exiting in HMAC calculation in /* Compute and
validate HMAC */ (line 283)
After applying the diff bellow problem seems to be solved. Could
someone have a look?
regards,
Giannis
Index: sync.c
===================================================================
RCS file: /cvs/src/usr.sbin/dhcpd/sync.c,v
retrieving revision 1.10
diff -u -r1.10 sync.c
--- sync.c 23 Dec 2010 17:38:04 -0000 1.10
+++ sync.c 12 Mar 2013 16:11:02 -0000
@@ -426,7 +426,7 @@
hdr.sh_version = DHCP_SYNC_VERSION;
hdr.sh_af = AF_INET;
hdr.sh_counter = sync_counter++;
- hdr.sh_length = htons(sizeof(hdr) + sizeof(ld) + sizeof(end));
+ hdr.sh_length = htons(sizeof(hdr) + leaselen + padlen +
sizeof(end));
iov[i].iov_base = &hdr;
iov[i].iov_len = sizeof(hdr);
HMAC_Update(&ctx, iov[i].iov_base, iov[i].iov_len);
Why replace sizeof(ld) with leaselen? a few lines up we have 'leaselen =
sizeof(ld)'. Adding '+ padlen' should be all that is needed.
.... Ken
Just to make one operation less since it was allready calculated. No
other reason.
+padlen is the only actual difference.
G