[pox-dev] ARP request
Muhammad Furqan Gagan
furqan.gagan at gmail.com
Wed Nov 13 12:03:18 PST 2013
I have implemented this code to handle ARP.. is it ok ? I am not sure about that.. need your comments please
a= packet.find('arp')
if a:
if a.prototype == arp.PROTO_TYPE_IP:
if a.hwtype == arp.HW_TYPE_ETHERNET:
if a.protosrc != 0:
if a.protosrc in arp_tale:
if a.hwsrc == True:
Mac = EthAddr(a.hwsrc)
arp_table[a.protosrc] = Mac:
if a.opcode == arp.REQUEST:
# Maybe we can answer
if a.protodst in arp_table:
r = arp()
r.hwtype = a.hwtype
r.prototype = a.prototype
r.hwlen = a.hwlen
r.protolen = a.protolen
r.opcode = arp.REPLY
r.hwdst = a.hwsrc
r.protodst = a.protosrc
r.protosrc = a.protodst
Mac = arp_table[a.protodst]
Mac = _dpid_to_mac(dpid)
r.hwsrc = Mac
e = ethernet(type=packet.type, src=_dpid_to_mac(dpid),
dst=a.hwsrc)
e.payload = r
log.info("%s answering ARP for %s" % (dpid_to_str(dpid),
str(r.protosrc)))
msg = of.ofp_packet_out()
msg.data = e.pack()
msg.actions.append(of.ofp_action_output(port =
of.OFPP_IN_PORT))
msg.in_port = inport
event.connection.send(msg)
else:
msg = of.ofp_packet_out()
msg.actions.append(of.ofp_action_output(port = of.OFPP_FLOOD))
msg.data = event.ofp
event.connection.send(msg.pack())
Thanks
Muhammad
On Nov 13, 2013, at 12:56 PM, Murphy McCauley <murphy.mccauley at gmail.com> wrote:
> Durga is spot on, but I'll throw in another couple things you might look at:
> forwarding.l3_learning handles ARP
> proto.arp_helper attempts to make it easier to work with ARP
>
> (Oh, and misc.arp_responder has moved to proto.arp_responder in newer versions.)
>
> -- Murphy
>
> On Nov 13, 2013, at 2:06 AM, durga <c.vijaya.durga at gmail.com> wrote:
>
>>
>> hello,
>> Seems pox supports packet type as arp, can be found here (pox / pox / lib / packet / arp.py ), as well as may be you can get some help by refering to the below example.
>> pox / pox / misc / arp_responder.py
>>
>> Cheers!
>> Durga
>>
>>
>>
>> On Wed, Nov 13, 2013 at 8:35 PM, Muhammad Furqan Gagan <furqan.gagan at gmail.com> wrote:
>> Hello,
>>
>> Any one know how to handle ARP request in controller?
>>
>> Thanks
>>
>> Muhammad
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.noxrepo.org/pipermail/pox-dev-noxrepo.org/attachments/20131113/ad72e456/attachment-0002.htm>
More information about the pox-dev
mailing list