Patent ID: 8139583

Claim:
A method for packet modification in a packet forwarding device, the method comprising: determining a transmit modification index associated with an inbound packet, the transmit modification index pointing to a command set for modifying the inbound packet, the command set containing at least one conditional command; assembling a mask value associated with the inbound packet; locating a mask set based on the mask value, the mask set associated with the command set, the mask set containing binary values corresponding to positions of conditional commands in the command set; applying the mask set to the command set for modifying the inbound packet; and modifying the inbound packet to produce a modified outbound packet in accordance with the application of the mask set to the command set; and wherein applying the mask set to the command set for modifying the inbound packet comprises: fetching each conditional command in the command set; determining whether the fetched conditional command is selected based on a binary value in the mask set, the binary value corresponding to a position of the fetched conditional command in the command set; and changing the fetched conditional command to a no operation command when the binary value in the mask set corresponding to the position of the fetched conditional command in the command set indicates the fetched conditional command has not been selected for execution.