X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=lib%2Fbond.c;h=4d711c0346521bb2df33cdddd59ace18e6cb9c4b;hb=b4e1bf8b7ef8704d857a9ee93d40719289b2139e;hp=157e9889ed014a34119ed33b59414dd61d36e009;hpb=bc1b010c2b8bd17973287388da8c171332b70b3f;p=openvswitch diff --git a/lib/bond.c b/lib/bond.c index 157e9889..4d711c03 100644 --- a/lib/bond.c +++ b/lib/bond.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks. + * Copyright (c) 2008, 2009, 2010, 2011 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -488,7 +488,7 @@ static bool may_send_learning_packets(const struct bond *bond) { return bond->lacp_status == LACP_DISABLED - && bond->balance != BM_AB + && bond->balance != BM_STABLE && bond->active_slave; } @@ -531,8 +531,7 @@ bond_compose_learning_packet(struct bond *bond, slave = choose_output_slave(bond, &flow, vlan); packet = ofpbuf_new(0); - compose_benign_packet(packet, "Open vSwitch Bond Failover", 0xf177, - eth_src); + compose_rarp(packet, eth_src); if (vlan) { eth_push_vlan(packet, htons(vlan)); } @@ -941,7 +940,7 @@ bond_unixctl_list(struct unixctl_conn *conn, } ds_put_char(&ds, '\n'); } - unixctl_command_reply(conn, 200, ds_cstr(&ds)); + unixctl_command_reply(conn, ds_cstr(&ds)); ds_destroy(&ds); } @@ -1042,7 +1041,7 @@ bond_unixctl_show(struct unixctl_conn *conn, const struct bond *bond = bond_find(argv[1]); if (!bond) { - unixctl_command_reply(conn, 501, "no such bond"); + unixctl_command_reply_error(conn, "no such bond"); return; } bond_print_details(&ds, bond); @@ -1054,7 +1053,7 @@ bond_unixctl_show(struct unixctl_conn *conn, } } - unixctl_command_reply(conn, 200, ds_cstr(&ds)); + unixctl_command_reply(conn, ds_cstr(&ds)); ds_destroy(&ds); } @@ -1073,30 +1072,30 @@ bond_unixctl_migrate(struct unixctl_conn *conn, bond = bond_find(bond_s); if (!bond) { - unixctl_command_reply(conn, 501, "no such bond"); + unixctl_command_reply_error(conn, "no such bond"); return; } if (bond->balance != BM_SLB) { - unixctl_command_reply(conn, 501, "not an SLB bond"); + unixctl_command_reply_error(conn, "not an SLB bond"); return; } if (strspn(hash_s, "0123456789") == strlen(hash_s)) { hash = atoi(hash_s) & BOND_MASK; } else { - unixctl_command_reply(conn, 501, "bad hash"); + unixctl_command_reply_error(conn, "bad hash"); return; } slave = bond_lookup_slave(bond, slave_s); if (!slave) { - unixctl_command_reply(conn, 501, "no such slave"); + unixctl_command_reply_error(conn, "no such slave"); return; } if (!slave->enabled) { - unixctl_command_reply(conn, 501, "cannot migrate to disabled slave"); + unixctl_command_reply_error(conn, "cannot migrate to disabled slave"); return; } @@ -1104,7 +1103,7 @@ bond_unixctl_migrate(struct unixctl_conn *conn, tag_set_add(&bond->unixctl_tags, entry->tag); entry->slave = slave; entry->tag = tag_create_random(); - unixctl_command_reply(conn, 200, "migrated"); + unixctl_command_reply(conn, "migrated"); } static void @@ -1119,18 +1118,18 @@ bond_unixctl_set_active_slave(struct unixctl_conn *conn, bond = bond_find(bond_s); if (!bond) { - unixctl_command_reply(conn, 501, "no such bond"); + unixctl_command_reply_error(conn, "no such bond"); return; } slave = bond_lookup_slave(bond, slave_s); if (!slave) { - unixctl_command_reply(conn, 501, "no such slave"); + unixctl_command_reply_error(conn, "no such slave"); return; } if (!slave->enabled) { - unixctl_command_reply(conn, 501, "cannot make disabled slave active"); + unixctl_command_reply_error(conn, "cannot make disabled slave active"); return; } @@ -1141,9 +1140,9 @@ bond_unixctl_set_active_slave(struct unixctl_conn *conn, VLOG_INFO("bond %s: active interface is now %s", bond->name, slave->name); bond->send_learning_packets = true; - unixctl_command_reply(conn, 200, "done"); + unixctl_command_reply(conn, "done"); } else { - unixctl_command_reply(conn, 200, "no change"); + unixctl_command_reply(conn, "no change"); } } @@ -1157,18 +1156,18 @@ enable_slave(struct unixctl_conn *conn, const char *argv[], bool enable) bond = bond_find(bond_s); if (!bond) { - unixctl_command_reply(conn, 501, "no such bond"); + unixctl_command_reply_error(conn, "no such bond"); return; } slave = bond_lookup_slave(bond, slave_s); if (!slave) { - unixctl_command_reply(conn, 501, "no such slave"); + unixctl_command_reply_error(conn, "no such slave"); return; } bond_enable_slave(slave, enable, &bond->unixctl_tags); - unixctl_command_reply(conn, 501, enable ? "enabled" : "disabled"); + unixctl_command_reply(conn, enable ? "enabled" : "disabled"); } static void @@ -1202,7 +1201,7 @@ bond_unixctl_hash(struct unixctl_conn *conn, int argc, const char *argv[], if (vlan_s) { if (sscanf(vlan_s, "%u", &vlan) != 1) { - unixctl_command_reply(conn, 501, "invalid vlan"); + unixctl_command_reply_error(conn, "invalid vlan"); return; } } else { @@ -1211,7 +1210,7 @@ bond_unixctl_hash(struct unixctl_conn *conn, int argc, const char *argv[], if (basis_s) { if (sscanf(basis_s, "%"PRIu32, &basis) != 1) { - unixctl_command_reply(conn, 501, "invalid basis"); + unixctl_command_reply_error(conn, "invalid basis"); return; } } else { @@ -1223,10 +1222,10 @@ bond_unixctl_hash(struct unixctl_conn *conn, int argc, const char *argv[], hash = bond_hash_src(mac, vlan, basis) & BOND_MASK; hash_cstr = xasprintf("%u", hash); - unixctl_command_reply(conn, 200, hash_cstr); + unixctl_command_reply(conn, hash_cstr); free(hash_cstr); } else { - unixctl_command_reply(conn, 501, "invalid mac"); + unixctl_command_reply_error(conn, "invalid mac"); } }