Date: Sat, 3 Feb 2007 20:06:57 GMT From: Paolo Pisati <piso@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 113964 for review Message-ID: <200702032006.l13K6vtB051120@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=113964 Change 113964 by piso@piso_newluxor on 2007/02/03 20:06:15 Teach mbuf to LibAliasFragmentIn(), LibAliasGetFragment() and LibAliasSaveFragment(). Affected files ... .. //depot/projects/soc2005/libalias/sys/netinet/libalias/alias.c#52 edit .. //depot/projects/soc2005/libalias/sys/netinet/libalias/alias.h#13 edit .. //depot/projects/soc2005/libalias/sys/netinet/libalias/alias_db.c#22 edit .. //depot/projects/soc2005/libalias/sys/netinet/libalias/alias_local.h#17 edit Differences ... ==== //depot/projects/soc2005/libalias/sys/netinet/libalias/alias.c#52 (text+ko) ==== @@ -1225,16 +1225,24 @@ int +#ifdef _KERNEL +LibAliasSaveFragment(struct libalias *la, struct mbuf *ptr) +#else LibAliasSaveFragment(struct libalias *la, char *ptr) +#endif { int iresult; struct alias_link *lnk; struct ip *pip; LIBALIAS_LOCK(la); - pip = (struct ip *)ptr; + iresult = PKT_ALIAS_ERROR; + PULLUP_IPHDR(pip, ptr); + if (pip == NULL) { + LIBALIAS_UNLOCK(la); + return (iresult); + } lnk = AddFragmentPtrLink(la, pip->ip_src, pip->ip_id); - iresult = PKT_ALIAS_ERROR; if (lnk != NULL) { SetFragmentPtr(lnk, ptr); iresult = PKT_ALIAS_OK; @@ -1243,16 +1251,28 @@ return (iresult); } - +#ifdef _KERNEL +struct mbuf * +LibAliasGetFragment(struct libalias *la, struct mbuf *ptr) +#else char * LibAliasGetFragment(struct libalias *la, char *ptr) +#endif { struct alias_link *lnk; +#ifdef _KERNEL + struct mbuf *fptr; +#else char *fptr; +#endif struct ip *pip; LIBALIAS_LOCK(la); - pip = (struct ip *)ptr; + PULLUP_IPHDR(pip, ptr); + if (pip == NULL) { + LIBALIAS_UNLOCK(la); + return (NULL); + } lnk = FindFragmentPtr(la, pip->ip_src, pip->ip_id); if (lnk != NULL) { GetFragmentPtr(lnk, &fptr); @@ -1265,7 +1285,11 @@ return (fptr); } - +#ifdef _KERNEL +void +LibAliasFragmentIn(struct libalias *la, struct mbuf *ptr, + struct mbuf *ptr_fragment) +#else void LibAliasFragmentIn(struct libalias *la, char *ptr, /* Points to correctly * de-aliased header @@ -1273,15 +1297,23 @@ char *ptr_fragment /* Points to fragment which must be * de-aliased */ ) +#endif { struct ip *pip; struct ip *fpip; LIBALIAS_LOCK(la); + PULLUP_IPHDR(pip, ptr); + if (pip == NULL) { + LIBALIAS_UNLOCK(la); + return; + } + PULLUP_IPHDR(fpip, ptr_fragment); + if (fpip == NULL) { + LIBALIAS_UNLOCK(la); + return; + } (void)la; - pip = (struct ip *)ptr; - fpip = (struct ip *)ptr_fragment; - DifferentialChecksum(&fpip->ip_sum, &pip->ip_dst, &fpip->ip_dst, 2); fpip->ip_dst = pip->ip_dst; ==== //depot/projects/soc2005/libalias/sys/netinet/libalias/alias.h#13 (text+ko) ==== @@ -178,9 +178,16 @@ unsigned char _proto); /* Fragment Handling functions. */ +#ifdef _KERNEL +void LibAliasFragmentIn(struct libalias *, struct mbuf *_ptr, + struct mbuf *_ptr_fragment); +struct mbuf *LibAliasGetFragment(struct libalias *, struct mbuf *_ptr); +int LibAliasSaveFragment(struct libalias *, struct mbuf *_ptr); +#else void LibAliasFragmentIn(struct libalias *, char *_ptr, char *_ptr_fragment); char *LibAliasGetFragment(struct libalias *, char *_ptr); int LibAliasSaveFragment(struct libalias *, char *_ptr); +#endif /* Miscellaneous functions. */ int LibAliasCheckNewLink(struct libalias *); ==== //depot/projects/soc2005/libalias/sys/netinet/libalias/alias_db.c#22 (text+ko) ==== @@ -327,7 +327,11 @@ * lookup tables */ union { /* Auxiliary data */ +#ifdef _KERNEL + struct mbuf *frag_ptr; +#else char *frag_ptr; +#endif struct in_addr frag_addr; struct tcp_dat *tcp; } data; @@ -1814,14 +1818,22 @@ void +#ifdef _KERNEL +SetFragmentPtr(struct alias_link *lnk, struct mbuf *fptr) +#else SetFragmentPtr(struct alias_link *lnk, char *fptr) +#endif { lnk->data.frag_ptr = fptr; } void +#ifdef _KERNEL +GetFragmentPtr(struct alias_link *lnk, struct mbuf **fptr) +#else GetFragmentPtr(struct alias_link *lnk, char **fptr) +#endif { *fptr = lnk->data.frag_ptr; } ==== //depot/projects/soc2005/libalias/sys/netinet/libalias/alias_local.h#17 (text+ko) ==== @@ -274,8 +274,13 @@ u_char _proto, u_char _align); void GetFragmentAddr(struct alias_link *_lnk, struct in_addr *_src_addr); void SetFragmentAddr(struct alias_link *_lnk, struct in_addr _src_addr); +#ifdef _KERNEL +void GetFragmentPtr(struct alias_link *_lnk, struct mbuf **_fptr); +void SetFragmentPtr(struct alias_link *_lnk, struct mbuf *fptr); +#else void GetFragmentPtr(struct alias_link *_lnk, char **_fptr); void SetFragmentPtr(struct alias_link *_lnk, char *fptr); +#endif void SetStateIn(struct alias_link *_lnk, int _state); void SetStateOut(struct alias_link *_lnk, int _state); int GetStateIn (struct alias_link *_lnk);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200702032006.l13K6vtB051120>