I know barely nothing about computer networks. I am currently porting some windows code to linux, using .NET core. Some parts have not been implemented for linux, and determining an IP prefix is one of them. I am searching the web in order to understand what is an IP prefix to start with, and, ultimately, figure out if I can determine the logic to define the prefix for a given IP.
To be more specific, the code actually only cares to determine the "prefix origin" of the ip - or, in the documentation terms: specifies how an IP address network prefix was located
". The possible values for this piece of data are
Other = 0,
Manual,
WellKnown,
Dhcp,
RouterAdvertisement,
First question: Are IP prefix/suffixes the same topic as subnetwork? In laymen terms, a prefix identifies the sender (network component that sent the packet) and the suffix the destination ?
Now, the main question: Given an IP address (either v4 or v6), is there a simple deterministic way to define its prefix ? If v6 makes things more complex, I would still be happy to know how to handle v4 ips.