Forum Discussion

Ahmed_Galal's avatar
Ahmed_Galal
Icon for Cirrostratus rankCirrostratus
Oct 09, 2019

Irule to insert source IP in UDP payload

Hi All,

 

can anyone please provide me with iRule that insert Source IP address in UDP payload?

  • when CLIENT_ACCEPTED {
      set payloadLength [UDP::payload length]
      set address [IP::client_addr]
      set addressLength [ string length $address ]
      UDP::payload replace $payloadLength $addressLength $address
    }

    You can also use the CLIENT_DATA and SERVER_DATA events and take a look at https://clouddocs.f5.com/api/irules/UDP__payload.html

  • when CLIENT_ACCEPTED {
      set payloadLength [UDP::payload length]
      set address [IP::client_addr]
      set addressLength [ string length $address ]
      UDP::payload replace $payloadLength $addressLength $address
    }

    You can also use the CLIENT_DATA and SERVER_DATA events and take a look at https://clouddocs.f5.com/api/irules/UDP__payload.html

    • AndresSolano's avatar
      AndresSolano
      Icon for Nimbostratus rankNimbostratus

      I tried this iRule for DNS and as soon as I apply the rule in the VIP I stop getting responses, also while collecting captures on the LTM I a "Malformed Packet" on the query from the LTM and the response from the server is a "refused".

      Any idea what could be causing this issue? Did you got it working on your side?

    • jayendra07's avatar
      jayendra07
      Icon for Nimbostratus rankNimbostratus

      so if we need to insert source-IP in TCP payload, we just need to replace UDP with TCP in given irule ?
      when CLIENT_ACCEPTED {
      set payloadLength [TCP::payload length]
      set address [IP::client_addr]
      set addressLength [ string length $address ]
      TCP::payload replace $payloadLength $addressLength $address
      }