About this list Date view Thread view Subject view Author view Attachment view

From: Ondej Sur (sury.ondrej_at_globe.cz)
Date: Wed 30 Jul 2003 - 09:58:23 BST


This is original code from udp.c:

        for(sk = udp_hash[hnum & (UDP_HTABLE_SIZE - 1)]; sk != NULL; sk
= sk->next) {
                if(sk->num == hnum && !ipv6_only_sock(sk)) {
                        int score;
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
                        score = sk->family == PF_INET ? 1 : 0;
#else
                        score = 1;
#endif
/* 1 */
                        if(sk->rcv_saddr) {
                                if(sk->rcv_saddr != daddr)
                                        continue;
                                score+=2;
                        }
                        if(sk->daddr) {
                                if(sk->daddr != saddr)
                                        continue;
                                score+=2;
                        }
                        if(sk->dport) {
                                if(sk->dport != sport)
                                        continue;
                                score+=2;
                        }
                        if(sk->bound_dev_if) {
                                if(sk->bound_dev_if != dif)
                                        continue;
                                score+=2;
                        }
                        if(score == 9) {
                                result = sk;
                                break;
                        } else if(score > badness) {
                                result = sk;
                                badness = score;
                        }
/* 2 */
                }
        }

Patch for this chunk is:

***************
*** 226,229 ****
--- 241,250 ----
                        score = sk->family == PF_INET ? 1 : 0;
  #else
+ }else if (sk->ip_info != NULL){
+ if (udp_in_list (sk->ip_info,daddr)){
+ score++;
+ }else{
+ continue;
+ }
                        score = 1;
  #endif

There is two problems I see:

1. It broke logical flow of program, when sk->num == hnum &&
!ipv6_only_sock(sk) is true then code marked between /*1*/ and /*2*/
never executes, which is not true for original code.

2. because 1., score variable is not available for code in patch and
rest of code manipulating with score variable.

3. score is used uninitalized when 2. is fixed by moving int score line
before if line.

Could someone look at that and produce correct patch?

-- 
Ondřej Surý - co/CTO
---------------------------------------------------
Globe Internet, s.r.o.       -      http://globe.cz
Pláničkova 1, 162 00 Praha 6 - http://mapa.globe.cz
Tel.: +420 2 35365000        -      info_at_servery.cz


About this list Date view Thread view Subject view Author view Attachment view
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Wed 30 Jul 2003 - 10:43:03 BST by hypermail 2.1.3