IP Filter bug report form.
--------------------------
IP Filter Version: 4.1.3
Operating System Version: Solaris 9 x86
Configuration: LKM

Description of problem:

While looking at another issue I noticed htonl being used
with tcp->th_seq and tcp->th_ack in a couple of places.
Most of the code seems to imply tcp->th_seq and tcp->th_ack
are network byte order which means htonl should never be
used with them.

How to repeat:

Since htonl and ntohl tend to do the same thing I'm not
sure that there is anything to repeat.  The enclosed patch
to ip_state.c is for the sake of code clarity.

*** ip_state.c.ORIGINAL Sun Jun 13 19:49:34 2004
--- ip_state.c  Wed Oct 27 15:58:00 2004
*************** u_32_t cmask;
*** 1695,1713 ****
                if ((flags & SI_W_SPORT) != 0) {
                        if (rev == 0) {
                                is->is_sport = sp;
!                               is->is_send = htonl(tcp->th_seq);
                        } else {
                                is->is_sport = dp;
!                               is->is_send = htonl(tcp->th_ack);
                        }
                        is->is_maxsend = is->is_send + 1;
                } else if ((flags & SI_W_DPORT) != 0) {
                        if (rev == 0) {
                                is->is_dport = dp;
!                               is->is_dend = htonl(tcp->th_ack);
                        } else {
                                is->is_dport = sp;
!                               is->is_dend = htonl(tcp->th_seq);
                        }
                        is->is_maxdend = is->is_dend + 1;
                }
--- 1696,1714 ----
                if ((flags & SI_W_SPORT) != 0) {
                        if (rev == 0) {
                                is->is_sport = sp;
!                               is->is_send = ntohl(tcp->th_seq);
                        } else {
                                is->is_sport = dp;
!                               is->is_send = ntohl(tcp->th_ack);
                        }
                        is->is_maxsend = is->is_send + 1;
                } else if ((flags & SI_W_DPORT) != 0) {
                        if (rev == 0) {
                                is->is_dport = dp;
!                               is->is_dend = ntohl(tcp->th_ack);
                        } else {
                                is->is_dport = sp;
!                               is->is_dend = ntohl(tcp->th_seq);
                        }
                        is->is_maxdend = is->is_dend + 1;
                }

-- John
-------------------------------------------------------------------------
|   Feith Systems  |   Voice: 1-215-646-8000  |  Email: [EMAIL PROTECTED]  |
|    John Wehle    |     Fax: 1-215-540-5495  |                         |
-------------------------------------------------------------------------

Reply via email to