diff options
author | ZhengLingyun <konghuarukhr@163.com> | 2013-10-08 23:52:40 +0800 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2013-10-08 10:06:40 -0700 |
commit | b0fbc664fe9bb9704aa8d1cd0d6cd3eb17f80635 (patch) | |
tree | 7ce2bd82fb6c4d67b2ff7ed35565b5e39309f01c | |
parent | b270a7b57c9a02cc9d37f2a46e74d3df6bd5624f (diff) | |
download | openvswitch-b0fbc664fe9bb9704aa8d1cd0d6cd3eb17f80635.tar.gz |
ovs-controller: Avoid dereferencing NULL pointer when the switch acts as a hub
Starting ovs-controller with '-H' option will lead to a segment fault problem.
Add a check, and adjust the indentation of the following code.
Signed-off-by: ZhengLingyun <konghuarukhr@163.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
-rw-r--r-- | lib/learning-switch.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/learning-switch.c b/lib/learning-switch.c index 4a95dc1b8..f4c79c244 100644 --- a/lib/learning-switch.c +++ b/lib/learning-switch.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc. + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -472,7 +472,7 @@ lswitch_choose_destination(struct lswitch *sw, const struct flow *flow) uint16_t out_port; /* Learn the source MAC. */ - if (mac_learning_may_learn(sw->ml, flow->dl_src, 0)) { + if (sw->ml && mac_learning_may_learn(sw->ml, flow->dl_src, 0)) { struct mac_entry *mac = mac_learning_insert(sw->ml, flow->dl_src, 0); if (mac_entry_is_new(mac) || mac->port.i != flow->in_port) { VLOG_DBG_RL(&rl, "%016llx: learned that "ETH_ADDR_FMT" is on " |