mirror of
				https://github.com/open5gs/open5gs.git
				synced 2025-11-04 05:53:18 +00:00 
			
		
		
		
	[IPFilter] Assert if getprotobyname() problem (#977)
This commit is contained in:
		@@ -3269,8 +3269,16 @@ add_proto0(ipfw_insn *cmd, char *av, u_char *protop)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	proto = strtol(av, &ep, 10);
 | 
						proto = strtol(av, &ep, 10);
 | 
				
			||||||
	if (*ep != '\0' || proto <= 0) {
 | 
						if (*ep != '\0' || proto <= 0) {
 | 
				
			||||||
 | 
					#if 0 /* modified by acetcom */
 | 
				
			||||||
		if ((pe = getprotobyname(av)) == NULL)
 | 
							if ((pe = getprotobyname(av)) == NULL)
 | 
				
			||||||
			return NULL;
 | 
								return NULL;
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
							if ((pe = getprotobyname(av)) == NULL) {
 | 
				
			||||||
 | 
					            ogs_fatal("getprotobyname('%s') failed", av);
 | 
				
			||||||
 | 
					            ogs_assert_if_reached();
 | 
				
			||||||
 | 
								return NULL;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
		proto = pe->p_proto;
 | 
							proto = pe->p_proto;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,6 +29,8 @@
 | 
				
			|||||||
 * XXX The context is not restored after each line.
 | 
					 * XXX The context is not restored after each line.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "ogs-ipfw.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct cmdline_opts {
 | 
					struct cmdline_opts {
 | 
				
			||||||
	/* boolean options: */
 | 
						/* boolean options: */
 | 
				
			||||||
	int	do_value_as_ip;	/* show table value as IP */
 | 
						int	do_value_as_ip;	/* show table value as IP */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,8 +24,6 @@
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "ogs-ipfw.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "ipfw2.h"
 | 
					#include "ipfw2.h"
 | 
				
			||||||
#include "objs/include_e/netinet/ip_fw.h"
 | 
					#include "objs/include_e/netinet/ip_fw.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user