Hi all,
Question:
I want to mod a flow through openflowplugin:
```
# ovs-ofctl add-flow test-br "table=50,
priority=322,udp,nw_src=0.0.0.0/0,nw_dst=1.1.1.1,tp_dst=8000 actions=drop"
```
And there are a ERROR log:
OFP log:
```
2019-10-08T18:59:31,924 | ERROR | acl-handler-12 |
AbstractKafkaConsumerHandler | 47 - com.netease.nie.ndk.kafka - 1.0.1 |
throwable:
com.netease.nie.nvc.utils.exception.SalServiceHandleException: salService
handle error - Device reported error type BADMATCH code BADLEN
```
OVS log:
```
2019-10-08T10:59:31.921Z|00425|connmgr|INFO|br-vpc-2<->tcp:10.248.34.143:6633:
sending OFPBMC_BAD_LEN error reply to OFPT_FLOW_MOD message
```
Source Code Debug:
I debug the source code. In Ipv4SourceEntrySerializer.java:
When source is 0.0.0.0/0??OFP will serialized OXM header with hasmask=1 and
length double.
```java
@Override
protected boolean getHasMask(Match match) {
if (isPrefix(match)) {
// Split address to IP and mask
final Iterator<String> addressParts = IpConversionUtil.splitToParts(
Ipv4Match.class.cast(match.getLayer3Match()).getIpv4Source());
addressParts.next();
// HERE : will return true
// Check if we have mask
return addressParts.hasNext() &&
Integer.parseInt(addressParts.next()) < 32;
} else if (isArbitrary(match)) {
return
Objects.nonNull(Ipv4MatchArbitraryBitMask.class.cast(match.getLayer3Match())
.getIpv4SourceArbitraryBitmask());
}
return false;
}
```
And when serialize OXM body, won't write mask value in outBuffer.
```
/**
* Serialize Ipv4 prefix (address and mask).
*
* @param prefix Ipv4 prefix
* @param outBuffer output buffer
*/
protected static void writeIpv4Prefix(final Ipv4Prefix prefix, final
ByteBuf outBuffer) {
// Split address to IP and mask
final Iterator<String> addressParts =
IpConversionUtil.splitToParts(prefix);
// Write address part of prefix
writeIpv4Address(new Ipv4Address(addressParts.next()), outBuffer);
// HERE, MatchConvertorUtil.extractIpv4Mask return null, and then won't
write mask value in outBuffer.
// If prefix had mask, also write prefix
Optional.ofNullable(MatchConvertorUtil.extractIpv4Mask(addressParts)).ifPresent(mask
->
writeMask(mask, outBuffer,
EncodeConstants.GROUPS_IN_IPV4_ADDRESS));
}
public static byte[] extractIpv4Mask(final Iterator<String> addressParts) {
final int prefix;
if (addressParts.hasNext()) {
int potentionalPrefix = Integer.parseInt(addressParts.next());
prefix = potentionalPrefix < 32 ? potentionalPrefix : 0;
} else {
prefix = 0;
}
if (prefix != 0) {
// clone() is necessary to protect our constants
return IPV4_MASKS[prefix].clone();
}
// HERE return null!
return null;
}
```
So this is a feature or a bug?
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#8757):
https://lists.opendaylight.org/g/openflowplugin-dev/message/8757
Mute This Topic: https://lists.opendaylight.org/mt/34441403/21656
Group Owner: openflowplugin-dev+ow...@lists.opendaylight.org
Unsubscribe: https://lists.opendaylight.org/g/openflowplugin-dev/unsub
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-