Forum Discussion

Tommy_lee_55826's avatar
Tommy_lee_55826
Icon for Nimbostratus rankNimbostratus
Jan 16, 2012

irule error applied in MMS Message

help all

 

this MMS message should have controlled by irule

 

It's not a problem when sending a few packets, but heavy packet ( 300 over pps) send to BIG-IP that happen to problems

 

I think the problem is cmp , so i already applied 'cmp mode all'

 

units is BIG-IP 6900 and TMOS v11

 

I want you to hear a definitive opinion.

 

 

==================================================

 

  • Hi,

     

     

    I'm not able to download the attachment for some reason. Could you post the iRule in [ code ] [/ code ] blocks in a reply?

     

     

    Thanks, Aaron
  • here is attached file

     

    thanks you that interested about this problem

     

     

    soory.... retry below...
  •  rule smtp_172_irule {
       when CLIENT_ACCEPTED {
        set chelo ""
        set cfrom ""
        set crcpt ""
    set fdata ""
        TCP::respond "220\r\n"
        log local0. "172_client accepted"
        TCP::collect
    }
    when CLIENT_DATA {
    
        set cdata [TCP::payload]
        if { [ string length $cdata ] <= 0 } {
            return
        }
        elseif { not ( $cdata contains "\r\n" ) } {
            return
        }
        elseif { $cdata starts_with "EHLO" } {
            set chelo [TCP::payload]
            TCP::respond "250 OK\r\n"
            TCP::payload replace 0 [string length $chelo] ""
            log local0. "172_HELO"
            return
        }
    elseif { $cdata starts_with "QUIT" } {
            set cquit [TCP::payload]
    TCP::respond "221\r\n"
            TCP::payload replace 0 [string length [TCP::payload]] $cquit
            log local0. "172_QUIT"
            return
        }
        elseif { $cdata starts_with "MAIL FROM:" } {
            set cfrom [TCP::payload]
            TCP::respond "250 OK\r\n"
            TCP::payload replace 0 [string length $cfrom] ""
            log local0. "172_MAIL FROM"
            return
        }
        elseif { $cdata starts_with "RCPT TO:" } {
            set crcpt "$crcpt[TCP::payload]"
            TCP::respond "250 OK\r\n"
            TCP::payload replace 0 [string length [TCP::payload]] ""
            log local0. "172_RCPT TO"
            return
        }
        elseif { $cdata starts_with "DATA" } {
            set fdata "$fdata[TCP::payload]"
            TCP::respond "354\r\n"
            TCP::payload replace 0 [string length [TCP::payload]] ""
            log local0. "172_DATA"
    return
        }
    elseif { [string tolower $cdata] contains "x-mms-message-type" } {
    if { [string tolower $cdata] contains "mm4_forward.req" } {
    set fq [TCP::payload]
    log local0. "172_MM4_forward.REQ"
    log local0. "port : [client_port]"
    pool pool_172_MMS_25
    log local0. "LB_pool : 172_mms_FQ (78,79)"
    TCP::payload replace 0 [string length [TCP::payload]] $chelo$cfrom$crcpt$fdata$fq
    TCP::respond "250 OK\r\n"
    }
    elseif { [string tolower $cdata] contains "mm4_delivery_report.res" } {
    set ds [TCP::payload]
    log local0. "172_MM4_delivery_report.RES"
    set ds_transaction [findstr [string tolower [TCP::payload]] "x-mms-transaction-id: " 22 1]
    log local0. "172_transaction-ID : $ds_transaction"
    
    if { $ds_transaction equals "1" } {
    pool pool_172_MMS1_25
    log local0. "LB_pool : 172_mms1 (78)"
    }
    elseif { $ds_transaction equals "4" } {
    pool pool_172_MMS2_25
    log local0. "LB_pool : 172_mms2 (79)"
    }
    else {
    log local0. "LB server (78,79)"
    pool pool_172_MMS_25
    }
    TCP::payload replace 0 [string length [TCP::payload]] $chelo$cfrom$crcpt$fdata$ds
    TCP::respond "250 OK\r\n"
    }
    elseif { [string tolower $cdata] contains "mm4_forward.res" } {
    set fs [TCP::payload]
    log local0. "172_MM4_forward.RES"
    set fs_message [findstr [string tolower [TCP::payload]] "x-mms-message-id: " 18 1]
    log local0. "172_message-ID : $fs_message"
    log local0. "port2 : [client_port]"
    if { $fs_message equals "1" } {
    pool pool_172_MMS1_25
    log local0. "LB_pool : 172_mms1 (78)"
    TCP::payload replace 0 0 $chelo$cfrom$crcpt$fdata$fs
    TCP::respond "250 OK\r\n"
    }
    elseif { $fs_message equals "4" } {
    pool pool_172_MMS2_25
    log local0. "LB_pool : 172_mms2 (79)"
    }
    else {
    log local0. "LB server (78,79)"
    pool pool_172_MMS_25
    }
    }
    elseif { [string tolower $cdata] contains "mm4_delivery_report.req" } {
    set dq [TCP::payload]
    log local0. "172_MM4_Delivery_report.REQ"
    set dq_message [findstr [string tolower [TCP::payload]] "x-mms-message-id: " 18 1]
    log local0. "172_message-ID : $dq_message"
    
    if { $dq_message equals "1" } {
    pool pool_172_MMS1_25
    log local0. "LB_pool : 172_mms1 (78)"
    }
    elseif { $dq_message equals "4" } {
    pool pool_172_MMS2_25
    log local0. "LB_pool : 172_mms2 (79)"
    }
    else {
    log local0. "LB server (78,79)"
    pool pool_172_MMS_25
    }
    TCP::payload replace 0 [string length [TCP::payload]] $chelo$cfrom$crcpt$fdata$dq
    TCP::respond "250 OK\r\n"
    }
    else {
    set aa [TCP::payload]
    log local0. "no-type"
    log local0. "LB server (78,79)"
    pool pool_172_MMS_25
    TCP::payload replace 0 [string length [TCP::payload]] $chelo$cfrom$crcpt$fdata$aa
    TCP::respond "250 OK\r\n"
    }
    }
    log local0. "client END port : [client_port]"
    
    }
    when SERVER_CONNECTED {
        log "server connected"
        TCP::collect
    }
    
    when SERVER_DATA {
        set sdata [TCP::payload]
    log local0. "server port : [client_port]"
    
        if { $sdata starts_with "220" } {
            TCP::payload replace 0 [string length $sdata] ""
            log local0. "172_220"
            return
        }
        if { $sdata contains "\r\n354 " } {
            TCP::payload replace 0 [string length $sdata] ""
            log local0. "172_354"
    return
        }
        if { [ string length $sdata ] <= 0 } {
            return
        }
        TCP::release
        TCP::collect
    }
    when CLIENT_CLOSED {
        log local0. "172_client closed"
    }
    }
    
  • Do you see spikes in CPU, memory or disk I/O? The first thing I'd try is to comment out all of the logging while you do load testing.

     

     

    Aaron
  • thanks your advice, our team SE had solve the problem.

     

    You've pointed out that the CPU load higher(50% over), but due to not much traffic (150cps).

     

    we found the missing packets in traffic flow. finally, we found one of the packets sent from server to client that is quit packet.

     

    Cause of abnormal termination was due to the cpu load. so for normal shutdown was added to irule, the customer has a satisfactory MMS TEST.

     

    It's tough...

     

     

    thank you for your advice.

     

    ITIAN SE Manager tommy.