Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing "loop" during redirect #166

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions core/jdiameter/api/src/main/java/org/jdiameter/api/Avp.java
Original file line number Diff line number Diff line change
Expand Up @@ -2761,6 +2761,17 @@ public interface Avp extends Wrapper, Serializable {
// Service-Area-Identity 1607 3GPP TS 29.272;
// GMLC-Address 2405 3GPP TS 29.173;
// Visited-PLMN-Id 1407 3GPP TS 29.272

/********************************************************/
/*** SWm interface (3GPP AAA - AGW) AVPs (3GPP TS 29.273) ***/
/*** Diameter SWM Application (EAP Protocol) ***/
/********************************************************/

/**
* SWm (3GPP TS 29.273-f10) AAA-Failure-Indication AVP code
*/
int AAA_FAILURE_INDICATION = 1518;


/**
* @return the AVP code.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ public class RouterImpl implements IRouter {
public static final int ALL_APPLICATION = 4;
public static final int ALL_HOST = 5;
public static final int ALL_USER = 6;

public static final long VENDOR_ID_3GPP = 10415L;
//
private static final Logger logger = LoggerFactory.getLogger(RouterImpl.class);
protected MetaData metaData;
Expand Down Expand Up @@ -660,10 +662,20 @@ private void trimRedirectTable() {
/**
* @param request
* @param destHost
* @throws AvpDataException
*/
private void updateRoute(IRequest request, String destHost) {
private void updateRoute(IRequest request, String destHost) throws AvpDataException {
// Realm does not change I think... :)
request.getAvps().removeAvp(Avp.DESTINATION_HOST);
AvpSet destinationHostAvps = request.getAvps().removeAvp(Avp.DESTINATION_HOST);
if (destinationHostAvps != null && destinationHostAvps.size() > 0) {
Avp destinationHostAvp = destinationHostAvps.getAvpByIndex(0);
if (destinationHostAvp != null) {
String prevDestHost = destinationHostAvp.getDiameterIdentity();
if (prevDestHost.equals(destHost)) { // loop detected
request.getAvps().addAvp(Avp.AAA_FAILURE_INDICATION, 1L, VENDOR_ID_3GPP, true, false, true);
}
}
}
request.getAvps().addAvp(Avp.DESTINATION_HOST, destHost, true, false, true);
}

Expand Down