Comments (4)
Hello Ben,
You are correct, that's exactly what will happen.
Note, however, the table check_tll that is applied after the table
ipv4_match. The control plane can create an entry there that will match on
the headers.ip.ttl==255 and choose the Drop_action and that's how I think a
reasonable control plane will initialize the table (in addition to that I'd
also add an entry to drop a packet when headers.ip.ttl==0).
It is precisely why I'd really like to add table initializers to the
language.
The other point I want to make is that this is an example code and thus it
is missing a whole bunch of other checks that the "real" data plane
programs would typically perform and this is simply done for the clarity of
the example.
Happy hacking,
Vladimir
On Mon, Aug 15, 2016 at 8:02 PM, Ben Pfaff [email protected] wrote:
It appears to me that the simple switch will happily decrement TTL 0 to
become TTL 255. This seems like surprising behavior to me, even in such a
simple implementation.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#33, or mute the thread
https://github.com/notifications/unsubscribe-auth/AMPb8_88V8FZGuavDktwgbUPcBoZu0Cmks5qgShbgaJpZM4Jk_NT
.
from p4-spec.
Note, however, the table check_tll that is applied after the table ipv4_match. The control plane can create an entry there that will match on the headers.ip.ttl==255 ....
I don't see how: at least in my copy here the ipv4_match table only has a single key field, which is for the IP destination address. If the intent is for this table to match on TTL then it should be declared as a key field; I'm happy to pivot this bug report toward fixing that if you think it's the actual bug.
From my point of view it would be cleaner to combine TTL decrement and check in a single table, but of course that's a debatble matter of opinion.
The other point I want to make is that this is an example code and thus it is missing a whole bunch of other checks that the "real" data plane programs would typically perform and this is simply done for the clarity of the example.
Well, yes, of course, but I would have expected that the bits that are implemented are done with some level of care.
from p4-spec.
Hi Ben,
On Tue, Aug 16, 2016 at 11:49 AM, Ben Pfaff [email protected]
wrote:
Note, however, the table check_tll that is applied after the table
ipv4_match. The control plane can create an entry there that will match on
the headers.ip.ttl==255 ....I don't see how: at least in my copy here the ipv4_match table only has a
single key field, which is for the IP destination address. If the intent is
for this table to match on TTL then it should be declared as a key field;
I'm happy to pivot this bug report toward fixing that if you think it's the
actual bug.
Here is the code excerpt from the doc (page 22). I highlighted the
appropriate place. If you check the definition of the table check_ttl
you'll see that it matches on the exact value of header.ip.ttl:
*apply* {
Ipv4Address nextHop; // temporary variable
*if* (parseError != NoError) {
Drop_action(); // invoke drop directly
*return*;
}
ipv4_match.apply(nextHop); // Match result will go into nextHop
*if* (outCtrl.outputPort == DROP_PORT) *return*;
check_ttl.apply();
*if* (outCtrl.outputPort == CPU_PORT) *return*;
dmac.apply(nextHop);
*if* (outCtrl.outputPort == DROP_PORT) *return*;
smac.apply();
}
From my point of view it would be cleaner to combine TTL decrement and
check in a single table, but of course that's a debatble matter of opinion.
Usually this is done separately. As per RFC1812 you might need to apply
different rules, based on whether the packet is destined to the local CPU
(in this case you typically would not decrement the TTL and accept all
values, including TTL=0) or not (and in that case you would probably drop
packets with both TTL=0 and TTL=1).
Happy hacking,
Vladimir
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#33 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AMPb8zs4GFmMaRDVby09a81RQOTIqZOCks5qggYvgaJpZM4Jk_NT
.
from p4-spec.
If you check the definition of the table check_ttl you'll see that it matches on the exact value of header.ip.ttl:
Oh, in check_ttl. I misread your comment as saying that ipv4_match could match on ttl.
OK, fine, leave it.
from p4-spec.
Related Issues (20)
- Where should a `@hidden` annotation on an action be placed? HOT 3
- Clarification regarding Exit statement HOT 19
- L-Value Syntax HOT 3
- Clarification on the calling convention of directionless, extern parameter HOT 4
- Subtlety between length and size. HOT 3
- Missing code-block markup in section "Static assertions" HOT 1
- Allow compile-time resolvable expressions for switch labels? HOT 5
- Incomplete list of operators in compile-time known values section? HOT 1
- Modular match fields for tables. HOT 20
- The type nesting and typedef rules are not clear HOT 5
- Investigate whether PDF/HTML generated for all versions are in git repo history HOT 2
- Should identifiers declared with const be a local compile-time known value if their init expression is? HOT 9
- Should run-time variables that a sophisticated compiler can prove must be equal to a compile-time known value, be treated as a compile-time known value? HOT 2
- Document restriction that numeric priorities may not be specified within `const entries`
- Do we allow `string` type to be aliased by `typedef`? HOT 1
- Misleading code example for 8.24. Operations on types that are type variables HOT 1
- Allow compile-time concatenation of strings HOT 1
- Consider AsciiDoc for future format of source for P4 language specification HOT 9
- CI: Create a CI job that builds the spec PDF and HTML for a PR HOT 3
- Useful to create different bit slice variant that makes bit width easier to determine if it is compile time known? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from p4-spec.