Re: [Ryu-devel] IP packet handler
Brought to you by:
nz_gizmoguy
|
From: Gabriele G. <gab...@gm...> - 2013-10-15 15:39:32
|
Many thanks for your reply, now I've tried some tests and they work.
Unfortunately, I'm experiencing another issue: I want my switch to extract
IPv6 ND informations, but the console reply back to me with this error when
I execute the following code (the omitted portion of code is the same of
simple_switch.py example)
[ERROR]
hub: uncaught exception: Traceback (most recent call last):
File "/home/user/ryu/ryu/lib/hub.py", line 48, in _launch
func(*args, **kwargs)
File "/home/user/ryu/ryu/base/app_manager.py", line 110, in _event_loop
handler(ev)
File "/home/user/ryu/ryu/app/simple_switch03BACKUP.py", line 68, in
_packet_in
icimpv6 = pkt.get_protocol(icmpv6.nd_neighbor)
File "/home/user/ryu/ryu/lib/packet/packet.py", line 104, in get_protocol
result = self.get_protocols(protocol)
File "/home/user/ryu/ryu/lib/packet/packet.py", line 97, in get_protocols
assert issubclass(protocol, packet_base.PacketBase)
AssertionError
[CODE]
@set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
def _packet_in_handler(self, ev):
msg = ev.msg
datapath = msg.datapath
ofproto = datapath.ofproto
pkt = packet.Packet(msg.data)
eth = pkt.get_protocol(ethernet.ethernet)
dst = eth.dst
src = eth.src
try:
ippiv6 = pkt.get_protocol(ipv6.ipv6)
ipv6s = ippiv6.src
except:
ipv6s = "not assigned yet"
icimpv6 = pkt.get_protocol(icmpv6.icmpv6)
#icmpv6type = icimpv6.type_
options = pkt.get_protocol(icmpv6.nd_option_pi)
if (icmpv6type == 134):
prefixes = option.prefix
self.logger.info("[ALERT] packet contains a Router Advertisement!")
self.logger.info("Prefix announced: %s", prefixes)
dpid = datapath.id
self.mac_to_port.setdefault(dpid, {})
self.logger.info("packet in %s ipv6:%s %s %s %s", dpid, ipv6s, src,
dst, msg.in_port)
# learn a mac address to avoid FLOOD next time.
self.mac_to_port[dpid][src] = msg.in_port
...
How can I fix this?
Many thanks for your time
Gabriele
2013/10/15 FUJITA Tomonori <fuj...@la...>
> Hi,
>
> On Sun, 13 Oct 2013 15:58:14 +0200
> Gabriele Gerbino <gab...@gm...> wrote:
>
> > Hi there, I'm new to this ML and to OF in general. I was trying to gain
> > confidence with ryu but I found myself stucked so soon. I wanted to
> modify
> > the "simple_switch.py" example in order to make it able to learn IP
> > addresses too and handle packets based on them. In particular, my idea is
> > to use ryu to avoid some ipv6 security issues (rogue RA). Is there anyone
> > who can give me some instructions and/or examples of ip packet handlers?
>
> I updated simple_switch.py. Packet library enables you to access an IP
> header in a packet easily. Also check out:
>
> http://ryu.readthedocs.org/en/latest/library_packet_ref.html
>
>
|