summaryrefslogtreecommitdiff
path: root/sys/net/switchofp.c
AgeCommit message (Collapse)Author
2017-08-11Fix out-of-bounds read when looking up the flow-mod handler.Reyk Floeter
Another case of the "C indexes start at 0" bug where ">" must be ">=": if (i >= nitems(foo)) return (NULL); else return (foo[i].handler); Coverity CID 1453340; Severity: Major OK millert@ goda@
2017-08-11Set free'd tables to NULL in swofp_flow_entry_instruction_free().Reyk Floeter
swofp_flow_entry_instruction_free is used to "reset" the tables. It called free on each table but didn't set them to NULL, causing potential double-frees in swofp_flow_entry_put_instructions(). Instead of complicating the code and adding a X = NULL for each table, restructure it by introducing a generic function to free tables as they're all derived from struct ofp_instruction. Reported by Coverity as various "Read from pointer after free" errors: Coverity CIDs 1452955 1453345 1452858 1453031 1453179 1453216 1453093 OK millert@ goda@
2017-08-11Priority is stored in the vlan_pcp field not in the vlan_vid field.Reyk Floeter
Found by Coverity because vlan_vid was assigned twice. Coverity CID 1453293; Severity: Minor OK millert@ goda@
2017-08-11Fix copy-paste error: first check is on "target", second check is on "key".Reyk Floeter
Coverity CID 1453281; Severity: Minor OK millert@ goda@
2017-08-11Instead of repeating the same return statement in both cases of aReyk Floeter
final if statement, use it once after the if statement. Avoids duplicated and structurally dead code. Coverity CID 1452943; Severity: Insignificant OK millert@ goda@
2017-08-11Fix out-of-bounds read when looking up the multipart message handler.Reyk Floeter
This could be triggered by an OpenFlow packet with the multipart message type of 14 ... because C array indexes start at 0. Coverity CID 1452917; Severity: Major OK millert@ goda@
2017-08-11Fix out-of-bounds read when looking up the message handler.Reyk Floeter
This could be triggered by an OpenFlow packet with the message type of 30 ... because C array indexes start at 0. Coverity CID 1453219; Severity: Major OK millert@ goda@
2017-07-19The proper way to check for successful allocation of an mbuf cluster isClaudio Jeker
by checking M_EXT flag. m_freem() the mbuf in the errorcase to prevent a mbuf leak. MCLGET does not set the mbuf to NULL on failure. Found by Ilja Van Sprundel OK bluhm@ deraadt@
2017-05-12Make a kernel with switch(4) but without INET6 compile again.Alexander Bluhm
Sprinkle some #ifdef INET6 and do not use in6addr_any from the netinet6 code. test and OK rzalamena@
2017-03-01Remove a misleading comment asking if a timeout needs a LOCK, it doesn't.Martin Pieuchot
ok goda@
2017-01-24Kill some unused variables found by clang.Rafael Zalamena
2017-01-17Make switch(4) compile with debug again.Rafael Zalamena
2017-01-17Initialize swas_actions for set-field with the expected pointer to theRafael Zalamena
swpld_set_fields vector. This makes write-action work with set-field actions.
2017-01-17Fix a panic when set-field with VLAN is set, but no VLANs wereRafael Zalamena
classified in the packet.
2017-01-17Clean-up switch(4) device by removing excess prototypes, verbose debugsRafael Zalamena
and unused functions. ok reyk@
2017-01-17Add more action specific validations, unbreak instructions validationRafael Zalamena
with multiple actions and add more error reports with what went wrong.
2017-01-16spacingReyk Floeter
2017-01-16Add missing declarations found with -Wmissing-declarationsReyk Floeter
2017-01-16The term "pipline" is used in many places, rename it to pipeline.Reyk Floeter
It was either a typo or a funny abbreviation. OK rzalamena@
2017-01-16Removed unused function that is a leftover from the old debug code.Reyk Floeter
OK rzalamena@
2017-01-12Don't write configuration request replies outside of the packetRafael Zalamena
boundaries. The config request message mbuf is always shorter than the config request reply message, so use m_copyback() to append the extra data.
2017-01-11Remove m_pullup() from packet-out since it is not doing anything anymoreRafael Zalamena
with the packet. swofp_input() already guarantees us that the whole data is contiguous in the mbuf.
2016-12-22Validate the OFP header to make sure it always have a sane size, alsoRafael Zalamena
make sure to not accept anything else outside of the header size boundaries. ok reyk@
2016-12-05Propagate error type in validation functions that callRafael Zalamena
swofp_validate_action(), because actions have a different class of errors. While there update the error type and error variables type to match the swofp_send_error() prototype.
2016-12-05Remove the flow id from the flow entry struct and the global variable,Rafael Zalamena
since they were not being used and the OpenFlow specification doesn't mention anything about them. ok reyk@
2016-12-05Add missing prototypes for all functions declared in the file.Rafael Zalamena
ok reyk@
2016-12-02Limit the amount of flows that can be installed on flow tables.Rafael Zalamena
2016-12-02Use the right variable for storing the maximum group table size and useRafael Zalamena
it to limit the amount of installable groups.
2016-12-02Fix flow-removed OFP header xid value: use htonl() instead of htons() forRafael Zalamena
32bit integers.
2016-11-30Fix another free() with wrong size panic when handling group-mod bucketsRafael Zalamena
size changes and add more sanity checks for group buckets payload.
2016-11-29Remove debugging code that was always enabled and printed parsedReyk Floeter
OpenFlow packets: the new DLT_OPENFLOW bpf methods allows to monitor the communication with a switch(4) device with tcpdump now. The remaining debugging messages aren't compiled without DEBUG now. On amd64, this shrinks the switchofp.o object by about 10k by default and about 8k with DEBUG enabled. OK rzalamena@
2016-11-28Implement more validations for switch(4) groups handling: check for invalidRafael Zalamena
group-mod message sizes and validate bucket sizes and actions lists. Discussed with reyk@: we should get this in as it is better to have some validation than having none at all.
2016-11-28Rename "flowmax" to "maxflow" and give each switch(4) ioctl aReyk Floeter
dedicated number. Both changes for consistency. OK rzalamena@
2016-11-21Simplify pad calculation for flow match on swofp_put_flow().Rafael Zalamena
ok reyk@
2016-11-21Include the OFP header of the message that caused the error on errorRafael Zalamena
messages. ok reyk@
2016-11-20Extend the DLT_OPENFLOW header to include the switch datapath id.Reyk Floeter
OK rzalamena@
2016-11-18Define a group_id map and rename the defines accordingly.Reyk Floeter
Requested by rzalamena@
2016-11-18Fix a panic introduced with the memory leak correction. Use the savedRafael Zalamena
length instead of the packet instruction length to free the old instruction. ok reyk@
2016-11-16Add new DLT_OPENFLOW link-type to allow using tcpdump to debug switch(4),Reyk Floeter
eg. tcpdump -y openflow -i switch0 Includes a minor bump for libpcap. Feedback and OK rzalamena@
2016-11-10Add support for partial writes in switchwrite so we can use multipleRafael Zalamena
write() to write one packet. With this we also get support for writing multiple ofp packets with a single write. ok mikeb@
2016-11-10Fix swofp_send_error mbuf handling so it doesn't leak mbufs and set theRafael Zalamena
proper mbuf header length. ok mikeb@
2016-11-07Add validation for input data that we use as switch configuration, like:Rafael Zalamena
OXM matchs, switch actions and switch instructions. With this validations we don't have to rely on having a flawless controller and then we don't need to restrict switch(4) usage with just switchd(8). ok reyk@
2016-11-07Remove duplicated call for splnet() inside the swofp_mp_recv_port_stats()Rafael Zalamena
and swofp_mp_recv_port_desc(). We already have splnet() before calling swofp_input(). ok reyk@
2016-11-07Change swofp_flow_entry_put_instructions() parameters to be like the otherRafael Zalamena
validations functions so it can returns errors with code 0. While here fix some minor details: memory leak on duplicated instructions, remove unused goto label, fix some whitespace/tab issues. ok reyk@
2016-11-03Fix debug message to print the presence of more flag correctly.Rafael Zalamena
ok mikeb@
2016-11-03Always call if_put() during the interface iteration on port status multipartRafael Zalamena
reply to avoid reference leaks. ok mikeb@
2016-10-31Improve ofp_error message accurateness: use parameterized error typeRafael Zalamena
instead of hardcoding it. With this we can change the error type to something else and get a more accurate description of what happened. ok reyk@
2016-10-31Change validation functions prototypes: use the parameter variable toRafael Zalamena
return the error code and the return value to signal if the validation was successful or not. With this we can signal some errors in the spec that uses the value 0 (zero). ok reyk@
2016-10-28The function swofp_flow_entry_put_instructions() doesn't need to receiveRafael Zalamena
a pointer to a mbuf pointer, because it only uses the mbuf for reading. ok reyk@
2016-10-28Change swofp_flow_table_add() malloc() behaviour to be non-blocking likeRafael Zalamena
all others that we can find in switch(4). ok reyk@