]> git.hungrycats.org Git - linux/commitdiff
[TCP]: Use proper time_*() comparisons on jiffies.
authorDavid S. Miller <davem@nuts.ninka.net>
Sat, 14 Jun 2003 22:39:25 +0000 (15:39 -0700)
committerDavid S. Miller <davem@nuts.ninka.net>
Sat, 14 Jun 2003 22:39:25 +0000 (15:39 -0700)
net/ipv4/tcp_ipv4.c
net/ipv4/tcp_minisocks.c
net/ipv4/tcp_timer.c

index efc7e05f184c68d7dbb3266d0c12354cf948ac90..bd3ff586855e19d0b3c11f9917bae3b12ca9a40a 100644 (file)
@@ -1363,7 +1363,7 @@ static inline void syn_flood_warning(struct sk_buff *skb)
 {
        static unsigned long warntime;
 
-       if (jiffies - warntime > HZ * 60) {
+       if (time_after(jiffies, (warntime + HZ * 60))) {
                warntime = jiffies;
                printk(KERN_INFO
                       "possible SYN flooding on port %d. Sending cookies.\n",
index e0f6ea8075c1b0b891c8bfa0f1a436926d0ad297..8653fdbd201948d5a432aed48fa7388b0d0ded77 100644 (file)
@@ -563,7 +563,7 @@ void tcp_tw_schedule(struct tcp_tw_bucket *tw, int timeo)
                        tcp_twcal_timer.expires = tcp_twcal_jiffie + (slot<<TCP_TW_RECYCLE_TICK);
                        add_timer(&tcp_twcal_timer);
                } else {
-                       if ((long)(tcp_twcal_timer.expires - jiffies) > (slot<<TCP_TW_RECYCLE_TICK))
+                       if (time_after(tcp_twcal_timer.expires, jiffies + (slot<<TCP_TW_RECYCLE_TICK)))
                                mod_timer(&tcp_twcal_timer, jiffies + (slot<<TCP_TW_RECYCLE_TICK));
                        slot = (tcp_twcal_hand + slot)&(TCP_TW_RECYCLE_SLOTS-1);
                }
@@ -596,7 +596,7 @@ void tcp_twcal_tick(unsigned long dummy)
        j = tcp_twcal_jiffie;
 
        for (n=0; n<TCP_TW_RECYCLE_SLOTS; n++) {
-               if ((long)(j - now) <= 0) {
+               if (time_before_eq(j, now)) {
                        struct tcp_tw_bucket *tw;
 
                        while((tw = tcp_twcal_row[slot]) != NULL) {
index 0ed9f305232f542a6490d17a08b944ef37a45149..1fad1d9afcea8194033630fb8a2b41692e6e647c 100644 (file)
@@ -227,7 +227,7 @@ static void tcp_delack_timer(unsigned long data)
        if (sk->sk_state == TCP_CLOSE || !(tp->ack.pending & TCP_ACK_TIMER))
                goto out;
 
-       if ((long)(tp->ack.timeout - jiffies) > 0) {
+       if (time_after(tp->ack.timeout, jiffies)) {
                if (!mod_timer(&tp->delack_timer, tp->ack.timeout))
                        sock_hold(sk);
                goto out;
@@ -436,7 +436,7 @@ static void tcp_write_timer(unsigned long data)
        if (sk->sk_state == TCP_CLOSE || !tp->pending)
                goto out;
 
-       if ((long)(tp->timeout - jiffies) > 0) {
+       if (time_after(tp->timeout, jiffies)) {
                if (!mod_timer(&tp->retransmit_timer, tp->timeout))
                        sock_hold(sk);
                goto out;
@@ -516,7 +516,7 @@ static void tcp_synack_timer(struct sock *sk)
        do {
                reqp=&lopt->syn_table[i];
                while ((req = *reqp) != NULL) {
-                       if ((long)(now - req->expires) >= 0) {
+                       if (time_after_eq(now, req->expires)) {
                                if ((req->retrans < thresh ||
                                     (req->acked && req->retrans < max_retries))
                                    && !req->class->rtx_syn_ack(sk, req, NULL)) {