Forum Discussion

Jonathan_Scholi's avatar
Jonathan_Scholi
Icon for Cirrostratus rankCirrostratus
Apr 28, 2011

Preserving ToS over the duration of a download

We have the need to set ToS values for a video application. In order to set ToS values differently for the video and non-video that goes through the application, I created one pool with IP ToS values set to 40, and another with values left at the default. An iRule switches between the two pools:

 

 

when HTTP_REQUEST {

 

if { [string tolower [HTTP::uri]] contains "wmv" } {

 

pool tos-40-pool

 

if { ![LB::status up] } drop

 

}

 

}

 

 

The problem is, this doesn't work well, presumably because only the intial request contains "wmv". Is there something I can do to ensure the entire file is transferred using the appropriate ToS?
  • Hi Jonathan,

    If you don't have a OneConnect profile associated with the virtual server, you should be able to use a rule like this to keep the same pool selected after an HTTP request contains wmv in the path. Make sure to comment out or remove the logging once you're done testing.

    
    when CLIENT_ACCEPTED {
    
        Save the name of the default pool before it is modified in the rule
       set default_pool [LB::server pool]
       log local0. "[IP::client_addr]:[TCP::client_port]: Default pool: $default_pool"
    }
    when HTTP_REQUEST {
    
        Check if request is for a wmv file
       switch -glob [string tolower [HTTP::path]] {
          "*.wmv" {
                pool tos-40-pool
                log local0. "[IP::client_addr]:[TCP::client_port]: Selected: [LB::server] for wmv request"
                if { ![LB::status up] }{
                   log local0. "[IP::client_addr]:[TCP::client_port]: Pool not up, dropping connection"
                   drop
                }
             }
          }
          default {
             log local0. "[IP::client_addr]:[TCP::client_port]: Non-wmv file, detaching"
             LB::detach
          }
       }
    }
     Debug events only.  Comment out or remove once done testing.
    when LB_SELECTED {
       log local0. "[IP::client_addr]:[TCP::client_port]: Selected: [LB::server]"
    }
    when SERVER_CONNECTED {
       log local0. "[IP::client_addr]:[TCP::client_port]: Connected: [IP::server_addr]:[TCP::server_port]"
    }
    

    Aaron
  • It seems like a rule like this should work, but it turns out that the initial file that you get when requesting the WMV file is an HTML file which then loads the actual WMV file. As far as I can tell, the request for the actual file does not contain any distinguishing features in the header which would allow you to filter on it. Could you suggest any ways to work around this problem? We don't have packet level control over the application generating this traffic.