[prev in list] [next in list] [prev in thread] [next in thread]
List: ntop-dev
Subject: RE: [Ntop-dev] (was Sparc Sol9 patches)
From: "Burton M. Strauss III" <Burton () ntopsupport ! com>
Date: 2003-08-31 23:05:36
Message-ID: JIEPJGFPFMFIGBNCPKGGEEKBEEAA.Burton () ntopsupport ! com
[Download RAW message or body]
Well, smack me with the silly stick, it's patch@ntop.org not patches...
doh!!
Looks reasonable, but since that's Luca's baby, I'll defer to him...
-----Burton
-----Original Message-----
From: ntop-dev-admin@unipi.it [mailto:ntop-dev-admin@unipi.it]On Behalf
Of Chris Turbeville
Sent: Friday, August 29, 2003 11:40 PM
To: ntop-dev@Unipi.IT
Subject: Re: [Ntop-dev] (was Sparc Sol9 patches)
>
> In this day an age, can't handle an unaligned move? Amazing.
>
> Yes, please do send in the whole-enchilada patch. Probably best would be
to
> patches@ntop.org so Luca looks at it.
Sent it there it bounced:) Here it is.
-Chris
Index: ntop/pbuf.c
===================================================================
RCS file: /export/home/ntop/ntop/pbuf.c,v
retrieving revision 2.136
diff -U3 -r2.136 pbuf.c
--- ntop/pbuf.c 25 Aug 2003 16:28:16 -0000 2.136
+++ ntop/pbuf.c 29 Aug 2003 21:53:50 -0000
@@ -956,21 +956,20 @@
int WIN=0, MSS=-1, WS=-1, S=0, N=0, D=0, T=0;
int ttl;
char WSS[3], _MSS[5];
- struct tcphdr *tcp = (struct tcphdr*)(bp+hlen);
- u_char *tcp_opt = (u_char *)(tcp + 1);
- u_char *tcp_data = (u_char *)((int)tcp + tcp->th_off * 4);
- if (tcp->th_flags & TH_SYN) /* only SYN or SYN-2ACK packets */
+ if (tp.th_flags & TH_SYN) /* only SYN or SYN-2ACK packets */
{
if (tcpUdpLen > 0) {
if(ntohs(ip.ip_off) & IP_DF) D = 1; /* don't fragment bit is set
*/
- WIN = ntohs(tcp->th_win); /* TCP window size */
+ WIN = ntohs(tp.th_win); /* TCP window size */
- if (tcp_data != tcp_opt) /* there are some tcp_option to be parsed
*/
+ if ((tp.th_off * 4) >= sizeof(struct tcphdr)) /* there are some
tcp_option to be parsed */
{
- u_char *opt_ptr = tcp_opt;
+ u_char *opt_ptr = (u_char *)((struct tcphdr*)&tp + 1);
+ u_char *tcp_data =
+ (u_char *)((struct tcphdr*)&tp + tp.th_off * 4);
while(opt_ptr < tcp_data)
{
@@ -1019,7 +1018,7 @@
snprintf(fingerprint, sizeof(fingerprint),
"%04X:%s:%02X:%s:%d:%d:%d:%d:%c:%02X",
WIN, _MSS, ttl = TTL_PREDICTOR(ip.ip_ttl), WSS , S, N, D, T,
- (tcp->th_flags & TH_ACK) ? 'A' : 'S', tcpUdpLen);
+ (tp.th_flags & TH_ACK) ? 'A' : 'S', tcpUdpLen);
#if 0
traceEvent(CONST_TRACE_INFO, "[%s][%s]", srcHost->hostNumIpAddress,
fingerprint);
>
> -----Burton
>
> -----Original Message-----
> From: ntop-dev-admin@unipi.it [mailto:ntop-dev-admin@unipi.it]On Behalf
> Of Chris Turbeville
> Sent: Thursday, August 28, 2003 12:46 AM
> To: ntop-dev@Unipi.IT
> Subject: Re: [Ntop-dev] (was Sparc Sol9 patches)
>
>
> >
> > Are you saying that the Sparc platform can't handle an unaligned move?
> >
> > E.g another case of this comment?
> >
> > /* Need to copy this over in case bp isn't properly aligned.
> > * This occurs on SunOS 4.x at least.
> > * Paul D. Smith <psmith@baynetworks.com>
> > */
> >
> > Or is it that this (@922)
> >
> > memcpy(&tp, bp+hlen, sizeof(struct tcphdr));
> >
> > is duplicated by the lines in the fingerprint routine? If that's the
> case,
> > then shouldn't ALL the code in that block, 954..1032, be changed to use
tp
> > and drop tcp all together?
> Yea I can send that in as that is what I've done. The problem is bp
> isn't aligned so when the tcpheader * tries to refer to th_off it is a
> nonaligned ref and bombs. I have a patch converting all of the finger
> print stuff to tp based instead of the tcp pointers. I'll send that in
> instead.
> -Chris
> >
> > -----Burton
> >
> >
> > -----Original Message-----
> > From: ntop-dev-admin@unipi.it [mailto:ntop-dev-admin@unipi.it]On Behalf
> > Of Chris Turbeville
> > Sent: Tuesday, August 26, 2003 9:31 PM
> > To: ntop-dev@fuji.unipi.it
> > Subject: [Ntop-dev] Sparc Sol9 patches
> >
> >
> > Here's the summary of the work I've done to get NTOP running on Solaris:
> >
> > <snip/>
> >
> > This is the standard sparc alignment fix.
> > Index: ntop/pbuf.c
> > ===================================================================
> > RCS file: /export/home/ntop/ntop/pbuf.c,v
> > retrieving revision 2.135
> > diff -r2.135 pbuf.c
> > 963c963
> > < u_char *tcp_data = (u_char *)((int)tcp + tcp->th_off * 4);
> > ---
> > > u_char *tcp_data = (u_char *)((int)tcp + tp.th_off * 4);
> >
> > <snip/>
> >
> > --
> > cturbeville@verio.net Chris Turbeville
> > NTT/VERIO
> > Send mail with subject "send PGP Key" for PGP 6.5.2 Public key
> >
> >
> > _______________________________________________
> > Ntop-dev mailing list
> > Ntop-dev@unipi.it
> > http://listgateway.unipi.it/mailman/listinfo/ntop-dev
> >
>
>
> --
> cturbeville@verio.net Chris Turbeville
> NTT/VERIO
> Send mail with subject "send PGP Key" for PGP 6.5.2 Public key
> _______________________________________________
> Ntop-dev mailing list
> Ntop-dev@unipi.it
> http://listgateway.unipi.it/mailman/listinfo/ntop-dev
>
> _______________________________________________
> Ntop-dev mailing list
> Ntop-dev@unipi.it
> http://listgateway.unipi.it/mailman/listinfo/ntop-dev
>
--
cturbeville@verio.net Chris Turbeville
NTT/VERIO
Send mail with subject "send PGP Key" for PGP 6.5.2 Public key
_______________________________________________
Ntop-dev mailing list
Ntop-dev@unipi.it
http://listgateway.unipi.it/mailman/listinfo/ntop-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic