- int error;
- struct in_addr in_addr;
- struct shash_node *node;
- struct gre_config config;
-
- memset(&config, 0, sizeof config);
- config.in_csum = true;
- config.out_csum = true;
-
- SHASH_FOR_EACH (node, args) {
- if (!strcmp(node->name, "remote_ip")) {
- if (lookup_ip(node->data, &in_addr)) {
- VLOG_WARN("bad 'remote_ip' for gre device %s ", name);
- } else {
- config.remote_ip = in_addr.s_addr;
- }
- } else if (!strcmp(node->name, "local_ip")) {
- if (lookup_ip(node->data, &in_addr)) {
- VLOG_WARN("bad 'local_ip' for gre device %s ", name);
- } else {
- config.local_ip = in_addr.s_addr;
- }
- } else if (!strcmp(node->name, "key")) {
- config.have_in_key = true;
- config.have_out_key = true;
- config.in_key = htonl(atoi(node->data));
- config.out_key = htonl(atoi(node->data));
- } else if (!strcmp(node->name, "in_key")) {
- config.have_in_key = true;
- config.in_key = htonl(atoi(node->data));
- } else if (!strcmp(node->name, "out_key")) {
- config.have_out_key = true;
- config.out_key = htonl(atoi(node->data));
- } else if (!strcmp(node->name, "csum")) {
- if (!strcmp(node->data, "false")) {
- config.in_csum = false;
- config.out_csum = false;
- }
- } else {
- VLOG_WARN("unknown gre argument '%s'", node->name);
- }
- }