mirror of
				https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
				synced 2025-11-03 21:43:32 +00:00 
			
		
		
		
	nat: When having a proper close down, or a short read close the connection
For now close the connection when having a short read. This might be due a network issue (loss of segment) or similiar. As we are not handling these issues well, let us close the connection.
This commit is contained in:
		@@ -383,13 +383,12 @@ static int ipaccess_msc_read_cb(struct bsc_fd *bfd)
 | 
				
			|||||||
	struct ipaccess_head *hh;
 | 
						struct ipaccess_head *hh;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!msg) {
 | 
						if (!msg) {
 | 
				
			||||||
		if (error == 0) {
 | 
							if (error == 0)
 | 
				
			||||||
			LOGP(DNAT, LOGL_FATAL, "The connection the MSC was lost, exiting\n");
 | 
								LOGP(DNAT, LOGL_FATAL, "The connection the MSC was lost, exiting\n");
 | 
				
			||||||
			bsc_msc_lost(msc_con);
 | 
							else
 | 
				
			||||||
			return -1;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			LOGP(DNAT, LOGL_ERROR, "Failed to parse ip access message: %d\n", error);
 | 
								LOGP(DNAT, LOGL_ERROR, "Failed to parse ip access message: %d\n", error);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							bsc_msc_lost(msc_con);
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -600,12 +599,12 @@ static int ipaccess_bsc_read_cb(struct bsc_fd *bfd)
 | 
				
			|||||||
	struct msgb *msg = ipaccess_read_msg(bfd, &error);
 | 
						struct msgb *msg = ipaccess_read_msg(bfd, &error);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!msg) {
 | 
						if (!msg) {
 | 
				
			||||||
		if (error == 0) {
 | 
							if (error == 0)
 | 
				
			||||||
			LOGP(DNAT, LOGL_ERROR,	"The connection to the BSC was lost. Cleaning it\n");
 | 
								LOGP(DNAT, LOGL_ERROR,	"The connection to the BSC was lost. Cleaning it\n");
 | 
				
			||||||
			remove_bsc_connection(bsc);
 | 
							else
 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			LOGP(DNAT, LOGL_ERROR, "Failed to parse ip access message: %d\n", error);
 | 
								LOGP(DNAT, LOGL_ERROR, "Failed to parse ip access message: %d\n", error);
 | 
				
			||||||
		}
 | 
					
 | 
				
			||||||
 | 
							remove_bsc_connection(bsc);
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user