Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109458155
D47785.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1022 B
Referenced Files
None
Subscribers
None
D47785.diff
View Options
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -441,6 +441,27 @@
return (error);
}
+int
+in_mask2len(struct in_addr *mask)
+{
+ int x, y;
+ u_char *p;
+
+ p = (u_char *)mask;
+ for (x = 0; x < sizeof(*mask); x++) {
+ if (p[x] != 0xff)
+ break;
+ }
+ y = 0;
+ if (x < sizeof(*mask)) {
+ for (y = 0; y < 8; y++) {
+ if ((p[x] & (0x80 >> y)) == 0)
+ break;
+ }
+ }
+ return (x * 8 + y);
+}
+
int
in_control(struct socket *so, u_long cmd, void *data, struct ifnet *ifp,
struct thread *td)
diff --git a/sys/netinet/in_var.h b/sys/netinet/in_var.h
--- a/sys/netinet/in_var.h
+++ b/sys/netinet/in_var.h
@@ -459,6 +459,7 @@
int in_leavegroup(struct in_multi *, /*const*/ struct in_mfilter *);
int in_leavegroup_locked(struct in_multi *,
/*const*/ struct in_mfilter *);
+int in_mask2len(struct in_addr *);
int in_control(struct socket *, u_long, void *, struct ifnet *,
struct thread *);
int in_control_ioctl(u_long, void *, struct ifnet *,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Feb 6, 8:21 AM (20 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16489797
Default Alt Text
D47785.diff (1022 B)
Attached To
Mode
D47785: in: add in_mask2len()
Attached
Detach File
Event Timeline
Log In to Comment