Abstract
Programming languages like P4 enable specifying the behavior of network data planes in software. However, with increasingly powerful and complex applications running in the network, the risk of faults also increases. Hence, there is growing recognition of the need for methods and tools to statically verify the correctness of P4 code, especially as the language lacks basic safety guarantees. Type systems are a lightweight and compositional way to establish program properties, but there is a significant gap between the kinds of properties that can be proved using simple type systems (e.g., SafeP4) and those that can be obtained using full-blown verification tools (e.g., p4v). In this paper, we close this gap by developing Π4, a dependently-typed version of P4 based on decidable refinements. We motivate the design of Π4, prove the soundness of its type system, develop an SMT-based implementation, and present case studies that illustrate its applicability to a variety of data plane programs.
Supplemental Material
- M. Baldi. 2019. daPIPE a Data Plane Incremental Programming Environment. In Symposium on Architectures for Networking and Communications Systems (ANCS). 1–6. https://doi.org/10.1109/ANCS.2019.8901893 Google Scholar
Cross Ref
- Ryan Beckett and Ratul Mahajan. 2020. A General Framework for Compositional Network Modeling. In Workshop on Hot Topics in Networks (HotNets). 8–15. https://doi.org/10.1145/3422604.3425930 Google Scholar
Digital Library
- Edoardo Biagioni, Robert Harper, Peter Lee, and Brian G. Milnes. 1994. Signatures for a Network Protocol Stack: A Systems Application of Standard ML. In Conference on LISP and Functional Programming (LFP). 55–64. https://doi.org/10.1145/182409.182431 Google Scholar
Digital Library
- Pat Bosshart, Dan Daly, Glen Gibb, Martin Izzard, Nick McKeown, Jennifer Rexford, Cole Schlesinger, Dan Talayco, Amin Vahdat, George Varghese, and David Walker. 2014. P4: Programming Protocol-Independent Packet Processors. SIGCOMM Computer Communications Review (CCR), July, 87–95. https://doi.org/10.1145/2656877.2656890 Google Scholar
Digital Library
- Pat Bosshart, Glen Gibb, Hun-Seok Kim, George Varghese, Nick McKeown, Martin Izzard, Fernando Mujica, and Mark Horowitz. 2013. Forwarding Metamorphosis: Fast Programmable Match-Action Processing in Hardware for SDN. In Conference of the Special Interest Group on Data Communication on the Applications, Technologies, Architectures, and Protocols for Computer Communication (SIGCOMM). 99–110. https://doi.org/10.1145/2486001.2486011 Google Scholar
Digital Library
- Janusz A. Brzozowski. 1964. Derivatives of Regular Expressions. J. ACM, 11, 4 (1964), Oct., 481–494. issn:0004-5411 https://doi.org/10.1145/321239.321249 Google Scholar
Digital Library
- Giuseppe Castagna, Kim Nguyen, Zhiwu Xu, Hyeonseung Im, Sergueï Lenglet, and Luca Padovani. 2014. Polymorphic Functions with Set-Theoretic Types: Part 1: Syntax, Semantics, and Evaluation. In Symposium on Principles of Programming Languages (POPL). 5–17. https://doi.org/10.1145/2535838.2535840 Google Scholar
Digital Library
- Cisco. 2018. Cisco Nexus 3000 Series Switches. https://www.cisco.com/c/en/us/products/switches/nexus-3000-series-switches/index.htmlGoogle Scholar
- Jeremy Condit, Matthew Harren, Zachary Anderson, David Gay, and George C. Necula. 2007. Dependent Types for Low-Level Programming. In European Symposium on Programming (ESOP). 520–535. https://doi.org/10.1007/978-3-540-71316-6_35 Google Scholar
Cross Ref
- Benjamin Delaware, Sorawit Suriyakarn, Clément Pit-Claudel, Qianchuan Ye, and Adam Chlipala. 2019. Narcissus: Correct-by-Construction Derivation of Decoders and Encoders from Binary Formats. Proceedings of the ACM Programming Languages (PACMPL), 3, ICFP (2019), Article 82, July, https://doi.org/10.1145/3341686 Google Scholar
Digital Library
- Ryan Doenges, Mina Tahmasbi Arashloo, Santiago Bautista, Alexander Chang, Newton Ni, Samwise Parkinson, Rudy Peterson, Alaia Solko-Breslin, Amanda Xu, and Nate Foster. 2021. Petr4: Formal Foundations for P4 Data Planes. Proceedings of the ACM on Programming Languages (PACMPL), 5, POPL (2021), Article 41, Jan., https://doi.org/10.1145/3434322 Google Scholar
Digital Library
- Dragos Dumitrescu, Radu Stoenescu, Lorina Negreanu, and Costin Raiciu. 2020. Bf4: Towards Bug-Free P4 Programs. In Conference of the Special Interest Group on Data Communication on the Applications, Technologies, Architectures, and Protocols for Computer Communication (SIGCOMM). 571–585. isbn:9781450379557 https://doi.org/10.1145/3387514.3405888 Google Scholar
Digital Library
- Matthias Eichholz, Eric Campbell, Nate Foster, Guido Salvaneschi, and Mira Mezini. 2019. How to Avoid Making a Billion-Dollar Mistake: Type-Safe Data Plane Programming with SafeP4. In European Conference on Object-Oriented Programming (ECOOP). 12:1–12:28. https://doi.org/10.4230/LIPIcs.ECOOP.2019.12 Google Scholar
Cross Ref
- Robert Ennals, Richard Sharp, and Alan Mycroft. 2004. Linear Types for Packet Processing. In European Symposium on Programming (ESOP). 204–218. https://doi.org/10.1007/978-3-540-24725-8_15 Google Scholar
Cross Ref
- Kathleen Fisher and Robert Gruber. 2005. PADS: A Domain-Specific Language for Processing Ad Hoc Data. In Conference on Programming Language Design and Implementation (PLDI). 295–304. https://doi.org/10.1145/1065010.1065046 Google Scholar
Digital Library
- Lucas Freire, Miguel Neves, Lucas Leal, Kirill Levchenko, Alberto Schaeffer-Filho, and Marinho Barcellos. 2018. Uncovering Bugs in P4 Programs with Assertion-Based Verification. In Symposium on SDN Research (SOSR). Article 4, 7 pages. https://doi.org/10.1145/3185467.3185499 Google Scholar
Digital Library
- Jiaqi Gao, Ennan Zhai, Hongqiang Harry Liu, Rui Miao, Yu Zhou, Bingchuan Tian, Chen Sun, Dennis Cai, Ming Zhang, and Minlan Yu. 2020. Lyra: A Cross-Platform Language and Compiler for Data Plane Programming on Heterogeneous ASICs. In Conference of the Special Interest Group on Data Communication on the Applications, Technologies, Architectures, and Protocols for Computer Communication (SIGCOMM). 435–450. isbn:9781450379557 https://doi.org/10.1145/3387514.3405879 Google Scholar
Digital Library
- Vladimir Gapeyev and Benjamin C. Pierce. 2003. Regular Object Types. In European Conference on Object-Oriented Programming (ECOOP). 151–175. https://doi.org/10.1007/978-3-540-45070-2_8 Google Scholar
Cross Ref
- Patrice Godefroid, Nils Klarlund, and Koushik Sen. 2005. DART: Directed automated random testing. In Conference on Programming Language Design and Implementation (PLDI). 213–223. https://doi.org/10.1145/1065010.1065036 Google Scholar
Digital Library
- Toke Høiland-Jørgensen, Jesper Dangaard Brouer, Daniel Borkmann, John Fastabend, Tom Herbert, David Ahern, and David Miller. 2018. The EXpress Data Path: Fast Programmable Packet Processing in the Operating System Kernel. In International Conference on Emerging Networking EXperiments and Technologies (CoNEXT). 54–66. https://doi.org/10.1145/3281411.3281443 Google Scholar
Digital Library
- Haruo Hosoya and Benjamin C. Pierce. 2003. XDuce: A Statically Typed XML Processing Language. ACM Transactions on Internet Technology (TOIT), 3, 2 (2003), May, 117–148. https://doi.org/10.1145/767193.767195 Google Scholar
Digital Library
- Stephen Ibanez, Gordon Brebner, Nick McKeown, and Noa Zilberman. 2019. The P4->NetFPGA Workflow for Line-Rate Packet Processing. In Symposium on Field-Programmable Gate Arrays (FPGA). 1–9. https://doi.org/10.1145/3289602.3293924 Google Scholar
Digital Library
- Trevor Jim, Yitzhak Mandelbaum, and David Walker. 2010. Semantics and Algorithms for Data-Dependent Grammars. In Symposium on Principles of Programming Languages (POPL). 417–430. https://doi.org/10.1145/1706299.1706347 Google Scholar
Digital Library
- Xin Jin, Xiaozhou Li, Haoyu Zhang, Robert Soulé, Jeongkeun Lee, Nate Foster, Changhoon Kim, and Ion Stoica. 2017. NetCache: Balancing Key-Value Stores with Fast In-Network Caching. In Symposium on Operating Systems Principles (SOSP). 121–136. https://doi.org/10.1145/3132747.3132764 Google Scholar
Digital Library
- Jed Liu, William Hallahan, Cole Schlesinger, Milad Sharif, Jeongkeun Lee, Robert Soulé, Han Wang, Călin Caşcaval, Nick McKeown, and Nate Foster. 2018. p4v: Practical Verification for Programmable Data Planes. In Conference of the Special Interest Group on Data Communication on the Applications, Technologies, Architectures, and Protocols for Computer Communication (SIGCOMM). 490–503. https://doi.org/10.1145/3230543.3230582 Google Scholar
Digital Library
- Conor McBride. 2001. The derivative of a regular type is its type of one-hole contexts. Extended abstract, available at http://strictlypositive.org/diff.pdfGoogle Scholar
- Peter J. McCann and Satish Chandra. 2000. Packet Types: Abstract Specification of Network Protocol Messages. In Conference of the Special Interest Group on Data Communication on the Applications, Technologies, Architectures, and Protocols for Computer Communication (SIGCOMM). 321–333. https://doi.org/10.1145/347059.347563 Google Scholar
Digital Library
- Chitra Muthukrishnan, Vern Paxson, Mark Allman, and Aditya Akella. 2010. Using Strongly Typed Networking to Architect for Tussle. In Workshop on Hot Topics in Networks (HotNets). Article 9, 6 pages. https://doi.org/10.1145/1868447.1868456 Google Scholar
Digital Library
- Aleksandar Nanevski, Ruy Ley-Wild, Ilya Sergey, and Germán Andrés Delbianco. 2014. Communicating State Transition Systems for Fine-Grained Concurrent Resources. In European Symposium on Programming (ESOP). 290–310. https://doi.org/10.1007/978-3-642-54833-8_16 Google Scholar
Digital Library
- Aleksandar Nanevski, Greg Morrisett, and Lars Birkedal. 2006. Polymorphism and Separation in Hoare Type Theory. In International Conference on Functional Programming (ICFP). 62–73. isbn:1595933093 https://doi.org/10.1145/1159803.1159812 Google Scholar
Digital Library
- Aleksandar Nanevski, Greg Morrisett, Avraham Shinnar, Paul Govereau, and Lars Birkedal. 2008. Ynot: Dependent Types for Imperative Programs. In International Conference on Functional Programming (ICFP. 229–240. https://doi.org/10.1145/1411204.1411237 Google Scholar
Digital Library
- Tahina Ramananandro, Antoine Delignat-Lavaud, Cedric Fournet, Nikhil Swamy, Tej Chajed, Nadim Kobeissi, and Jonathan Protzenko. 2019. EverParse: Verified Secure Zero-Copy Parsers for Authenticated Message Formats. In USENIX Security Symposium (USENIX Security). 1465–1482. isbn:978-1-939133-06-9 https://www.usenix.org/conference/usenixsecurity19/presentation/delignat-lavaudGoogle Scholar
- Patrick M. Rondon, Ming Kawaguci, and Ranjit Jhala. 2008. Liquid Types. In Conference on Programming Language Design and Implementation (PLDI). 159–169. https://doi.org/10.1145/1375581.1375602 Google Scholar
Digital Library
- Hardik Soni, Myriana Rifai, Praveen Kumar, Ryan Doenges, and Nate Foster. 2020. Composing Dataplane Programs with μ P4. In Conference of the Special Interest Group on Data Communication on the Applications, Technologies, Architectures, and Protocols for Computer Communication (SIGCOMM). 329–343. https://doi.org/10.1145/3387514.3405872 Google Scholar
Digital Library
- Radu Stoenescu, Dragos Dumitrescu, Matei Popovici, Lorina Negreanu, and Costin Raiciu. 2018. Debugging P4 Programs with Vera. In Conference of the Special Interest Group on Data Communication on the Applications, Technologies, Architectures, and Protocols for Computer Communication (SIGCOMM). 518–532. https://doi.org/10.1145/3230543.3230548 Google Scholar
Digital Library
- Nikhil Swamy, Cătălin Hriţcu, Chantal Keller, Aseem Rastogi, Antoine Delignat-Lavaud, Simon Forest, Karthikeyan Bhargavan, Cédric Fournet, Pierre-Yves Strub, Markulf Kohlweiss, Jean-Karim Zinzindohoue, and Santiago Zanella-Béguelin. 2016. Dependent Types and Multi-Monadic Effects in F*. In Symposium on Principles of Programming Languages (POPL). 256–270. https://doi.org/10.1145/2837614.2837655 Google Scholar
Digital Library
- Sam Tobin-Hochstadt and Matthias Felleisen. 2010. Logical Types for Untyped Languages. In International Conference on Functional Programming (ICFP). 117–128. isbn:978-1-60558-794-3 https://doi.org/10.1145/1863543.1863561 Google Scholar
Digital Library
- Niki Vazou, Eric L. Seidel, Ranjit Jhala, Dimitrios Vytiniotis, and Simon Peyton-Jones. 2014. Refinement Types for Haskell. In International Conference on Functional Programming (ICFP). 269–282. https://doi.org/10.1145/2628136.2628161 Google Scholar
Digital Library
- Niki Vazou, Éric Tanter, and David Van Horn. 2018. Gradual Liquid Type Inference. Proceedings of the ACM on Programming Languages (PACMPL), 2, OOPSLA (2018), Article 132, Oct., 25 pages. https://doi.org/10.1145/3276502 Google Scholar
Digital Library
- Han Wang, Robert Soulé, Huynh Tu Dang, Ki-Suh Lee, Vishal Shrivastav, Nate Foster, and Hakim Weatherspoon. 2017. P4FPGA: A Rapid Prototyping Framework for P4. In Symposium on SDN Research (SOSR). 122–135. https://doi.org/10.1145/3050220.3050234 Google Scholar
Digital Library
- Hongwei Xi. 2000. Imperative programming with dependent types. In Symposium on Logic in Computer Science (LICS). 375–387. https://doi.org/10.1109/LICS.2000.855785 Google Scholar
Cross Ref
- Hongwei Xi and Robert Harper. 2001. A Dependently Typed Assembly Language. In International Conference on Functional Programming (ICFP). 169–180. https://doi.org/10.1145/507635.507657 Google Scholar
Digital Library
- Hongwei Xi and Frank Pfenning. 1999. Dependent Types in Practical Programming. In Symposium on Principles of Programming Languages (POPL). 214–227. isbn:1581130953Google Scholar
Index Terms
Dependently-typed data plane programming
Recommendations
Dependently typed programming in Agda
TLDI '09: Proceedings of the 4th international workshop on Types in language design and implementationDependently typed languages have for a long time been used to describe proofs about programs. Traditionally, dependent types are used mostly for stating and proving the properties of the programs and not in defining the programs themselves. An ...
Bidirectional Elaboration of Dependently Typed Programs
PPDP '14: Proceedings of the 16th International Symposium on Principles and Practice of Declarative ProgrammingDependently typed programming languages allow programmers to express a rich set of invariants and verify them statically via type checking. To make programming with dependent types practical, dependently typed systems provide a compact language for ...
Propositional equality for gradual dependently typed programming
Gradual dependent types can help with the incremental adoption of dependently typed code by providing a principled semantics for imprecise types and proofs, where some parts have been omitted. Current theories of gradual dependent types, though, lack ...






Comments