Showing posts from July, 2012

[How to][Trema] Get Flow_Removed message in routing_switch app

I asked an question about how to get Flow_Removed message in routing_switch app. But, soon I realized that I asked a stupid one because the answer is also in OpenFlow Spec v1.0.0.
We should set a "OFPFF_SEND_FLOW_REM" flag into "Flow Mod" message when we want to set a flow. The following list is the discussion message log.


If you want to receive "Flow Removed" message, you have to set
"OFPFF_SEND_FLOW_REM" flag into "Flow Mod" message when you set the flow.

Currently "routing_switch" app does not set this flag, then switches does
not send "Flow Removed" message.

  I try to get "Flow_Removed" message in routing_switch app, but do not see any one coming in.
The following is what I have done in the app and could someone tell me how to fix or modify it?
Many thanks.

Add it in mai…

[Shell Script][Example] Files Copying Operation with Warning When the Same File Exists

Because someone asks me to do him a favor for a sample of of file copying operation, I just use bash shell to do so. Here is an example to use shell script to copy files from source path to destination path, which will give a warning message and skip copying if there is a file that exists.

#!/bin/bashSRC_DIR="/home/liudanny/scripts"# put your source directoryDST_DIR="/home/liudanny/Downloads"# put your destination directoryforsrc_full_namein"$SRC_DIR"/*# loop all the files in source directory dofname=$(echo ${src_full_name}|sed 's#^.*/##')# get the file nameecho"name:$fname"dst_full_name=`printf "%s/%s" $DST_DIR $fname` # generate the destination file nameecho"dst_full_name:$dst_full_name"if[-e$dst_full_name];# check if destination file existsthenecho"File: $fname exists..."elseecho"Do copying $fname ..."cp$src_full_name$dst_full_name# if not exists, then copy filefidone

[ARP] How to look up arp table (mac/ip mapping) in Linux

First, we can ping hostname(ip_addr) to add mac/ip mapping into arp table
or use arp command to do so:
> arp -s hostname(ip_addr) MAC_addr

Second, look up arp table:
> arp -n   (I recommend to use "-n" for avoiding DNS lookup. It is faster.)
        Address                  HWtype    HWaddress               Flags Mask            Iface             ether      20:aa:4b:a3:4c:b7            C                     eth4

or there is another way:
> ip ne dev eth4 lladdr 20:aa:4b:a3:4c:b7 REACHABLE