Skip to content

Commit

Permalink
Open different socket to enable interface filtering for dual tor scen…
Browse files Browse the repository at this point in the history
…ario (#10)
  • Loading branch information
kellyyeh authored Sep 19, 2022
1 parent b6bce8b commit 9c3b738
Show file tree
Hide file tree
Showing 5 changed files with 264 additions and 94 deletions.
3 changes: 2 additions & 1 deletion src/configInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ void processRelayNotification(std::deque<swss::KeyOpFieldsValuesTuple> &entries,
intf.is_option_79 = true;
intf.is_interface_id = false;
intf.interface = vlan;
intf.db = nullptr;
intf.mux_key = "";
intf.state_db = nullptr;
for (auto &fieldValue: fieldValues) {
std::string f = fvField(fieldValue);
std::string v = fvValue(fieldValue);
Expand Down
2 changes: 1 addition & 1 deletion src/configInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void handleSwssNotification(std::vector<relay_config> *vlans);
*
* @return none
*/
void handleRelayNotification(swss::SubscriberStateTable &configMuxTable, std::vector<relay_config> *vlans);
void handleRelayNotification(swss::SubscriberStateTable &ipHelpersTable, std::vector<relay_config> *vlans);

/**
* @code void processRelayNotification(std::deque<swss::KeyOpFieldsValuesTuple> &entries, std::vector<relay_config> *vlans)
Expand Down
22 changes: 20 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,30 @@
#include <syslog.h>
#include "configInterface.h"

bool dual_tor_sock = false;

static void usage()
{
printf("Usage: ./dhcp6relay {-d}\n");
printf("\t-d: enable dual tor option\n");
}

int main(int argc, char *argv[]) {
if (argc > 1) {
switch (argv[1][1])
{
case 'd':
dual_tor_sock = true;
break;
default:
fprintf(stderr, "%s: Unknown option\n", basename(argv[0]));
usage();
}
}
try {
std::vector<relay_config> vlans;
swss::DBConnector state_db("STATE_DB", 0);
initialize_swss(&vlans);
loop_relay(&vlans, &state_db);
loop_relay(&vlans);
}
catch (std::exception &e)
{
Expand Down
Loading

0 comments on commit 9c3b738

Please sign in to comment.