Re: [nox-dev] Change the destination of packets

2011-07-25 Thread Ricardo Bennesby
Hi.

I am really sorry. I had not specified the port of the controller previously
in tcpdump.

Now it is dumping the control traffic.

Sorry for confusion. Hope it helps to find the problem.

Best Regards.

2011/7/25 kk yap yap...@stanford.edu

 There are no OpenFlow control traffic in both.  In fact, the second
 file is empty?

 Regards
 KK

 On 25 July 2011 07:30, Ricardo Bennesby ricardo.benne...@gmail.com
 wrote:
  Hi.
  The files generated by tcpdump in both controllers are attached.
  Hope it helps.
  Please let me know if it is wrong.
  Thanks for help.
  Best Regards.
 
  2011/7/24 kk yap yap...@stanford.edu
 
  I mean a tcpdump of the control traffic.  Not datapath.  :)
 
  On 24 July 2011 10:04, Ricardo Bennesby ricardo.benne...@gmail.com
  wrote:
   Hi. The tcpdump .pcap file the print of a dump-flows command are
   attached.
   The dump-flows, tcp-dump and wireshark shows the same result: I first
   ping
   from 192.168.47.1 (h1- n2) to 10.0.0.2 (h2-n1) and take mac address,
   port
   and IP of h2. Then, when I ping from 192.168.47.1 to 192.168.47.2
   (h2-n2) I
   want the packets be forwarded to 10.0.0.2.
   As the files shows, the packets are forwarded to MAC address desired,
   but it
   continues looking for the original IP, it means that it is not
 modified
   in
   the flow_mod.
   I tried in several way, fixing the original IP in the match field and
   setting an action to change the destination IP, but it didn't work. It
   con
   continues generating ARP request for 192.168.47.2.
   ofp_action_nw_addr *nwaction = (ofp_action_nw_addr
   *)malloc(sizeof(ofp_action_nw_addr));
   nwaction-type = htons(OFPAT_SET_NW_DST);
   nwaction-len = htons(sizeof(ofp_action_nw_addr));
   nwaction-nw_addr = inet_addr(10.0.0.2);
   In past discussions in the list, was said that openflow does routing
 in
   Layer 2. Is this a cause of destination IP does not change? Or am I
   missing
   something?
   Thank you very much for help.
   Best Regards.
  
   2011/7/21 kk yap yap...@stanford.edu
  
   A tcpdump of the control traffic will be useful and easier.
  
   Regards
   KK
  
   On 21 July 2011 16:04, Ricardo Bennesby ricardo.benne...@gmail.com
   wrote:
Hi KK. I tested as you suggested.
ofm-match.nw_dst = htons(36677824); // I tested also
ofm-match.nw_dst
=
flow.nw_dst;
and in the action I did:
nwaction-nw_addr = htons(new_ip);
But it continue trying to send to IP 192.168.47.2...
The Wireshark continues showing these:
Ethernet II, Src: 5a:8c:01:8b:e0:fb (5a:8c:01:8b:e0:fb), Dst:
62:4c:de:97:90:e4 (62:4c:de:97:90:e4)
Internet Protocol, Src: 192.168.47.1 (192.168.47.1), Dst:
192.168.47.2
(192.168.47.2)
   
The MAC adress is of host with IP 10.0.0.2. So the dataframes
 arrive
in
this
host. But the destination IP continues without midifications.
Any suggestion?
Thank you very much.
Best Regards.
2011/7/21 kk yap yap...@stanford.edu
   
Hi Ricardo,
   
Try matching on the old IP, then rewrite to the new IP.
   
Regards
KK
   
On 20 July 2011 14:50, Ricardo Bennesby 
 ricardo.benne...@gmail.com
wrote:
 Hi all. I would like to forward packets from one host to
 another.
 I have the following topology:
c0  c0
 | |
