[PATCH] xtables-addons 3.15 doesn't compile on 32-bit x86

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Xtables-addons 3.15 doesn't compile with 32-bit x86 kernel:

ERROR: "__divdi3"
[/mnt/sdb1/lamp32-11/build/xtables-addons-3.15/extensions/pknock/xt_pknock.ko]
undefined!
 
Replace long integer division with do_div().

This patch fixes it:

--- extensions/pknock/xt_pknock.c-orig                                  
                                                 
+++ extensions/pknock/xt_pknock.c                                       
                                                 
@@ -335,7 +335,9 @@                                                     
                                                 
 static inline bool                                                     
                                                 
 has_logged_during_this_minute(const struct peer *peer)                 
                                                 
 {                                                                      
                                                 
-       return peer != NULL && peer->login_sec / 60 ==
ktime_get_seconds() / 60;                                          
+       unsigned long x = ktime_get_seconds();                          
                                                 
+       unsigned long y = peer->login_sec;                              
                                                 
+       return peer != NULL && do_div(y, 60) == do_div(x, 60);          
                                                 
 }                                                                      
                                                 
                                                                        
                                                 
 /**                                                                    
                                                 
@@ -709,6 +711,7 @@                                                     
                                                 
        unsigned int hexa_size;                                         
                                                 
        int ret;                                                        
                                                 
        bool fret = false;                                              
                                                 
+       unsigned long x = ktime_get_seconds();                          
                                                 
        unsigned int epoch_min;                                         
                                                 
                                                                        
                                                 
        if (payload_len == 0)                                           
                                                 
@@ -727,7 +730,8 @@                                                     
                                                 
        hexresult = kzalloc(hexa_size, GFP_ATOMIC);                     
                                                 
        if (hexresult == NULL)                                          
                                                 
                return false;                                           
                                                 
-       epoch_min = ktime_get_seconds() / 60;                           
                                                 
+                                                                       
                                                 
+       epoch_min = do_div(x, 60);                                      
                                                 
                                                                        
                                                 
        ret = crypto_shash_setkey(crypto.tfm, secret, secret_len);      
                                                 
        if (ret != 0) {



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux