MCPcopy Create free account
hub / github.com/NetSys/bess / CommandDelete

Method CommandDelete

core/modules/l2_forward.cc:640–667  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

638}
639
640CommandResponse L2Forward::CommandDelete(
641 const bess::pb::L2ForwardCommandDeleteArg &arg) {
642 for (int i = 0; i < arg.addrs_size(); i++) {
643 const auto &_addr = arg.addrs(i);
644
645 if (!_addr.length()) {
646 return CommandFailure(EINVAL, "lookup must be list of string");
647 }
648
649 const char *str_addr = _addr.c_str();
650 char addr[6];
651
652 if (parse_mac_addr(str_addr, addr) != 0) {
653 return CommandFailure(EINVAL, "%s is not a proper mac address", str_addr);
654 }
655
656 int r = l2_del_entry(&l2_table_, l2_addr_to_u64(addr));
657
658 if (r == -ENOENT) {
659 return CommandFailure(ENOENT, "MAC address '%s' does not exist",
660 str_addr);
661 } else if (r != 0) {
662 return CommandFailure(EINVAL, "Unknown Error: %d\n", r);
663 }
664 }
665
666 return CommandSuccess();
667}
668
669CommandResponse L2Forward::CommandSetDefaultGate(
670 const bess::pb::L2ForwardCommandSetDefaultGateArg &arg) {

Callers

nothing calls this directly

Calls 5

CommandFailureFunction · 0.85
parse_mac_addrFunction · 0.85
l2_del_entryFunction · 0.85
l2_addr_to_u64Function · 0.85
CommandSuccessFunction · 0.85

Tested by

no test coverage detected