Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
ex_ssrf.c File Reference
#include "nilorea/n_log.h"
#include "nilorea/n_ssrf.h"
#include <string.h>
Include dependency graph for ex_ssrf.c:

Go to the source code of this file.

Macros

#define NO4(a, b, c, d)
#define OK4(a, b, c, d)

Functions

int main (void)

Variables

static int failures = 0

Macro Definition Documentation

◆ NO4

#define NO4 ( a,
b,
c,
d )
Value:
do { \
const uint8_t ip[4] = {a, b, c, d}; \
if (n_ssrf_ipv4_allowed(ip)) { \
n_log(LOG_ERR, "FAIL: %d.%d.%d.%d should be blocked", a, b, c, \
d); \
failures++; \
} \
} while (0)
static int failures
Definition ex_atlas.c:51
#define LOG_ERR
error conditions
Definition n_log.h:100
int n_ssrf_ipv4_allowed(const uint8_t ip[4])
classify an IPv4 address as safe-to-connect or not
Definition n_ssrf.c:60
Examples
ex_ssrf.c.

Definition at line 45 of file ex_ssrf.c.

Referenced by main().

◆ OK4

#define OK4 ( a,
b,
c,
d )
Value:
do { \
const uint8_t ip[4] = {a, b, c, d}; \
if (!n_ssrf_ipv4_allowed(ip)) { \
n_log(LOG_ERR, "FAIL: %d.%d.%d.%d should be allowed", a, b, c, \
d); \
failures++; \
} \
} while (0)
Examples
ex_ssrf.c.

Definition at line 35 of file ex_ssrf.c.

Referenced by main().

Function Documentation

◆ main()

int main ( void )

Definition at line 55 of file ex_ssrf.c.

References failures, LOG_ERR, LOG_NOTICE, n_log, n_ssrf_ipv4_allowed(), n_ssrf_ipv6_allowed(), NO4, OK4, and set_log_level().

Here is the call graph for this function:

Variable Documentation

◆ failures

int failures = 0
static

Definition at line 33 of file ex_ssrf.c.