s3- s3
   /\/   \
  h1  h2h1   h2
 Each host can ping each other. The two networks are connected by
 their
 switches (s3).
 In net1 h1 and h2 have IP 10.0.0.1 and 10.0.0.2.
 In net2 h1 and h2 have IP 192.168.47.1 and 192.168.47.2
 I want that everytime I ping from some host in 192.168.47.2 the
 packets
 be
 forward to 10.0.0.2.
 I am using the switch.cc component and making some modifications
 on
 it.
 I set some actions to achieve this, using flow_mod and changing
 the
 out_port, destination mac_address and destination IP.
 Using wireshark, listening to the port where h2 (10.0.0.2) is, I
 saw
 that it
 got an ARP request from h1. So, looks like the packets arrive in
 the
 correct
 ethernet address, but it continue asking for 192.168.47.2. The
 destination
 IP was not modified. The code follows:
 if (flow.nw_dst == 36677824){//if destination
 ip=192.168.47.2
uint8_t no_of_actions_len = 56;
uint8_t action_length =
 no_of_actions_len/(sizeof(struct
 ofp_action_header));
unsigned char *action_type = (unsigned
 char*)malloc(action_length*sizeof(struct ofp_action_header));
 ofp_flow_mod* ofm;
size_t size = sizeof *ofm +
 7*sizeof(ofp_action_output);
boost::shared_arraychar raw_of(new
 char[size]);
ofm = (ofp_flow_mod*) raw_of.get();
   

Re: [nox-dev] Change the destination of packets

2011-07-24 Thread kk yap
I mean a tcpdump of the control traffic.  Not datapath.  :)

