summaryrefslogtreecommitdiffstats
path: root/lib/ipv4.c
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1999-05-14 20:03:09 +0200
committerMartin Mares <mj@ucw.cz>1999-05-14 20:03:09 +0200
commitb23c5e0ff4e9071b2568bf2f7d437bc13273d17d (patch)
tree2e6ff94f799923b0c8cd70ebedd431368f67b059 /lib/ipv4.c
parent11ce4490fac7d0446802738f5fb8fd68c36bd30b (diff)
downloadbird-b23c5e0ff4e9071b2568bf2f7d437bc13273d17d.tar
bird-b23c5e0ff4e9071b2568bf2f7d437bc13273d17d.zip
Added ip_skip_header() and modified OSPF to use it.
Diffstat (limited to 'lib/ipv4.c')
-rw-r--r--lib/ipv4.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/ipv4.c b/lib/ipv4.c
index 186b36a..943e2c8 100644
--- a/lib/ipv4.c
+++ b/lib/ipv4.c
@@ -94,3 +94,18 @@ ip_pton(char *a, ip_addr *o)
*o = ipa_from_u32(ia);
return 1;
}
+
+byte *
+ipv4_skip_header(byte *pkt, int *len)
+{
+ int l = *len;
+ int q;
+
+ if (l < 20 || (*pkt & 0xf0) != 0x40)
+ return NULL;
+ q = (*pkt & 0x0f) * 4;
+ if (q < l)
+ return NULL;
+ *len -= q;
+ return pkt + q;
+}