diff options
-rw-r--r-- | include/linux/if_phonet.h | 4 | ||||
-rw-r--r-- | net/phonet/af_phonet.c | 29 |
2 files changed, 33 insertions, 0 deletions
diff --git a/include/linux/if_phonet.h b/include/linux/if_phonet.h index 22df25fbc4e2..7e989216ec17 100644 --- a/include/linux/if_phonet.h +++ b/include/linux/if_phonet.h | |||
@@ -12,3 +12,7 @@ | |||
12 | /* 6 bytes header + 65535 bytes payload */ | 12 | /* 6 bytes header + 65535 bytes payload */ |
13 | #define PHONET_MAX_MTU 65541 | 13 | #define PHONET_MAX_MTU 65541 |
14 | #define PHONET_DEV_MTU PHONET_MAX_MTU | 14 | #define PHONET_DEV_MTU PHONET_MAX_MTU |
15 | |||
16 | #ifdef __KERNEL__ | ||
17 | extern struct header_ops phonet_header_ops; | ||
18 | #endif | ||
diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c index e6771d3961cf..51397ff308bd 100644 --- a/net/phonet/af_phonet.c +++ b/net/phonet/af_phonet.c | |||
@@ -99,6 +99,35 @@ static struct net_proto_family phonet_proto_family = { | |||
99 | .owner = THIS_MODULE, | 99 | .owner = THIS_MODULE, |
100 | }; | 100 | }; |
101 | 101 | ||
102 | /* Phonet device header operations */ | ||
103 | static int pn_header_create(struct sk_buff *skb, struct net_device *dev, | ||
104 | unsigned short type, const void *daddr, | ||
105 | const void *saddr, unsigned len) | ||
106 | { | ||
107 | u8 *media = skb_push(skb, 1); | ||
108 | |||
109 | if (type != ETH_P_PHONET) | ||
110 | return -1; | ||
111 | |||
112 | if (!saddr) | ||
113 | saddr = dev->dev_addr; | ||
114 | *media = *(const u8 *)saddr; | ||
115 | return 1; | ||
116 | } | ||
117 | |||
118 | static int pn_header_parse(const struct sk_buff *skb, unsigned char *haddr) | ||
119 | { | ||
120 | const u8 *media = skb_mac_header(skb); | ||
121 | *haddr = *media; | ||
122 | return 1; | ||
123 | } | ||
124 | |||
125 | struct header_ops phonet_header_ops = { | ||
126 | .create = pn_header_create, | ||
127 | .parse = pn_header_parse, | ||
128 | }; | ||
129 | EXPORT_SYMBOL(phonet_header_ops); | ||
130 | |||
102 | /* | 131 | /* |
103 | * Prepends an ISI header and sends a datagram. | 132 | * Prepends an ISI header and sends a datagram. |
104 | */ | 133 | */ |