MAXFWD module
Admin Guide
Section titled “Admin Guide”Overview
Section titled “Overview”The module implements all the operations regarding MaX-Forward header field, like adding it (if not present) or decrementing and checking the value of the existent one.
Dependencies
Section titled “Dependencies”OpenSIPS Modules
Section titled “OpenSIPS Modules”The following modules must be loaded before this module:
- No dependencies on other OpenSIPS modules.
External Libraries or Applications
Section titled “External Libraries or Applications”The following libraries or applications must be installed before running OpenSIPS with this module loaded:
- None.
Exported Parameters
Section titled “Exported Parameters”max_limit (integer)
Section titled “max_limit (integer)”Set an upper limit for the max-forward value in the outgoing requests. If the header is present, the decremented value is not allowed to exceed this max_limits - if it does, the header value will by decreased to “max_limit”.
Note: This check is done when calling the mf_process_maxfwd_header() header.
The range of values stretches from 1 to 256, which is the maximum MAX-FORWARDS value allowed by RFC 3261.
Default value is “256”.
...modparam("maxfwd", "max_limit", 32)...Exported Functions
Section titled “Exported Functions”mf_process_maxfwd_header(max_value)
Section titled “mf_process_maxfwd_header(max_value)”If no Max-Forward header is present in the received request, a header will be added having the original value equal with “max_value”. If a Max-Forward header is already present, its value will be decremented (if not 0).
Retuning codes:
- 2 (true) - header was not found and a new header was successfully added.
- 1 (true) - header was found and its value was successfully decremented (had a non-0 value).
- -1 (false) - the header was found and its value is 0 (cannot be decremented).
- -2 (false) - error during processing.
The return code may be extensivly tested via script variable “retcode” (or ”$?”).
Meaning of the parameters is as follows:
- max_value (int) - Value to be added if there is no Max-Forwards header field in the message.
This function can be used from REQUEST_ROUTE.
...# initial sanity checks -- messages with# max_forwards==0, or excessively long requestsif (!mf_process_maxfwd_header(10) && $retcode==-1) { sl_send_reply(483,"Too Many Hops"); exit;};...is_maxfwd_lt(max_value)
Section titled “is_maxfwd_lt(max_value)”Checks if the Max-Forward header value is less then the “max_value” parameter value. It considers also the value of the new inserted header (if locally added).
Retuning codes:
- 1 (true) - header was found or set and its value is strictly less than “max_value”.
- -1 (false) - the header was found or set and its value is greater or equal to “max_value”.
- -2 (false) - header was not found or not set.
- -3 (false) - error during processing.
The return code may be extensivly tested via script variable “retcode” (or ”$?”).
Meaning of the parameters is as follows:
- max_value (int) - value to check the Max-Forward.value against (as less than).
...# next hope is a gateway, so make no sens to# forward if MF is 0 (after decrement)if ( is_maxfwd_lt(1) ) { sl_send_reply(483,"Too Many Hops"); exit;};...Contributors
Section titled “Contributors”By Commit Statistics
Section titled “By Commit Statistics”Top contributors by DevScore(1), authored commits(2) and lines added/removed(3)
| # | Name | DevScore | Commits | Lines++ | Lines— |
|---|---|---|---|---|---|
| 1. | Bogdan-Andrei Iancu (@bogdan-iancu) | 47 | 30 | 889 | 509 |
| 2. | Liviu Chircu (@liviuchircu) | 12 | 10 | 26 | 53 |
| 3. | Jan Janak (@janakj) | 11 | 9 | 58 | 38 |
| 4. | Daniel-Constantin Mierla (@miconda) | 11 | 9 | 23 | 19 |
| 5. | Andrei Pelinescu-Onciul | 10 | 8 | 31 | 26 |
| 6. | Jiri Kuthan (@jiriatipteldotorg) | 9 | 7 | 93 | 7 |
| 7. | Razvan Crainea (@razvancrainea) | 9 | 7 | 11 | 10 |
| 8. | Vlad Patrascu (@rvlad-patrascu) | 6 | 4 | 37 | 46 |
| 9. | Stefan Darius (@dariusstefan) | 6 | 3 | 190 | 26 |
| 10. | Henning Westerholt (@henningw) | 4 | 2 | 3 | 3 |
All remaining contributors: Maksym Sobolyev (@sobomax), Aron Podrigal (@ar45), Konstantin Bokarius, Peter Lemenkov (@lemenkov), Walter Doekes (@wdoekes), Andreas Heise, Edson Gellert Schubert, Nils Ohlmeier, Klaus Darilion, Elena-Ramona Modroiu, Alexandra Titoc.
(1) DevScore = author_commits + author_lines_added / (project_lines_added / project_commits) + author_lines_deleted / (project_lines_deleted / project_commits)
(2) including any documentation-related commits, excluding merge commits
(3) ignoring whitespace edits, renamed files and auto-generated files
By Commit Activity
Section titled “By Commit Activity”| # | Name | Commit Activity |
|---|---|---|
| 1. | Stefan Darius (@dariusstefan) | Jun 2026 - Jul 2026 |
| 2. | Razvan Crainea (@razvancrainea) | Feb 2012 - Jun 2026 |
| 3. | Alexandra Titoc | Sep 2024 - Sep 2024 |
| 4. | Aron Podrigal (@ar45) | Sep 2024 - Sep 2024 |
| 5. | Liviu Chircu (@liviuchircu) | Jan 2014 - May 2024 |
| 6. | Maksym Sobolyev (@sobomax) | Feb 2023 - Feb 2023 |
| 7. | Vlad Patrascu (@rvlad-patrascu) | May 2017 - Apr 2019 |
| 8. | Bogdan-Andrei Iancu (@bogdan-iancu) | Jan 2002 - Apr 2019 |
| 9. | Peter Lemenkov (@lemenkov) | Jun 2018 - Jun 2018 |
| 10. | Walter Doekes (@wdoekes) | May 2014 - May 2014 |
All remaining contributors: Daniel-Constantin Mierla (@miconda), Konstantin Bokarius, Edson Gellert Schubert, Henning Westerholt (@henningw), Klaus Darilion, Andreas Heise, Elena-Ramona Modroiu, Jan Janak (@janakj), Andrei Pelinescu-Onciul, Nils Ohlmeier, Jiri Kuthan (@jiriatipteldotorg).
(1) including any documentation-related commits, excluding merge commits
Documentation
Section titled “Documentation”Contributors
Section titled “Contributors”Last edited by: Razvan Crainea (@razvancrainea), Vlad Patrascu (@rvlad-patrascu), Liviu Chircu (@liviuchircu), Peter Lemenkov (@lemenkov), Bogdan-Andrei Iancu (@bogdan-iancu), Daniel-Constantin Mierla (@miconda), Konstantin Bokarius, Edson Gellert Schubert, Klaus Darilion, Elena-Ramona Modroiu.
License
Section titled “License”All documentation files (i.e. .md extension) are licensed under the Creative Common License 4.0