Regarding the second condition, what does it mean more "more
specific"?
It means that the mask is longer. A longer mask is more specific than a shorter mask. The longest IPv4 mask is /32
, and it is the most specific IPv4 address because it identifies an address all the way down to the host.
Is 10.1.2.0/24 a sub prefix of 10.1.0.0/24?
No.
What's the rule for deciding if a prefix is sub prefix of another
prefix?
If you mask both addresses with the shortest mask, you will find out if they share a common network. This is the very basis for IP addressing (both IPv4 and IPv6). Even hosts do this to determine if a destination address is in the same network as the host itself. A host needs to know if it can send traffic directly to the destination (same network), or if it must send it to its configured gateway (different network).
There is an excellent answer to this question that explains how to do IP math. There is also an answer on Server Fault that gives a demonstration of checking two addresses to determine if there is a common network.
In your case:
10.1.2.0 -> 00001010000000010000001000000000
255.255.255.0 -> 11111111111111111111111100000000
AND -> ================================
Network -> 00001010000000010000001000000000 = 10.1.2.0
10.1.0.0 -> 00001010000000010000000000000000
255.255.255.0 -> 11111111111111111111111100000000
AND -> ================================
Network -> 00001010000000010000000000000000 = 10.1.0.0
The resulting two network addresses do not match: 10.1.2.0
<> 10.1.0.0
.
EDIT:
You changed the question, and you now have a different question with a different answer.
Is 10.1.2.0/24 a sub prefix of 10.1.0.0/16?
Yes.
In your case:
10.1.2.0 -> 00001010000000010000001000000000
255.255.0.0 -> 11111111111111110000000000000000
AND -> ================================
Network -> 00001010000000010000000000000000 = 10.1.0.0
10.1.0.0 -> 00001010000000010000000000000000
255.255.0.0 -> 11111111111111110000000000000000
AND -> ================================
Network -> 00001010000000010000000000000000 = 10.1.0.0
The resulting two network addresses match: 10.1.0.0
= 10.1.0.0
.