/* * carp_log.c * * 2004 Copyright (c) Evgeniy Polyakov * All rights reserved. * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "carp.h" #include "carp_log.h" void dump_addr_info(struct carp_priv *cp) { int i; printk(KERN_INFO "CARP addr: hw="); for (i=0; iodev->dev_addr[i], (i==ETH_ALEN-1)?' ':':'); printk(", sw="); for (i=0; i<4; ++i) printk("%d%c", (ntohl(cp->iph.saddr) >> (3-i)*8)&0xff, (i==3)?' ':'.'); printk(", dst="); for (i=0; i<4; ++i) printk("%d%c", (ntohl(cp->iph.daddr) >> (3-i)*8)&0xff, (i==3)?' ':'.'); printk("\n"); } void dump_hmac_params(struct carp_priv *cp) { int i; unsigned int keylen; struct scatterlist sg; u8 carp_md[CARP_SIG_LEN]; keylen = sizeof(cp->carp_key); sg.page = virt_to_page(&cp->carp_adv_counter); sg.offset = (unsigned long)(&cp->carp_adv_counter) % PAGE_SIZE; sg.length = sizeof(cp->carp_adv_counter); crypto_hmac(cp->tfm, cp->carp_key, &keylen, &sg, 1, carp_md); printk(KERN_INFO "key: "); for (i=0; icarp_key[i]); printk("\n"); printk("counter: %llx ", cp->carp_adv_counter); printk("hmac: "); for (i=0; icarp_counter[0]); counter = counter<<32; counter += ntohl(ch->carp_counter[1]); log("type=%u, version=%u, vhid=%u, skew=%u, base=%u, counter=%llu, md={", ch->carp_type, ch->carp_version, ch->carp_vhid, ch->carp_advskew, ch->carp_advbase, counter); for (i=0; icarp_md); ++i) { printk("%02x ", ch->carp_md[i]); } printk("}\n"); }