MCPcopy Create free account
hub / github.com/F-Stack/f-stack / INa_process

Function INa_process

freebsd/netinet/libalias/alias_sctp.c:1873–1906  ·  view source on GitHub ↗

@ingroup state_machine * @brief Process SCTP message while waiting for an AddIp-ACK message * * Only an AddIP-ACK, resent AddIP, or an ABORT message are valid, all other * SCTP packets are dropped * * @param la Pointer to the relevant libalias instance * @param direction SN_TO_LOCAL | SN_TO_GLOBAL * @param sm Pointer to sctp message information * @param assoc Pointer to the association th

Source from the content-addressed store, hash-verified

1871 * @return SN_NAT_PKT | SN_DROP_PKT
1872 */
1873static int
1874INa_process(struct libalias *la, int direction,struct sctp_nat_assoc *assoc, struct sctp_nat_msg *sm)
1875{
1876 switch (sm->msg) {
1877 case SN_SCTP_ASCONF: /* a packet containing an ASCONF chunk*/
1878 sctp_ResetTimeOut(la,assoc, SN_I_T(la));
1879 return (SN_NAT_PKT);
1880 case SN_SCTP_ASCONFACK: /* a packet containing an ASCONF chunk with a ADDIP-ACK */
1881 switch (direction) {
1882 case SN_TO_LOCAL:
1883 if (!(assoc->TableRegister & SN_WAIT_TOLOCAL)) /* wrong direction */
1884 return (SN_DROP_PKT);
1885 break;
1886 case SN_TO_GLOBAL:
1887 if (!(assoc->TableRegister & SN_WAIT_TOGLOBAL)) /* wrong direction */
1888 return (SN_DROP_PKT);
1889 }
1890 if (IsASCONFack(la,sm,direction)) {
1891 assoc->TableRegister &= SN_BOTH_TBL; /* remove wait flags */
1892 assoc->state = SN_UP; /* association established for NAT */
1893 sctp_ResetTimeOut(la,assoc, SN_U_T(la));
1894 return (SN_NAT_PKT);
1895 } else {
1896 assoc->state = SN_RM;/* Mark for removal*/
1897 return (SN_NAT_PKT);
1898 }
1899 case SN_SCTP_ABORT: /* a packet containing an ABORT chunk */
1900 assoc->state = SN_RM;/* Mark for removal*/
1901 return (SN_NAT_PKT);
1902 default:
1903 return (SN_DROP_PKT);
1904 }
1905 return (SN_DROP_PKT);/* shouldn't get here very bad: log, drop and hope for the best */
1906}
1907
1908/** @ingroup state_machine
1909 * @brief Process SCTP messages while association is UP redirecting packets

Callers 1

ProcessSctpMsgFunction · 0.85

Calls 2

sctp_ResetTimeOutFunction · 0.85
IsASCONFackFunction · 0.85

Tested by

no test coverage detected