On 24 July 2011 10:04, Ricardo Bennesby ricardo.benne...@gmail.com wrote:
 Hi. The tcpdump .pcap file the print of a dump-flows command are attached.
 The dump-flows, tcp-dump and wireshark shows the same result: I first ping
 from 192.168.47.1 (h1- n2) to 10.0.0.2 (h2-n1) and take mac address, port
 and IP of h2. Then, when I ping from 192.168.47.1 to 192.168.47.2 (h2-n2) I
 want the packets be forwarded to 10.0.0.2.
 As the files shows, the packets are forwarded to MAC address desired, but it
 continues looking for the original IP, it means that it is not modified in
 the flow_mod.
 I tried in several way, fixing the original IP in the match field and
 setting an action to change the destination IP, but it didn't work. It con
 continues generating ARP request for 192.168.47.2.
                     ofp_action_nw_addr *nwaction = (ofp_action_nw_addr
 *)malloc(sizeof(ofp_action_nw_addr));
                     nwaction-type = htons(OFPAT_SET_NW_DST);
                     nwaction-len = htons(sizeof(ofp_action_nw_addr));
                     nwaction-nw_addr = inet_addr(10.0.0.2);
 In past discussions in the list, was said that openflow does routing in
 Layer 2. Is this a cause of destination IP does not change? Or am I missing
 something?
 Thank you very much for help.
 Best Regards.

 2011/7/21 kk yap yap...@stanford.edu

 A tcpdump of the control traffic will be useful and easier.

 Regards
 KK

 On 21 July 2011 16:04, Ricardo Bennesby ricardo.benne...@gmail.com
 wrote:
  Hi KK. I tested as you suggested.
  ofm-match.nw_dst = htons(36677824); // I tested also ofm-match.nw_dst
  =
  flow.nw_dst;
  and in the action I did:
  nwaction-nw_addr = htons(new_ip);
  But it continue trying to send to IP 192.168.47.2...
  The Wireshark continues showing these:
  Ethernet II, Src: 5a:8c:01:8b:e0:fb (5a:8c:01:8b:e0:fb), Dst:
  62:4c:de:97:90:e4 (62:4c:de:97:90:e4)
  Internet Protocol, Src: 192.168.47.1 (192.168.47.1), Dst: 192.168.47.2
  (192.168.47.2)
 
  The MAC adress is of host with IP 10.0.0.2. So the dataframes arrive in
  this
  host. But the destination IP continues without midifications.
  Any suggestion?
  Thank you very much.
  Best Regards.
  2011/7/21 kk yap yap...@stanford.edu
 
  Hi Ricardo,
 
  Try matching on the old IP, then rewrite to the new IP.
 
  Regards
  KK
 
  On 20 July 2011 14:50, Ricardo Bennesby ricardo.benne...@gmail.com
  wrote:
   Hi all. I would like to forward packets from one host to another.
   I have the following topology:
      c0              c0
       |                 |
      s3- s3
     /    \            /   \
    h1  h2        h1   h2
   Each host can ping each other. The two networks are connected by
   their
   switches (s3).
   In net1 h1 and h2 have IP 10.0.0.1 and 10.0.0.2.
   In net2 h1 and h2 have IP 192.168.47.1 and 192.168.47.2
   I want that everytime I ping from some host in 192.168.47.2 the
   packets
   be
   forward to 10.0.0.2.
   I am using the switch.cc component and making some modifications on
   it.
   I set some actions to achieve this, using flow_mod and changing the
   out_port, destination mac_address and destination IP.
   Using wireshark, listening to the port where h2 (10.0.0.2) is, I saw
   that it
   got an ARP request from h1. So, looks like the packets arrive in the
   correct
   ethernet address, but it continue asking for 192.168.47.2. The
   destination
   IP was not modified. The code follows:
       if (flow.nw_dst == 36677824){//if destination ip=192.168.47.2
                  uint8_t no_of_actions_len = 56;
                  uint8_t action_length =
   no_of_actions_len/(sizeof(struct
   ofp_action_header));
                  unsigned char *action_type = (unsigned
   char*)malloc(action_length*sizeof(struct ofp_action_header));
               ofp_flow_mod* ofm;
                      size_t size = sizeof *ofm +
   7*sizeof(ofp_action_output);
                      boost::shared_arraychar raw_of(new char[size]);
                      ofm = (ofp_flow_mod*) raw_of.get();
                      ofm-header.version = OFP_VERSION;
                      ofm-header.type = OFPT_FLOW_MOD;
                      ofm-header.length = htons(size);
                      //ofm-match.wildcards = htonl(0);
                      ofm-match.wildcards = htonl(120 | 11);
                      ofm-match.in_port = htons(flow.in_port);
                      ofm-match.dl_vlan = flow.dl_vlan;
                      ofm-match.dl_vlan_pcp = flow.dl_vlan_pcp;
                      memcpy(ofm-match.dl_src, flow.dl_src.octet,
   sizeof
   ofm-match.dl_src);
                      memcpy(ofm-match.dl_dst, new_mac.octet, sizeof
   ofm-match.dl_dst);
                      ofm-match.dl_type = flow.dl_type;
                      ofm-match.nw_src = flow.nw_src;
                      ofm-match.nw_dst = new_ip;
                      ofm-match.tp_src = flow.tp_src;
                      ofm-match.tp_dst = 

Re: [nox-dev] Change the destination of packets

2011-07-21 Thread Ricardo Bennesby
Hi KK. I tested as you suggested.

*ofm-match.nw_dst = htons(36677824); // I tested also ofm-match.nw_dst =
flow.nw_dst;*

and in the action I did:
*
*
*nwaction-nw_addr = htons(new_ip);*
*
*
But it continue trying to send to IP *192.168.47.2...*

The Wireshark continues showing these:

*Ethernet II, Src: 5a:8c:01:8b:e0:fb (5a:8c:01:8b:e0:fb), Dst:
62:4c:de:97:90:e4 (62:4c:de:97:90:e4)*
*Internet Protocol, Src: 192.168.47.1 (192.168.47.1), Dst: 192.168.47.2
(192.168.47.2)
*
The MAC adress is of host with IP 10.0.0.2. So the dataframes arrive in this
host. But the destination IP continues without midifications.

Any suggestion?

Thank you very much.

Best Regards.

2011/7/21 kk yap yap...@stanford.edu

 Hi Ricardo,

 Try matching on the old IP, then rewrite to the new IP.

 Regards
 KK

 On 20 July 2011 14:50, Ricardo Bennesby ricardo.benne...@gmail.com
 wrote:
  Hi all. I would like to forward packets from one host to another.
  I have the following topology:
 c0  c0
  | |
 s3- s3
/\/   \
   h1  h2h1   h2
  Each host can ping each other. The two networks are connected by their
  switches (s3).
  In net1 h1 and h2 have IP 10.0.0.1 and 10.0.0.2.
  In net2 h1 and h2 have IP 192.168.47.1 and 192.168.47.2
  I want that everytime I ping from some host in 192.168.47.2 the packets
 be
  forward to 10.0.0.2.
  I am using the switch.cc component and making some modifications on it.
  I set some actions to achieve this, using flow_mod and changing the
  out_port, destination mac_address and destination IP.
  Using wireshark, listening to the port where h2 (10.0.0.2) is, I saw that
 it
  got an ARP request from h1. So, looks like the packets arrive in the
 correct
  ethernet address, but it continue asking for 192.168.47.2. The
 destination
  IP was not modified. The code follows:
  if (flow.nw_dst == 36677824){//if destination ip=192.168.47.2
 uint8_t no_of_actions_len = 56;
 uint8_t action_length = no_of_actions_len/(sizeof(struct
  ofp_action_header));
 unsigned char *action_type = (unsigned
  char*)malloc(action_length*sizeof(struct ofp_action_header));
  ofp_flow_mod* ofm;
 size_t size = sizeof *ofm +
 7*sizeof(ofp_action_output);
 boost::shared_arraychar raw_of(new char[size]);
 ofm = (ofp_flow_mod*) raw_of.get();
 ofm-header.version = OFP_VERSION;
 ofm-header.type = OFPT_FLOW_MOD;
 ofm-header.length = htons(size);
 //ofm-match.wildcards = htonl(0);
 ofm-match.wildcards = htonl(120 | 11);
 ofm-match.in_port = htons(flow.in_port);
 ofm-match.dl_vlan = flow.dl_vlan;
 ofm-match.dl_vlan_pcp = flow.dl_vlan_pcp;
 memcpy(ofm-match.dl_src, flow.dl_src.octet, sizeof
  ofm-match.dl_src);
 memcpy(ofm-match.dl_dst, new_mac.octet, sizeof
  ofm-match.dl_dst);
 ofm-match.dl_type = flow.dl_type;
 ofm-match.nw_src = flow.nw_src;
 ofm-match.nw_dst = new_ip;
 ofm-match.tp_src = flow.tp_src;
 ofm-match.tp_dst = flow.tp_dst;
 ofm-match.nw_proto = flow.nw_proto;
 ofm-match.nw_tos = flow.nw_tos;
 ofm-match.tp_src = flow.tp_src;
 ofm-cookie = htonl(0);
 ofm-command = htons(OFPFC_ADD);
 ofm-buffer_id = htonl(buffer_id);
 ofm-idle_timeout = htons(5);
 ofm-hard_timeout = htons(OFP_FLOW_PERMANENT);
 ofm-priority = htons(OFP_DEFAULT_PRIORITY);
 ofm-flags = htons(ofd_flow_mod_flags());
 ofp_action_dl_addr *dlaction = (ofp_action_dl_addr
  *)malloc(sizeof(ofp_action_dl_addr));
 dlaction-type = htons(OFPAT_SET_DL_DST);
 dlaction-len = htons(sizeof(ofp_action_dl_addr));
 memcpy(dlaction-dl_addr, ofm-match.dl_dst,
  sizeof(ofm-match.dl_dst));
ofp_action_nw_tos *nw_tos = (ofp_action_nw_tos
  *)malloc(sizeof(ofp_action_nw_tos));
nw_tos-type = htons(OFPAT_SET_NW_TOS);
nw_tos-len = htons(sizeof(ofp_action_nw_tos));
nw_tos-nw_tos = 0;
ofp_action_tp_port *tp_src = (ofp_action_tp_port
  *)malloc(sizeof(ofp_action_tp_port));
tp_src-type = htons(OFPAT_SET_TP_SRC);
tp_src-len = htons(sizeof(ofp_action_tp_port));
tp_src-tp_port = htons(0);
 ofp_action_tp_port *tp_dst = (ofp_action_tp_port
  *)malloc(sizeof(ofp_action_tp_port));
tp_dst-type = htons(OFPAT_SET_TP_DST);