Hi,
Code that can be set by the REST API is the following.
{
"actions": [
{
"field": "ipv4_src",
"type": "SET_FIELD",
"value": "10.10.10.10"
},
{
"field": "ipv4_dst",
"type": "SET_FIELD",
"value": "1.0.3.2"
},
{
"type": "SET_FIELD",
"field": "tcp_src",
"value": 20
},
{
"field": "tcp_dst",
"type": "SET_FIELD",
"value": 25
},
{
"field": "ip_dscp",
"type": "SET_FIELD",
"value": 4
},
{
"port": 2,
"type": "OUTPUT"
}
],
"cookie": 1,
"cookie_mask": 1,
"dpid": 1,
"flags": 1,
"hard_timeout": 0,
"idle_timeout": 0,
"match": {
"eth_type": 2048,
"in_port": 1,
"ip_dscp": 0,
"ip_proto": 6,
"ipv4_dst": "1.0.3.2",
"ipv4_src": "1.0.1.2",
},
"priority": 100,
"table_id": 0
}
If you want to set the TCP_SRC and TCP_DST to ovs switch,
you must specify a 6 to ip_proto of the match field.
For that reason, it is not possible to change the value of the ip_proto
by the REST API.
The conditions for setting the match field,
please referring to "7.2.3.8 Header Match Fields" of OpenFlow1.3 Spec.
If you still want to change the value of ip_proto,
please check the specifications of your ovs switch.
Thanks,
On 2016年08月27日 23:12, Richard Mayers wrote:
> Hello folks,
>
> I am trying to install a rule in the switch that changes ip_proto of a
> packet. For example from UDP to TCP. However, it does not work, once I
> add the set_field ip_proto in the actions the rules does not get
> installed in the ovs switch` (version 2.5.90).
>
> To do that I am using the REST API provided in the ryu source code.
> For example the code below should change from udp to tcp, right? Am I
> doing something wrong?
>
> {
> "dpid": 1,
> "cookie": 1,
> "cookie_mask": 1,
> "table_id": 0,
> "idle_timeout": 0,
> "hard_timeout": 0,
> "priority": 100,
> "flags": 1,
> "match":{
> "in_port":1, "udp_src":2, "udp_dst":10, "ipv4_src":"1.0.1.2",
> "ipv4_dst":"1.0.3.2", "ip_dscp":0, "eth_type":2048, "ip_proto":17
> },
> "actions":[
> {
> "type": "SET_FIELD",
> "field": "ipv4_src",
> "value": "10.10.10.10"
> },
> {
> "type": "SET_FIELD",
> "field": "ipv4_dst",
> "value": "1.0.3.2"
> },
> {
> "type": "SET_FIELD",
> "field": "tcp_src",
> "value": 20
> },
> {
> "type": "SET_FIELD",
> "field": "tcp_dst",
> "value": 25
> },
> {
> "type": "SET_FIELD",
> "field": "ip_dscp",
> "value": 4
> },
> {
> "type":"OUTPUT",
> "port": 2
> },
> {
> "type": "SET_FIELD",
> "field": "ip_proto",
> "value": 6
> }
>
> ]
> }
>
> PS: You may ask why do I want to change the protocol. But is not a
> problem since it will cross a second switch that will restore the
> protocol to the original one before reaching the end host.
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>
------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel