.uid_range.start = UID_INVALID,
.uid_range.end = UID_INVALID,
.suppress_prefixlen = -1,
+ .protocol = RTPROT_UNSPEC,
.type = FR_ACT_TO_TBL,
};
rule->network = network;
rule->section = TAKE_PTR(n);
+ rule->protocol = RTPROT_STATIC;
r = hashmap_ensure_allocated(&network->rules_by_section, &network_config_hash_ops);
if (r < 0)
dest->table = src->table;
dest->iif = TAKE_PTR(iif);
dest->oif = TAKE_PTR(oif);
+ dest->ipproto = src->ipproto;
dest->protocol = src->protocol;
dest->sport = src->sport;
dest->dport = src->dport;
siphash24_compress(&rule->table, sizeof(rule->table), state);
siphash24_compress(&rule->suppress_prefixlen, sizeof(rule->suppress_prefixlen), state);
+ siphash24_compress(&rule->ipproto, sizeof(rule->ipproto), state);
siphash24_compress(&rule->protocol, sizeof(rule->protocol), state);
siphash24_compress(&rule->sport, sizeof(rule->sport), state);
siphash24_compress(&rule->dport, sizeof(rule->dport), state);
if (r != 0)
return r;
+ r = CMP(a->ipproto, b->ipproto);
+ if (r != 0)
+ return r;
+
r = CMP(a->protocol, b->protocol);
if (r != 0)
return r;
return log_link_error_errno(link, r, "Could not append FRA_OIFNAME attribute: %m");
}
- r = sd_netlink_message_append_u8(m, FRA_IP_PROTO, rule->protocol);
+ r = sd_netlink_message_append_u8(m, FRA_IP_PROTO, rule->ipproto);
if (r < 0)
return log_link_error_errno(link, r, "Could not append FRA_IP_PROTO attribute: %m");
+ r = sd_netlink_message_append_u8(m, FRA_PROTOCOL, rule->protocol);
+ if (r < 0)
+ return log_link_error_errno(link, r, "Could not append FRA_PROTOCOL attribute: %m");
+
if (rule->sport.start != 0 || rule->sport.end != 0) {
r = sd_netlink_message_append_data(m, FRA_SPORT_RANGE, &rule->sport, sizeof(rule->sport));
if (r < 0)
if (r < 0)
return log_oom();
- r = sd_netlink_message_read_u8(message, FRA_IP_PROTO, &tmp->protocol);
+ r = sd_netlink_message_read_u8(message, FRA_IP_PROTO, &tmp->ipproto);
if (r < 0 && r != -ENODATA) {
log_warning_errno(r, "rtnl: could not get FRA_IP_PROTO attribute, ignoring: %m");
return 0;
}
+ r = sd_netlink_message_read_u8(message, FRA_PROTOCOL, &tmp->protocol);
+ if (r < 0 && r != -ENODATA) {
+ log_warning_errno(r, "rtnl: could not get FRA_PROTOCOL attribute, ignoring: %m");
+ return 0;
+ }
+
r = sd_netlink_message_read(message, FRA_SPORT_RANGE, sizeof(tmp->sport), &tmp->sport);
if (r < 0 && r != -ENODATA) {
log_warning_errno(r, "rtnl: could not get FRA_SPORT_RANGE attribute, ignoring: %m");
return 0;
}
- n->protocol = r;
+ n->ipproto = r;
n = NULL;
space = true;
}
- if (rule->protocol != 0) {
- fprintf(f, "%sprotocol=%hhu",
+ if (rule->ipproto != 0) {
+ fprintf(f, "%sipproto=%hhu",
space ? " " : "",
- rule->protocol);
+ rule->ipproto);
space = true;
}
if (free_and_strdup(&rule->oif, b) < 0)
return log_oom();
- } else if (streq(a, "protocol")) {
- r = safe_atou8(b, &rule->protocol);
+ } else if (streq(a, "ipproto")) {
+ r = safe_atou8(b, &rule->ipproto);
if (r < 0) {
- log_warning_errno(r, "Failed to parse RPDB rule protocol, ignoring: %s", b);
+ log_warning_errno(r, "Failed to parse RPDB rule IP protocol, ignoring: %s", b);
continue;
}
} else if (streq(a, "sourceport")) {