From owner-freebsd-net@FreeBSD.ORG Thu Oct 22 18:01:56 2009 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2DBBB1065672 for ; Thu, 22 Oct 2009 18:01:56 +0000 (UTC) (envelope-from arun.anirudhan@gmail.com) Received: from mail-px0-f186.google.com (mail-px0-f186.google.com [209.85.216.186]) by mx1.freebsd.org (Postfix) with ESMTP id 02E2A8FC12 for ; Thu, 22 Oct 2009 18:01:55 +0000 (UTC) Received: by pxi16 with SMTP id 16so5462739pxi.3 for ; Thu, 22 Oct 2009 11:01:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=CFPfEd039aTsDJi1zzraT37SJT3ZBOL4+hDPpYsoYA8=; b=Ag7ydppJ0NKK8MDw+99sZjLtfxK1wX3fD/rxBqo5DvN39EkkSu5t3OIyp4VQyUVMK9 vVEZYIxiViFltc4gJDuHpfauUCE9TmEJxGtRE/Tt2oaRdt56ag0D5NZjhkrm4SVvYJBn WKlUdM/krwRMJWvgfKrWTZCXIIAP7IfCrNqLk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=I/5idic0OYkVlauk713h5sSk3KeJC39AK3tRcysEh/cmrk6MB/FFpeVyR6BVs7wsyP HxiQLW7bVA5tZ7O3WzfVec10lc9XojbCKzB2T134CRF724unTdYBo1VWkXhQzho0SvXU thh95xjg8C0XVUeY2dCj6H/LQUtUDO2fsyyNE= MIME-Version: 1.0 Received: by 10.114.33.14 with SMTP id g14mr14758026wag.124.1256234514990; Thu, 22 Oct 2009 11:01:54 -0700 (PDT) In-Reply-To: <4AE09C03.6050201@elischer.org> References: <4AE09C03.6050201@elischer.org> Date: Thu, 22 Oct 2009 23:31:54 +0530 Message-ID: From: Arun Anirudhan To: Julian Elischer Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-net@freebsd.org Subject: Re: rip_input X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Oct 2009 18:01:56 -0000 When I make void rip_input_hook(struct mbuf *m, int off) to void rip_input_hook(struct mbuf *m) its showing error!! --------------- rip_input_hook.c:20: error: conflicting types for 'rip_input_hook' rip_input_hook.c:17: error: previous declaration of 'rip_input_hook' was here rip_input_hook.c: In function 'rip_input_hook': rip_input_hook.c:31: error: too few arguments to function 'rip_input' rip_input_hook.c: In function 'load': rip_input_hook.c:40: warning: assignment from incompatible pointer type *** Error code 1 ------------------- Its given in a book that rip_input(m) only... On Thu, Oct 22, 2009 at 11:23 PM, Julian Elischer wrote: > Arun Anirudhan wrote: > >> Hello >> I have just started programming in Kernel Level in FreeBSD. >> I'm trying to hook rip_input and extract the fields in IP header. I just >> tried to print the ip_len. >> This is the code, but its not getting printed. >> > > what IS getting printed? > > > Please help me... >> --------------------------------- >> >> #include >> #include >> #include >> #include >> #include >> #include >> #include >> >> #include >> #include >> #include >> #include >> #include >> >> >> extern struct protosw inetsw[]; >> pr_input_t rip_input_hook; >> >> void rip_input_hook(struct mbuf *m, int off) >> { >> struct ip *icp; >> int hlen=off; >> int l; >> //m->m_len-=hlen; >> //m->m_data+=hlen; >> >> icp=mtod(m, struct ip *); >> l=icp->ip_len; >> >> //m->m_len+=hlen; >> //m->m_data-=hlen; >> uprintf("%d.\n",l); >> } >> >> static int >> load(struct module *module, int cmd, void *arg) >> { >> int error = 0; >> switch (cmd) { >> case MOD_LOAD: >> inetsw[ip_protox[IPPROTO_RAW]].pr_input = rip_input_hook; >> break; >> case MOD_UNLOAD: >> inetsw[ip_protox[IPPROTO_RAW]].pr_input = rip_input; >> break; >> default: >> error = EOPNOTSUPP; >> break; >> } >> return (error); >> } >> static moduledata_t rip_input_hook_mod = { >> "rip_input_hook", load, NULL}; >> >> DECLARE_MODULE(rip_input_hook,rip_input_hook_mod,SI_SUB_DRIVERS,SI_ORDER_MIDDLE); >> >> >> > -- With regards Arun Anirudhan MTech Student, NIT Calicut 9495983679