mirror of
				https://github.com/optim-enterprises-bv/nDPId-2.git
				synced 2025-10-30 17:57:52 +00:00 
			
		
		
		
	Added env check NDPID_STARTED_BY_SYSTEMD to prevent logging to stderr in such a case
				
					
				
			* removed `nDPId` shutdown on poll/epoll error * fixed `chmod_chown()` rv check Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
		
							
								
								
									
										5
									
								
								nDPId.c
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								nDPId.c
									
									
									
									
									
								
							| @@ -3452,8 +3452,8 @@ static uint32_t calculate_ndpi_flow_struct_hash(struct ndpi_flow_struct const * | ||||
| /* mask for FCF */ | ||||
| #define WIFI_DATA 0x2 | ||||
| #define FCF_TYPE(fc) (((fc) >> 2) & 0x3) /* 0000 0011 = 0x3 */ | ||||
| #define FCF_TO_DS(fc) ((fc)&0x0100) | ||||
| #define FCF_FROM_DS(fc) ((fc)&0x0200) | ||||
| #define FCF_TO_DS(fc) ((fc) & 0x0100) | ||||
| #define FCF_FROM_DS(fc) ((fc) & 0x0200) | ||||
| /* mask for Bad FCF presence */ | ||||
| #define BAD_FCS 0x50 /* 0101 0000 */ | ||||
| static int process_datalink_layer(struct nDPId_reader_thread * const reader_thread, | ||||
| @@ -4881,7 +4881,6 @@ static void run_capture_loop(struct nDPId_reader_thread * const reader_thread) | ||||
|                 if (nio_has_error(&io, i) == NIO_SUCCESS) | ||||
|                 { | ||||
|                     logger(1, "%s", "Event I/O error"); | ||||
|                     MT_GET_AND_ADD(reader_thread->workflow->error_or_eof, 1); | ||||
|                 } | ||||
|  | ||||
|                 int fd = nio_get_fd(&io, i); | ||||
|   | ||||
| @@ -1834,7 +1834,7 @@ int main(int argc, char ** argv) | ||||
|                    GET_CMDARG_STR(nDPIsrvd_options.user), | ||||
|                    strerror(ret)); | ||||
|         } | ||||
|         if (ret != -EPERM) | ||||
|         if (ret != EPERM) | ||||
|         { | ||||
|             goto error_unlink_sockets; | ||||
|         } | ||||
| @@ -1867,7 +1867,7 @@ int main(int argc, char ** argv) | ||||
|                    GET_CMDARG_STR(nDPIsrvd_options.user), | ||||
|                    strerror(ret)); | ||||
|         } | ||||
|         if (ret != -EPERM) | ||||
|         if (ret != EPERM) | ||||
|         { | ||||
|             goto error_unlink_sockets; | ||||
|         } | ||||
|   | ||||
| @@ -8,6 +8,7 @@ Type=simple | ||||
| ExecStartPre=/bin/sh -c 'test -r "@CMAKE_INSTALL_PREFIX@/etc/nDPId/%i.conf" || cp -v "@CMAKE_INSTALL_PREFIX@/share/nDPId/ndpid.conf.example" "@CMAKE_INSTALL_PREFIX@/etc/nDPId/%i.conf"' | ||||
| ExecStart=@CMAKE_INSTALL_PREFIX@/sbin/nDPId -f @CMAKE_INSTALL_PREFIX@/etc/nDPId/%i.conf -i %i -u ndpid -c /run/nDPIsrvd/collector | ||||
| Restart=on-failure | ||||
| Environment="NDPID_STARTED_BY_SYSTEMD=" | ||||
|  | ||||
| [Install] | ||||
| WantedBy=multi-user.target | ||||
|   | ||||
| @@ -6,8 +6,10 @@ After=network.target | ||||
| Type=simple | ||||
| ExecStartPre=/bin/sh -c 'test -r "@CMAKE_INSTALL_PREFIX@/etc/nDPId/nDPIsrvd.conf" || cp -v "@CMAKE_INSTALL_PREFIX@/share/nDPId/ndpisrvd.conf.example" "@CMAKE_INSTALL_PREFIX@/etc/nDPId/nDPIsrvd.conf"' | ||||
| ExecStartPre=/bin/sh -c 'mkdir -p /run/nDPIsrvd && chown root:root /run/nDPIsrvd && chmod 0775 /run/nDPIsrvd' | ||||
| ExecStopPost=/bin/sh -c 'rm -f /run/nDPIsrvd/collector /run/nDPIsrvd/distributor' | ||||
| ExecStart=@CMAKE_INSTALL_PREFIX@/bin/nDPIsrvd -f @CMAKE_INSTALL_PREFIX@/etc/nDPId/nDPIsrvd.conf -u ndpisrvd -c /run/nDPIsrvd/collector -s /run/nDPIsrvd/distributor -G ndpid:ndpisrvd-distributor | ||||
| Restart=on-failure | ||||
| Environment="NDPID_STARTED_BY_SYSTEMD=" | ||||
|  | ||||
| [Install] | ||||
| WantedBy=multi-user.target | ||||
|   | ||||
							
								
								
									
										9
									
								
								utils.c
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								utils.c
									
									
									
									
									
								
							| @@ -586,9 +586,12 @@ __attribute__((format(printf, 2, 3))) void logger_early(int is_error, char const | ||||
|     int old_log_to_console = log_to_console; | ||||
|     va_list ap; | ||||
|  | ||||
|     va_start(ap, format); | ||||
|     vlogger_to(fileno(stderr), is_error, format, &ap); | ||||
|     va_end(ap); | ||||
|     if (getenv("NDPID_STARTED_BY_SYSTEMD") == NULL) | ||||
|     { | ||||
|         va_start(ap, format); | ||||
|         vlogger_to(fileno(stderr), is_error, format, &ap); | ||||
|         va_end(ap); | ||||
|     } | ||||
|  | ||||
|     log_to_console = 0; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Toni Uhlig
					Toni Uhlig