Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147885933
D31502.id93528.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D31502.id93528.diff
View Options
Index: sbin/dhclient/bpf.c
===================================================================
--- sbin/dhclient/bpf.c
+++ sbin/dhclient/bpf.c
@@ -119,18 +119,18 @@
/* Make sure this isn't a fragment... */
BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 20),
- BPF_JUMP(BPF_JMP + BPF_JSET + BPF_K, 0x1fff, 6, 0), /* patched */
+ BPF_JUMP(BPF_JMP + BPF_JSET + BPF_K, IP_MF|IP_OFFMASK, 6, 0),
/* Get the IP header length... */
BPF_STMT(BPF_LDX + BPF_B + BPF_MSH, 14),
/* Make sure it's from the right port... */
BPF_STMT(BPF_LD + BPF_H + BPF_IND, 14),
- BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 68, 0, 3),
+ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, LOCAL_PORT, 0, 3),
/* Make sure it is to the right ports ... */
BPF_STMT(BPF_LD + BPF_H + BPF_IND, 16),
- BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 67, 0, 1),
+ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, REMOTE_PORT, 0, 1),
/* If we passed all the tests, ask for the whole packet. */
BPF_STMT(BPF_RET+BPF_K, (u_int)-1),
@@ -164,9 +164,6 @@
p.bf_len = dhcp_bpf_wfilter_len;
p.bf_insns = dhcp_bpf_wfilter;
- if (dhcp_bpf_wfilter[7].k == 0x1fff)
- dhcp_bpf_wfilter[7].k = htons(IP_MF|IP_OFFMASK);
-
if (ioctl(info->wfdesc, BIOCSETWF, &p) < 0)
error("Can't install write filter program: %m");
@@ -190,9 +187,6 @@
/*
* Packet filter program...
- *
- * XXX: Changes to the filter program may require changes to the
- * constant offsets used in if_register_send to patch the BPF program!
*/
static struct bpf_insn dhcp_bpf_filter[] = {
/* Make sure this is an IP packet... */
@@ -205,14 +199,14 @@
/* Make sure this isn't a fragment... */
BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 20),
- BPF_JUMP(BPF_JMP + BPF_JSET + BPF_K, 0x1fff, 4, 0),
+ BPF_JUMP(BPF_JMP + BPF_JSET + BPF_K, IP_MF|IP_OFFMASK, 4, 0),
/* Get the IP header length... */
BPF_STMT(BPF_LDX + BPF_B + BPF_MSH, 14),
/* Make sure it's to the right port... */
BPF_STMT(BPF_LD + BPF_H + BPF_IND, 16),
- BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 67, 0, 1), /* patch */
+ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, LOCAL_PORT, 0, 1),
/* If we passed all the tests, ask for the whole packet. */
BPF_STMT(BPF_RET+BPF_K, (u_int)-1),
@@ -266,13 +260,6 @@
p.bf_len = dhcp_bpf_filter_len;
p.bf_insns = dhcp_bpf_filter;
- /* Patch the server port into the BPF program...
- *
- * XXX: changes to filter program may require changes to the
- * insn number(s) used below!
- */
- dhcp_bpf_filter[8].k = LOCAL_PORT;
-
if (ioctl(info->rfdesc, BIOCSETF, &p) < 0)
error("Can't install packet filter program: %m");
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 15, 10:20 AM (5 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29712782
Default Alt Text
D31502.id93528.diff (2 KB)
Attached To
Mode
D31502: dhclient: remove the need to patch static values
Attached
Detach File
Event Timeline
Log In to Comment