patch-2.1.17 linux/net/rose/af_rose.c
Next file: linux/net/rose/rose_out.c
Previous file: linux/net/netsyms.c
Back to the patch index
Back to the overall index
- Lines: 41
- Date:
Thu Dec 19 10:32:57 1996
- Orig file:
v2.1.16/linux/net/rose/af_rose.c
- Orig date:
Wed Dec 18 15:59:15 1996
diff -u --recursive --new-file v2.1.16/linux/net/rose/af_rose.c linux/net/rose/af_rose.c
@@ -15,6 +15,8 @@
* History
* Rose 001 Jonathan(G4KLX) Cloned from af_netrom.c.
* Alan(GW4PTS) Hacked up for newer API stuff
+ * Terry (VK2KTJ) Added support for variable length
+ * address masks.
*/
#include <linux/config.h>
@@ -97,6 +99,31 @@
if (addr1->rose_addr[i] != addr2->rose_addr[i])
return 1;
+ return 0;
+}
+
+/*
+ * Compare two Rose addresses for only mask digits, 0 == equal.
+ */
+int rosecmpm(rose_address *addr1, rose_address *addr2, unsigned short mask)
+{
+ int i, j;
+
+ if (mask > 10)
+ return 1;
+
+ for (i = 0, j = 0; i < mask; i++) {
+ j = i / 2;
+
+ if ((i % 2) != 0) { /* odd place */
+ if ((addr1->rose_addr[j] & 0xF0) != (addr2->rose_addr[j] & 0xF0))
+ return 1;
+ } else { /* even place */
+ if ((addr1->rose_addr[j] & 0x0F) != (addr2->rose_addr[j] & 0x0F))
+ return 1;
+ }
+ }
+
return 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov