From 2e12b1f4b613be1f9b08ab8027106f746b82840e Mon Sep 17 00:00:00 2001 From: Syed-Shahrukh-OSSRevival Date: Fri, 24 Oct 2025 00:21:35 +0500 Subject: [PATCH 1/3] Fix old C function declaration warning for gcc 15 --- abbrev.c | 13 ++++------ display.c | 16 ++++--------- ether.c | 19 +++++---------- flow.c | 25 ++++++------------- frag.c | 70 ++++++++++++++---------------------------------------- hash.c | 24 +++++-------------- icmp.c | 5 +--- ifc.c | 3 +-- ip.c | 24 ++++++------------- ip6.c | 14 ++++------- ipx.c | 6 ++--- loop.c | 5 ++-- main.c | 10 +++----- memcmp.c | 4 +--- ppp.c | 4 +--- sll.c | 4 +--- strlcpy.c | 5 +--- tag.c | 4 +--- tcp.c | 31 +++++++----------------- tcp_http.c | 6 +---- tcp_smtp.c | 21 +++++----------- tcp_x11.c | 5 +--- udp.c | 17 ++++--------- wol.c | 6 ++--- 24 files changed, 95 insertions(+), 246 deletions(-) diff --git a/abbrev.c b/abbrev.c index ef1c6b8..7dc3d99 100644 --- a/abbrev.c +++ b/abbrev.c @@ -39,8 +39,7 @@ static int abbrev_match(const char *, const char *); * Return 1 if they match. */ static int -abbrev_match(tag, pattern) - const char *tag, *pattern; +abbrev_match(const char *tag, const char * pattern) { while (*pattern) { /* '*' matches zero or more non-space characters */ @@ -81,8 +80,7 @@ abbrev_match(tag, pattern) * that matches the tag; otherwise return the original tag. */ const char * -abbrev_tag(tag) - const char *tag; +abbrev_tag( const char *tag) { int i; @@ -95,8 +93,7 @@ abbrev_tag(tag) /* Add an abbreviation pattern to the list of known patterns */ void -abbrev_add(abbrev) - const char *abbrev; +abbrev_add(const char *abbrev) { char *name, *pattern, *p; @@ -134,9 +131,7 @@ abbrev_add(abbrev) /* Load the abbreviations listed in the given file */ void -abbrev_add_file(filename, ignore_open_error) - const char *filename; - int ignore_open_error; +abbrev_add_file( const char *filename, int ignore_open_error) { FILE *f; char pattern[1024]; /* XXX arbitrary limit? */ diff --git a/display.c b/display.c index fd5f4a6..a426adc 100644 --- a/display.c +++ b/display.c @@ -111,9 +111,7 @@ static void printhelp(void); /* Return SI unit representation for number x, e.g (3000,"%.1f") -> "3.0k" */ static const char * -mega(x, fmt) - double x; - const char *fmt; +mega(double x, const char *fmt) { static char buf[1024]; /* XXX - arbitrary size */ static char suffix[] = " kMGTPE"; @@ -139,8 +137,7 @@ mega(x, fmt) /* Return human-friendly time expression, eg in days, weeks, hours etc. */ static const char * -days(td) - double td; +days(double td) { static char buf[1024]; /* XXX - arbitrary size */ unsigned long t = td; @@ -179,8 +176,7 @@ days(td) /* Prepare the display using curses */ void -display_open(device, filter) - const char *device, *filter; +display_open(const char *device, const char *filter) { display_device = device; @@ -205,8 +201,7 @@ display_close() } static void -update_stats(period) - double period; +update_stats(double period) { int i; unsigned long sum; @@ -278,8 +273,7 @@ batch_update(double period) /* Update the display, sorting and drawing all the computed tags */ void -display_update(period) - double period; +display_update(double period) { int i, flags, ch; int maxx, maxy, y, x; diff --git a/ether.c b/ether.c index 4f88102..fb0072a 100644 --- a/ether.c +++ b/ether.c @@ -62,9 +62,7 @@ struct pppoe_header { /* Return the tag for an Ethernet II frame */ const char * -ether_tag(p, end) - const char *p; - const char *end; +ether_tag(const char *p, const char *end) { struct ether_header eh; u_int16_t type; @@ -119,10 +117,8 @@ pppoe_tag(p, end) /* Return the tag for an ethernet-like frame, or NULL if unknown */ const char * -ether_tagx(type, p, end) - unsigned int type; /* should be u_int16_t */ - const char *p; - const char *end; +ether_tagx(unsigned int type, /* should be u_int16_t */ + const char *p, const char *end) { /* * From IEEE Std 802.3 2000 edition: @@ -225,8 +221,7 @@ static struct { /* 802.2 LLC header */ static const char * -llc_tag(p, end) - const char *p, *end; +llc_tag(const char *p, const char *end) { /* ANSI/IEEE Std 802.2 section 3.2 LLC PDU format */ struct llc { @@ -335,8 +330,7 @@ static struct { /* Return string form of ethernet type */ static const char * -ethertype(type) - unsigned type; +ethertype(unsigned type) { int i; static char unknown[32]; @@ -350,8 +344,7 @@ ethertype(type) /* 802.2 SNAP */ static const char * -snap_tag(p, end) - const char *p, *end; +snap_tag(const char *p, const char *end) { u_int8_t *snap_oui; /* [3] */ u_int8_t *snap_type; /* [2] */ diff --git a/flow.c b/flow.c index 9f60161..73dbad4 100644 --- a/flow.c +++ b/flow.c @@ -41,8 +41,7 @@ static int maxflows = 0; /* Generate a hash value for a tag */ static unsigned int -hash(tag) - const char *tag; +hash(const char *tag) { unsigned int result; @@ -55,8 +54,7 @@ hash(tag) /* Find a flow by its tag */ struct flow * -findflow(tag) - const char *tag; +findflow(const char *tag) { int i; unsigned int taghash = hash(tag); @@ -98,9 +96,7 @@ findflow(tag) /* Compare flows by the number of octets they have carried (reverse order) */ int -octetcmp(a, b) - const void *a; - const void *b; +octetcmp(const void *a, const void *b) { const struct flow *fa = (const struct flow *)a; const struct flow *fb = (const struct flow *)b; @@ -109,9 +105,7 @@ octetcmp(a, b) /* Compare flows by their tag */ int -tagcmp(a, b) - const void *a; - const void *b; +tagcmp( const void *a, const void *b) { const struct flow *fa = (const struct flow *)a; const struct flow *fb = (const struct flow *)b; @@ -120,9 +114,7 @@ tagcmp(a, b) /* Compare flows by the time they were last seen (reverse order) */ int -lastcmp(a, b) - const void *a; - const void *b; +lastcmp(const void *a, const void *b) { const struct flow *fa = (const struct flow *)a; const struct flow *fb = (const struct flow *)b; @@ -137,9 +129,7 @@ lastcmp(a, b) /* Compare flows by their packet count (reverse order) */ int -packetcmp(a, b) - const void *a; - const void *b; +packetcmp(const void *a, const void *b) { const struct flow *fa = (const struct flow *)a; const struct flow *fb = (const struct flow *)b; @@ -160,8 +150,7 @@ flow_zero() /* Remove a flow */ void -flow_del(f) - struct flow *f; +flow_del(struct flow *f) { int i = f - flows; diff --git a/frag.c b/frag.c index 222349f..6d5a92c 100644 --- a/frag.c +++ b/frag.c @@ -75,9 +75,7 @@ static void bucket_delete(struct fragtab *fragtab, struct bucket *bucket); /* Compute a hash index from a key string */ static unsigned int -hash(key, keylen) - const void *key; - int keylen; +hash( const void *key, int keylen) { unsigned int h = 0; unsigned char *p; @@ -89,9 +87,7 @@ hash(key, keylen) /* Remove a bucket from the lru list */ static void -bucket_lru_remove(fragtab, bucket) - struct fragtab *fragtab; - struct bucket *bucket; +bucket_lru_remove(struct fragtab *fragtab, struct bucket *bucket) { if (bucket->lru_back) @@ -106,9 +102,7 @@ bucket_lru_remove(fragtab, bucket) /* Place a (removed) bucket at the front of the lru list */ static void -bucket_lru_insert(fragtab, bucket) - struct fragtab *fragtab; - struct bucket *bucket; +bucket_lru_insert(struct fragtab *fragtab, struct bucket *bucket) { if (fragtab->lru_first) { bucket->lru_fwd = fragtab->lru_first; @@ -125,8 +119,7 @@ bucket_lru_insert(fragtab, bucket) /* Unlink and deallocate a fragment */ static void -frag_delete(frag) - struct frag *frag; +frag_delete(struct frag *frag) { LIST_REMOVE(frag, ordered); free(frag); @@ -137,9 +130,7 @@ frag_delete(frag) * should be. */ static struct frag ** -frag_find(fragp, index) - struct frag **fragp; - u_int32_t index; +frag_find(struct frag **fragp, u_int32_t index) { while (*fragp && (*fragp)->index < index) fragp = &LIST_NEXT(*fragp, ordered); @@ -151,9 +142,7 @@ frag_find(fragp, index) * Returns the end of the chain, if not found. */ static struct bucket ** -bucket_find(fragtab, key) - struct fragtab *fragtab; - const void *key; +bucket_find(struct fragtab *fragtab, const void *key) { struct bucket **bucketp; unsigned int keyhash; @@ -168,10 +157,7 @@ bucket_find(fragtab, key) /* Create and insert a new bucket */ static void -bucket_create(fragtab, key, dest) - struct fragtab *fragtab; - const void *key; - struct bucket **dest; +bucket_create(struct fragtab *fragtab, const void *key, struct bucket **dest) { struct bucket *bucket; size_t size; @@ -191,12 +177,8 @@ bucket_create(fragtab, key, dest) /* Create and insert a new fragment. */ static void -frag_create(fragtab, data, datalen, index, next_index, dest) - struct fragtab *fragtab; - const void *data; - size_t datalen; - u_int32_t index, next_index; - struct frag **dest; +frag_create(struct fragtab *fragtab, const void *data, size_t datalen, + u_int32_t index, u_int32_t next_index, struct frag **dest) { size_t size; struct frag* frag; @@ -215,9 +197,7 @@ frag_create(fragtab, data, datalen, index, next_index, dest) /* Delete a bucket and all the fragments it contains */ static void -bucket_delete(fragtab, bucket) - struct fragtab *fragtab; - struct bucket *bucket; +bucket_delete(struct fragtab *fragtab, struct bucket *bucket) { while (bucket->first_frag) frag_delete(bucket->first_frag); @@ -232,8 +212,7 @@ bucket_delete(fragtab, bucket) * Allocate an empty fragment table */ struct fragtab * -fragtab_new(keylen, maxbuckets) - int keylen, maxbuckets; +fragtab_new(int keylen, int maxbuckets) { struct fragtab *fragtab; int i; @@ -256,12 +235,8 @@ fragtab_new(keylen, maxbuckets) * to the young end of the lru list. */ void -fragtab_put(fragtab, key, data, datalen, index, next_index) - struct fragtab *fragtab; - const void *key; - const void *data; - size_t datalen; - u_int32_t index, next_index; +fragtab_put(struct fragtab *fragtab, const void *key, const void *data, size_t datalen, + u_int32_t index, u_int32_t next_index) { struct bucket **bucketp, *bucket; struct frag **fragp; @@ -289,11 +264,7 @@ fragtab_put(fragtab, key, data, datalen, index, next_index) * or return NULL if it doesn't exist yet. */ const void * -fragtab_get(fragtab, key, index, datalenp) - struct fragtab *fragtab; - const void *key; - u_int32_t index; - size_t *datalenp; +fragtab_get(struct fragtab *fragtab, const void *key, u_int32_t index, size_t *datalenp) { struct bucket *bucket; struct frag *frag; @@ -313,9 +284,7 @@ fragtab_get(fragtab, key, index, datalenp) * Delete all fragments with the given key */ void -fragtab_del(fragtab, key) - struct fragtab *fragtab; - const void *key; +fragtab_del(struct fragtab *fragtab, const void *key) { struct bucket *bucket; @@ -329,10 +298,8 @@ fragtab_del(fragtab, key) * ie each fragment's next_index is equal to the next fragment's index */ int -fragtab_check(fragtab, key, first_index, last_index) - struct fragtab *fragtab; - const void *key; - u_int32_t first_index, last_index; +fragtab_check(struct fragtab *fragtab, const void *key, + u_int32_t first_index, u_int32_t last_index) { struct bucket *bucket; struct frag *frag; @@ -360,8 +327,7 @@ fragtab_check(fragtab, key, first_index, last_index) * Destroy all storage associated with the fragment table */ void -fragtab_free(fragtab) - struct fragtab *fragtab; +fragtab_free(struct fragtab *fragtab) { int i; diff --git a/hash.c b/hash.c index 2ad2174..c438f56 100644 --- a/hash.c +++ b/hash.c @@ -25,9 +25,7 @@ struct hashelt { }; static struct hashelt ** -find(h, key) - struct hash *h; - const void *key; +find(struct hash *h, const void *key) { unsigned int hash = (*h->hashfn)(key); struct hashelt **he; @@ -40,9 +38,7 @@ find(h, key) /* Find the data associated with a key. Returns 0 if not found. */ const void * -hash_lookup(h, key) - struct hash *h; - const void *key; +hash_lookup(struct hash *h, const void *key) { struct hashelt **he = find(h, key); @@ -59,10 +55,7 @@ hash_lookup(h, key) * pointers. */ void -hash_store(h, key, data) - struct hash *h; - const void *key; - const void *data; +hash_store(struct hash *h, const void *key, const void *data) { struct hashelt **he = find(h, key); struct hashelt *e; @@ -86,9 +79,7 @@ hash_store(h, key, data) /* Free a hashed value */ void -hash_del(h, key) - struct hash *h; - const void *key; +hash_del(struct hash *h, const void *key) { struct hashelt **he = find(h, key); @@ -105,8 +96,7 @@ hash_del(h, key) /* Free all the values stored in a hash table */ void -hash_clear(h) - struct hash *h; +hash_clear(struct hash *h) { int i; @@ -124,9 +114,7 @@ hash_clear(h) /* A generic hashing function for binary data */ unsigned int -hash_generic(data, sz) - const void *data; - size_t sz; +hash_generic( const void *data, size_t sz) { unsigned int hash = 0; const unsigned char *p = (const unsigned char *)data; diff --git a/icmp.c b/icmp.c index 70be1c9..520e239 100644 --- a/icmp.c +++ b/icmp.c @@ -60,10 +60,7 @@ static char *typetab[] = { #define lengthof(a) (sizeof (a) / sizeof (a)[0]) const char * -icmp_tag(p, end, ip) - const char *p; - const char *end; - const struct ip *ip; +icmp_tag( const char *p, const char *end, const struct ip *ip) { const char *src, *dst; static char tag[TAGLEN]; diff --git a/ifc.c b/ifc.c index 6d2d212..0ff8a7d 100644 --- a/ifc.c +++ b/ifc.c @@ -42,8 +42,7 @@ static char ifname[IFNAMSIZ]; /* Specify the interface name for future ifc_flags calls */ void -ifc_init(interface) - const char *interface; +ifc_init(const char *interface) { /* Allocate a raw socket for later kernel queries on ifc state */ #if defined(AF_PACKET) diff --git a/ip.c b/ip.c index 0827118..7c03239 100644 --- a/ip.c +++ b/ip.c @@ -51,9 +51,7 @@ static const char *ip_fragment(const char *p, const char *end, static const char *ip_pkt_tag(const char *p, const char *end); static int -inaddr_cmp(a, b) - const void *a; - const void *b; +inaddr_cmp(const void *a, const void *b) { const struct in_addr *ia = (const struct in_addr *)a; const struct in_addr *ib = (const struct in_addr *)b; @@ -62,8 +60,7 @@ inaddr_cmp(a, b) } static unsigned int -inaddr_hash(a) - const void *a; +inaddr_hash(const void *a) { const struct in_addr *ia = (const struct in_addr *)a; @@ -91,8 +88,7 @@ ip_reset() /* Look up an IP address */ const char * -ip_lookup(addr) - const struct in_addr *addr; +ip_lookup(const struct in_addr *addr) { const char *result; static int old_nflag = -1; @@ -142,10 +138,8 @@ ip_lookup(addr) /* Handle a fragment */ static const char * -ip_fragment(p, end, offset) - const char *p; - const char *end; - unsigned offset; +ip_fragment(const char *p, const char *end, + unsigned offset) { const struct ip *ip = (const struct ip *)p; struct ipfkey { @@ -195,9 +189,7 @@ if (!ip_fragtab) abort(); } static const char * -ip_pkt_tag(p, end) - const char *p; - const char *end; +ip_pkt_tag(const char *p, const char *end) { const struct ip *ip = (const struct ip *)p; const char *pktend; @@ -241,9 +233,7 @@ ip_pkt_tag(p, end) } const char * -ip_tag(p, end) - const char *p; - const char *end; +ip_tag( const char *p, const char *end) { const struct ip *ip = (struct ip *)p; u_int16_t offset; diff --git a/ip6.c b/ip6.c index 2db38cd..d10ed00 100644 --- a/ip6.c +++ b/ip6.c @@ -48,9 +48,7 @@ /* Compare two IPv6 addresses */ static int -in6addr_cmp(a, b) - const void *a; - const void *b; +in6addr_cmp(const void *a, const void *b) { const struct in6_addr *ia = (const struct in6_addr *)a; const struct in6_addr *ib = (const struct in6_addr *)b; @@ -60,8 +58,7 @@ in6addr_cmp(a, b) /* Compute a hash value of an IPv6 address */ static unsigned int -in6addr_hash(a) - const void *a; +in6addr_hash(const void *a) { const struct in6_addr *ia = (const struct in6_addr *)a; @@ -77,8 +74,7 @@ static struct hash ip6_hash = { /* Look up an IP address */ const char * -ip6_lookup(addr) - const struct in6_addr *addr; +ip6_lookup(const struct in6_addr *addr) { const char *result; static int old_nflag = -1; @@ -127,9 +123,7 @@ ip6_lookup(addr) } const char * -ip6_tag(p, end) - const char *p; - const char *end; +ip6_tag(const char *p, const char *end) { const struct ip6_hdr *ip6; static char tag[TAGLEN]; diff --git a/ipx.c b/ipx.c index ce7b94c..be78c81 100644 --- a/ipx.c +++ b/ipx.c @@ -119,8 +119,7 @@ static struct { * use Cisco's representation, suffixed by a colon and the decimal port number. */ static const char * -my_ipx_ntoa(addr) - void *addr; +my_ipx_ntoa(void *addr) { static char buf[] = "00000000.0000.0000.0000:0000"; u_int32_t ipx_net; @@ -141,8 +140,7 @@ my_ipx_ntoa(addr) } const char * -ipx_tag(p, end) - const char *p, *end; +ipx_tag(const char *p, const char *end) { #if defined(__linux__) struct ipxhdr h; diff --git a/loop.c b/loop.c index 5347494..00047fc 100644 --- a/loop.c +++ b/loop.c @@ -29,9 +29,8 @@ */ const char * -loop_tag(p, end) - const char *p; - const char *end; +loop_tag(const char *p, const char *end) + { u_int32_t af; static char tag[TAGLEN]; diff --git a/main.c b/main.c index f6ebe38..93d7149 100644 --- a/main.c +++ b/main.c @@ -104,10 +104,8 @@ void check_canary(const volatile unsigned char *canary, size_t sz) { * This is called directly from libpcap. */ static void -upcall_from_pcap(context, hdr, data) - u_char *context; - const struct pcap_pkthdr *hdr; - const u_char *data; +upcall_from_pcap(u_char *context, const struct pcap_pkthdr *hdr, + const u_char *data) { const char *tag; const char *(*fn)(const char *, const char *) = @@ -143,9 +141,7 @@ pcap_cleanup() /* main */ int -main(argc, argv) - int argc; - char *argv[]; +main( int argc, char *argv[]) { int ch; extern int optind; diff --git a/memcmp.c b/memcmp.c index cc15f54..b17d977 100644 --- a/memcmp.c +++ b/memcmp.c @@ -6,9 +6,7 @@ #include "compat.h" int -memcmp(pa, pb, len) - void *pa, *pb; - size_t len; +memcmp( void *pa, void *pb, size_t len) { unsigned char *a = (unsigned char *)pa; unsigned char *b = (unsigned char *)pb; diff --git a/ppp.c b/ppp.c index 1fd7892..83aad1e 100644 --- a/ppp.c +++ b/ppp.c @@ -57,9 +57,7 @@ /* When the datalink type is DLT_PPP, we decode PPP-level packets */ const char * -ppp_tag(p, end) - const char *p; - const char *end; +ppp_tag(const char *p, const char *end) { static char tag[TAGLEN]; diff --git a/sll.c b/sll.c index c7dff00..3595c8b 100644 --- a/sll.c +++ b/sll.c @@ -68,9 +68,7 @@ struct sll_header { /* Return the tag for a Linux cooked socket packet */ const char * -sll_tag(p, end) - const char *p; - const char *end; +sll_tag(const char *p, const char *end) { struct sll_header *sll = (struct sll_header *)p; const char *tag; diff --git a/strlcpy.c b/strlcpy.c index 7451f11..54adb83 100644 --- a/strlcpy.c +++ b/strlcpy.c @@ -12,10 +12,7 @@ #include "compat.h" size_t -strlcpy(dst, src, len) - char *dst; - const char *src; - size_t len; +strlcpy(char *dst, const char *src, size_t len) { size_t ret = 0; diff --git a/tag.c b/tag.c index 14ab760..ecda08f 100644 --- a/tag.c +++ b/tag.c @@ -29,9 +29,7 @@ * of combined flows. */ const char * -tag_combine(src, dst) - const char *src; - const char *dst; +tag_combine(const char *src, const char *dst) { static char buf[TAGLEN]; static char buf2[TAGLEN]; diff --git a/tcp.c b/tcp.c index afdb8f6..d0c0159 100644 --- a/tcp.c +++ b/tcp.c @@ -65,9 +65,7 @@ static struct { } ftp; static int -tcp_cmp(a, b) - const void *a; - const void *b; +tcp_cmp(const void *a, const void *b) { const u_int16_t*ia = (const u_int16_t*)a; const u_int16_t*ib = (const u_int16_t*)b; @@ -76,8 +74,7 @@ tcp_cmp(a, b) } static unsigned int -tcp_hash(a) - const void *a; +tcp_hash(const void *a) { const u_int16_t*ia = (const u_int16_t*)a; @@ -99,8 +96,7 @@ tcp_reset() /* Look up a TCP port's symbolic name */ const char * -tcp_lookup(port) - u_int16_t port; +tcp_lookup(u_int16_t port) { const char *result; static int oldnflag = -1; @@ -143,11 +139,8 @@ tcp_lookup(port) } const char * -tcp_tag(p, end, ip, ip6) - const char *p; - const char *end; - const struct ip *ip; - const struct ip6_hdr *ip6; +tcp_tag(const char *p, const char *end, const struct ip *ip, + const struct ip6_hdr *ip6) { static char src[TAGLEN], dst[TAGLEN]; static char tag[TAGLEN]; @@ -328,10 +321,7 @@ tcp_tag(p, end, ip, ip6) * back to the control flow */ static void -link_ftp_port(d, tag, end) - const char *d; - const char *tag; - const char *end; +link_ftp_port(const char *d, const char *tag, const char *end) { union { struct in_addr addr; @@ -365,12 +355,9 @@ link_ftp_port(d, tag, end) /* Same, but for EPRT */ static void -link_ftp_eport(d, tag, end, defaddr, defaddr6) - const char *d; - const char *tag; - const char *end; - const struct in_addr *defaddr; - const struct in6_addr *defaddr6; +link_ftp_eport(const char *d, const char *tag, const char *end, + const struct in_addr *defaddr, const struct in6_addr *defaddr6) + { struct in_addr addr; unsigned int port; diff --git a/tcp_http.c b/tcp_http.c index f86912c..872f497 100644 --- a/tcp_http.c +++ b/tcp_http.c @@ -33,11 +33,7 @@ * following object argument as a description for the flow. */ void -tcp_http(f, data, end, toserver) - struct flow *f; - const char *data; - const char *end; - int toserver; +tcp_http(struct flow *f, const char *data, const char *end, int toserver) { const char *d; diff --git a/tcp_smtp.c b/tcp_smtp.c index 05b52f2..575df82 100644 --- a/tcp_smtp.c +++ b/tcp_smtp.c @@ -45,9 +45,7 @@ struct smtp_state { /* Returns pointer to string after prefix, or NULL if no match */ const char * -strip_prefix(s, prefix) - const char *s; - const char *prefix; +strip_prefix(const char *s, const char *prefix) { while (*prefix) if (*s++ != *prefix++) @@ -58,8 +56,7 @@ strip_prefix(s, prefix) /* Normalize a line by uppercasing the command word(s), and stripping * and collapsing whitespace */ static void -normalize_line(line) - char *line; +normalize_line(char *line) { char *s, *p; int has_colon; @@ -116,8 +113,7 @@ normalize_line(line) */ static void -normalize_addr(line) - char *line; +normalize_addr(char *line) { char *s, *t, *u; @@ -142,9 +138,7 @@ normalize_addr(line) } static void -smtp_line(f, line) - struct flow *f; - const char *line; +smtp_line(struct flow *f, const char *line) { struct smtp_state *state; const char *s; @@ -223,11 +217,8 @@ if (log)fclose(log); * Look for simple SMTP (RFC 2822) commands. */ void -tcp_smtp(f, data, end, toserver) - struct flow *f; - const char *data; - const char *end; - int toserver; +tcp_smtp(struct flow *f, const char *data, const char *end, + int toserver) { const char *d; struct smtp_state *state; diff --git a/tcp_x11.c b/tcp_x11.c index 3c7d7d1..4ff6ad0 100644 --- a/tcp_x11.c +++ b/tcp_x11.c @@ -79,10 +79,7 @@ struct x11state { * description of the activity that's causing the traffic. */ void -tcp_x11(f, data, end) - struct flow *f; - const char *data; - const char *end; +tcp_x11(struct flow *f, const char *data, const char *end) { struct x11state *state; diff --git a/udp.c b/udp.c index 477bf99..4b05e73 100644 --- a/udp.c +++ b/udp.c @@ -46,9 +46,7 @@ #include "display.h" static int -udp_cmp(a, b) - const void *a; - const void *b; +udp_cmp(const void *a, const void *b) { const u_int16_t*ia = (const u_int16_t*)a; const u_int16_t*ib = (const u_int16_t*)b; @@ -57,8 +55,7 @@ udp_cmp(a, b) } static unsigned int -udp_hash(a) - const void *a; +udp_hash(const void *a) { const u_int16_t*ia = (const u_int16_t*)a; @@ -80,8 +77,7 @@ udp_reset() /* Look up an IP address */ const char * -udp_lookup(port) - u_int16_t port; +udp_lookup(u_int16_t port) { const char *result; static int oldnflag = -1; @@ -122,11 +118,8 @@ udp_lookup(port) } const char * -udp_tag(p, end, ip, ip6) - const char *p; - const char *end; - const struct ip *ip; - const struct ip6_hdr *ip6; +udp_tag(const char *p, const char *end, const struct ip *ip, + const struct ip6_hdr *ip6) { static char src[TAGLEN], dst[TAGLEN]; static char tag[TAGLEN]; diff --git a/wol.c b/wol.c index 0cd0fc8..100cded 100644 --- a/wol.c +++ b/wol.c @@ -32,10 +32,8 @@ * is at the beginning. */ const char * -ether_wol(p, end, src) - const char *p; - const char *end; - const char *src; +ether_wol(const char *p, const char *end, + const char *src) { static const unsigned char magic[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, From 7111e8c63c90fb5ea68a0819beff4940f3347399 Mon Sep 17 00:00:00 2001 From: Syed-Shahrukh-OSSRevival Date: Fri, 24 Oct 2025 00:23:41 +0500 Subject: [PATCH 2/3] Fix packed ignore warning --- ipx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ipx.c b/ipx.c index be78c81..9d5ec5d 100644 --- a/ipx.c +++ b/ipx.c @@ -43,16 +43,16 @@ # define XXX __attribute__((__packed__)) typedef struct { u_int32_t net XXX; - u_int8_t host[6] XXX; + u_int8_t host[6]; u_int16_t port XXX; } ipx_address, ipx_addr_t; struct ipxhdr { u_int16_t ipx_sum XXX; /* Checksum */ u_int16_t ipx_len XXX; /* Length, in bytes, including header */ - u_int8_t ipx_tc XXX; /* Transport Control (i.e. hop count) */ - u_int8_t ipx_pt XXX; /* Packet Type (i.e. lev 2 protocol) */ - ipx_addr_t ipx_dna XXX; /* Destination Network Address */ - ipx_addr_t ipx_sna XXX; /* Source Network Address */ + u_int8_t ipx_tc; /* Transport Control (i.e. hop count) */ + u_int8_t ipx_pt; /* Packet Type (i.e. lev 2 protocol) */ + ipx_addr_t ipx_dna; /* Destination Network Address */ + ipx_addr_t ipx_sna; /* Source Network Address */ }; # undef XXX # else From b430a0a20b0f57d525b124efb4c61199f57454bd Mon Sep 17 00:00:00 2001 From: Syed-Shahrukh-OSSRevival Date: Fri, 24 Oct 2025 00:24:47 +0500 Subject: [PATCH 3/3] Replaced deprecated function --- main.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 93d7149..1e3a61d 100644 --- a/main.c +++ b/main.c @@ -147,6 +147,7 @@ main( int argc, char *argv[]) extern int optind; extern char *optarg; pcap_t *p; + pcap_if_t *all_devs; char errbuf[PCAP_ERRBUF_SIZE]; char *interface = NULL; int error = 0; @@ -248,10 +249,14 @@ main( int argc, char *argv[]) } /* Open the interface */ - if (interface == NULL) - interface = pcap_lookupdev(errbuf); - if (!interface) - errx(1, "pcap_lookupdev: %s", errbuf); + if (interface == NULL) { + if (pcap_findalldevs(&all_devs, errbuf) == -1) { + errx(1, "pcap_findalldevs: %s", errbuf); + } + else { + interface = all_devs->name; + } + } p = pcap_open_live(interface, snaplen, Pflag ? 0 : 1, 10, errbuf); if (!p) errx(1, "%s", errbuf);